@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-color: #F4F5F6;
  --bg-gradient: #F4F5F6;
  --surface-color: #ffffff;
  --surface-color-solid: #ffffff;
  --surface-border: #D1D5DB;
  --surface-highlight: #E5E7EB;
  --text-primary: #003d6a;
  --text-secondary: #64748b;
  --accent-color: #003d6a; /* HGV Official Brand Navy */
  --accent-hover: #002a4a;
  --accent-glow: rgba(0, 61, 106, 0.15);
  --accent-subtle: rgba(0, 61, 106, 0.05);
  --accent-green: #01A4AD; /* HGV Brand Green (Bondi Blue) */
  --positive-color: #0d9488;
  --positive-bg: #0d94880f;
  --negative-color: #e11d48;
  --negative-bg: #e11d480f;
  --warning-color: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --neutral-bg: #EAEAEA;
  --font-sans: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Type scale — product UI, ratio ~1.2 */
  --text-xs: 0.72rem;
  --text-sm: 0.82rem;
  --text-base: 0.95rem;
  --text-md: 1.1rem;
  --text-lg: 1.3rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;

  --leading-tight: 1.25;
  --leading-base: 1.5;
  --leading-relaxed: 1.7;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  --input-bg: #ffffff;
  --box-bg: #f8fafc;
  --glass-bg: #ffffff;
  --zebra-bg: #00000004;
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  --radius-xl: 0px;
  --radius-full: 0px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-glow: none;
  --shadow-card-hover: 2px 4px 12px rgba(0, 0, 0, 0.08);
  --transition-fast: 0.1s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
}

body.dark-theme {
  --bg-color: #0A1628; /* Warmer premium dark */
  --bg-gradient: #0A1628;
  --surface-color: #13243A;
  --surface-color-solid: #13243A;
  --surface-border: #2B3D55;
  --surface-highlight: rgba(255, 255, 255, 0.05);
  --text-primary: #F1F5F9;
  --text-secondary: #94a3b8;
  --accent-color: #01A4AD; /* Use Green as primary accent in dark mode */
  --accent-hover: #00D2DE;
  --accent-glow: rgba(1, 164, 173, 0.15);
  --accent-subtle: rgba(1, 164, 173, 0.05);
  --accent-green: #00D2DE;
  --positive-color: #2dd4bf;
  --positive-bg: #2dd4bf14;
  --negative-color: #fb7185;
  --negative-bg: #fb718514;
  --warning-color: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --neutral-bg: rgba(1, 164, 173, 0.08);
  --input-bg: #091322;
  --box-bg: #0003;
  --glass-bg: #13243A;
  --zebra-bg: #ffffff04;
  --shadow-card-hover: 2px 4px 12px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Hide number input spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
  font-size: 1.15rem;
}

/* iOS Safari: prevent auto-zoom on inputs by keeping font-size >= 16px */
@media screen and (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

body {
  background: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background: url('/images/lifestyle/background.jpg') center/cover no-repeat;
  opacity: 0.04;
  pointer-events: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Header Button Styles */
.header-btn {
  background: transparent;
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.header-btn:hover {
  background: var(--surface-color);
  color: var(--text-primary);
  border-color: var(--accent-color);
}

.header-btn:active {
  transform: scale(0.95);
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem 2rem 2rem;
}

/* Modern Header */
.app-header-modern {
  border-bottom: 1px solid var(--surface-border);
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem 0;
  display: flex;
}

.header-client-info {
  flex-direction: column;
  flex: 1;
  justify-content: center;
  align-items: center;
  display: flex;
}

.header-client-stats {
  color: var(--text-secondary);
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
  font-size: var(--text-sm);
  display: flex;
}

.client-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--box-bg);
  border: 1px solid var(--surface-border);
  border-radius: 9999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.85rem;
  white-space: nowrap;
  color: var(--text-secondary);
}
.client-stat-pill strong {
  color: var(--text-primary);
  font-weight: 600;
}
.client-stat-pill.stat-a { color: var(--positive-color); border-color: var(--positive-color); background: var(--positive-bg); }
.client-stat-pill.stat-d { color: var(--negative-color); border-color: var(--negative-color); background: var(--negative-bg); }
.client-stat-pill.stat-n { color: #f97316; border-color: #f97316; background: rgba(249,115,22,0.08); }
.client-stat-pill.stat-p { color: #f59e0b; border-color: #f59e0b; background: rgba(245,158,11,0.08); }
.client-stat-pill.stat-r { color: #6b7280; border-color: #6b7280; background: rgba(107,114,128,0.08); }

.mobile-status-pill { display: none; }

.mobile-home-btn { display: none; }

.header-controls-modern {
  align-items: center;
  gap: 0.25rem;
  display: flex;
}

.header-icon-btn {
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  background: 0 0;
  border: none;
  justify-content: center;
  align-items: center;
  padding: 0.5rem;
  display: flex;
}

.header-icon-btn:hover {
  color: var(--accent-color);
  background: var(--accent-subtle);
}

.header-icon-btn:active {
  transform: scale(0.92);
}

.header-icon-btn--danger:hover {
  color: var(--negative-color);
  background: var(--negative-bg);
}

.header-divider {
  background: var(--surface-border);
  width: 1px;
  height: 20px;
  margin: 0 0.5rem;
}

.welcome-text {
  color: var(--text-primary);
  letter-spacing: 0.3px;
  font-size: 1.1rem;
  font-weight: 400;
}

.app-logos {
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  display: flex;
}

.app-logos img {
  object-fit: contain;
  border-radius: 4px;
  height: 60px;
  width: auto;
  transition: all 0.3s;
}

body.dark-theme .app-logos img,
body.dark-theme .home-logo img {
  filter: brightness(0) invert();
}

.sales-export-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent-color);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  background: var(--surface-color);
  color: var(--text-primary);
}

.theme-toggle:active {
  transform: scale(0.9);
}

/* Tabs — Square / Filled Style */
.tabs-container {
  justify-content: center;
  margin-bottom: 2rem;
  display: flex;
}

.tabs-track {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 0px;
  padding: 4px;
  display: inline-flex;
  position: relative;
  gap: 2px;
}

.tab-indicator {
  display: none !important;
}

.tab-btn {
  color: var(--text-secondary);
  border-radius: 0px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--transition-base), color var(--transition-base);
  white-space: nowrap;
  user-select: none;
  background: transparent;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tab-btn:hover {
  background: var(--accent-subtle);
  color: var(--accent-color);
}

.tab-btn.active {
  background: var(--accent-color);
  color: #ffffff;
  box-shadow: none;
}

.tab-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Chart Year Buttons */
.chart-yr-btn {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.chart-yr-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-color);
}

.chart-yr-btn:active {
  transform: scale(0.95);
}

.chart-yr-btn.active {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

/* Projection Header Layout */
.projection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.projection-buttons {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Calculator Container */
.calculator-container {
  display: none;
  opacity: 0;
  transform: translateY(10px);
}

.calculator-container.active {
  display: block;
  animation: fadeIn 0.4s ease forwards;
}

.calculator-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  gap: 0.75rem;
}

.calculator-loading::before {
  content: '';
  width: 24px;
  height: 24px;
  border: 2px solid var(--surface-border);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Layout for Calculators */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
}

.chart-container {
  width: 100%;
  height: clamp(192px, 38.4vw, 336px);
  margin-bottom: 2rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 0px;
  padding: 1rem;
  border: 1px solid var(--surface-border);
  position: relative;
}

body.dark-theme .chart-container {
  background: rgba(0, 0, 0, 0.2);
}

@media (max-width: 1024px) {
  .calc-grid {
    grid-template-columns: 1fr 1.5fr;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .calc-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  #app {
    padding: 1rem;
  }

  #app.login-active {
    padding: 0;
  }

  body.login-active {
    overflow: hidden;
  }

  .app-title {
    font-size: 2rem;
  }

  .app-header-modern {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 0;
  }

  .header-client-info {
    display: contents;
  }

  .welcome-text {
    text-align: center;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .welcome-text strong {
    font-weight: normal;
  }

  .mobile-status-pill {
    display: inline-flex !important;
    width: fit-content;
  }

  .app-header-modern .app-logos {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0 !important;
  }

  .app-header-modern .app-logos img {
    height: 46.2px !important;
  }

  .sales-page .app-header-modern .app-logos img {
    height: 48px !important;
    max-width: none !important;
    width: auto !important;
  }

  .header-controls-modern {
    justify-content: flex-end;
    gap: 0.25rem;
  }

  .header-icon-btn {
    padding: 0.36rem;
  }

  .header-icon-btn svg {
    width: 24px;
    height: 24px;
  }

  .header-client-stats {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    font-size: 1.1rem;
    gap: 0.35rem;
  }

  .header-client-stats .dot-separator {
    display: inline-block;
  }

  .tabs-container {
    justify-content: stretch;
  }

  .tabs-track {
    width: 100%;
    display: flex;
    border-radius: 0px;
  }

  .tab-btn {
    text-align: center;
    flex: 1;
    padding: 0.6rem 0.5rem;
    font-size: 0.82rem;
    white-space: normal;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .data-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chart-container {
    height: clamp(240px, 48vw, 420px);
  }

  .app-logos {
    gap: 1rem;
  }

  .app-logos img {
    height: 47.25px;
  }

  .projection-header {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 1.5rem;
  }

  .projection-header .card-title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 0.5rem !important;
  }

  .projection-buttons {
    justify-content: center;
    width: 100%;
  }

  .projection-buttons .chart-yr-btn {
    flex: 1;
  }

  .app-subtitle {
    display: block !important;
    margin-top: 1rem;
    font-size: 1rem;
  }

  .header-controls {
    flex-wrap: wrap !important;
    gap: 1rem !important;
  }

  /* Welcome Text */
  .header-controls>div:nth-child(1) {
    order: 1;
    flex: 1 !important;
  }

  /* Buttons */
  .header-controls>div:nth-child(3) {
    order: 2;
    flex: 1 !important;
    justify-content: flex-end !important;
    padding-top: 0 !important;
  }

  /* Logo */
  .header-controls>div:nth-child(2) {
    order: 3;
    flex: 0 0 100% !important;
    justify-content: center !important;
    margin-top: 0.5rem;
  }
}

@media (max-width: 375px) {
  .summary-value {
    font-size: 1.75rem;
  }

  #app {
    padding: 0.5rem;
  }

  #app.login-active {
    padding: 0;
  }

  body.login-active {
    overflow: hidden;
  }

  .card-title {
    font-size: 1.25rem;
  }

  .app-header-modern {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "logo logo"
      "welcome icons"
      "stats stats";
    gap: 0.5rem;
    padding: 0.5rem 0;
  }

  .app-header-modern .app-logos {
    padding-top: 1.5rem !important;
    padding-bottom: 1rem !important;
    justify-content: flex-start;
  }

  .app-header-modern .app-logos img {
    height: 48px !important;
  }

  .sales-page .app-header-modern .app-logos img {
    height: 48px !important;
    max-width: none !important;
    width: auto !important;
  }

  .welcome-text {
    font-size: 0.95rem;
    text-align: left;
    padding-left: 0.25rem;
  }

  .header-client-stats {
    font-size: 0.88rem;
    gap: 0.35rem;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .header-controls-modern {
    gap: 0.15rem;
  }

  .header-icon-btn {
    padding: 0.3rem;
  }

  .header-icon-btn svg {
    width: 22px;
    height: 22px;
  }

  .tab-btn {
    font-size: 0.72rem;
    padding: 0.5rem 0.35rem;
  }

  .trips-grid {
    grid-template-columns: 1fr;
  }

  .partners-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
}

/* Cards (Clean Professional Style) */
.glass-card {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  min-width: 0;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  padding: 1.5rem;
  animation: 0.5s cubic-bezier(0.16, 1, 0.3, 1) both cardEnter;
  position: relative;
}

/* Primary content cards keep the accent border */
.calculator-container .glass-card,
.trips-header-section + .glass-card,
.calc-grid .glass-card {
  border-top: 3px solid var(--accent-color);
}

.glass-card:hover {
  box-shadow: var(--shadow-card-hover);
}

@keyframes cardEnter {
  0% {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-title {
  font-family: var(--font-display);
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
}

.section-title {
  font-family: var(--font-display);
  color: var(--text-primary);
  letter-spacing: -0.01em;
  border-left: 3px solid var(--accent-color);
  margin-bottom: 1.5rem;
  padding-left: 0.75rem;
  font-size: 1.3rem;
}

/* Inputs */
.input-group {
  margin-bottom: 1.25rem;
}

.input-group label {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: var(--weight-semibold);
}

.input-group input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  transition: all 0.2s;
  border-left: 3px solid var(--accent-color);
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Focus-visible ring for keyboard navigation accessibility */
*:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Custom Range Input Styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-border);
  outline: none;
  transition: background 0.2s;
  cursor: pointer;
  border: none;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  border: 3px solid var(--bg-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 10px var(--accent-glow);
}

input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.05);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  border: 3px solid var(--bg-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 10px var(--accent-glow);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-border);
}

@media (hover: none) and (pointer: coarse) {
  input[type="range"] {
    pointer-events: none;
  }
  
  input[type="range"]::-webkit-slider-thumb {
    pointer-events: auto;
  }
  
  input[type="range"]::-moz-range-thumb {
    pointer-events: auto;
  }
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--surface-border);
}

.data-table th {
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  position: sticky;
  top: 0;
  background: var(--surface-color);
  z-index: 10;
  box-shadow: 0 1px 0 var(--surface-border);
}

.data-table tfoot td,
.data-table tfoot th {
  position: sticky;
  bottom: 0;
  background: var(--surface-color);
  z-index: 10;
  box-shadow: 0 -1px 0 var(--surface-border);
}

.data-table td {
  font-variant-numeric: tabular-nums;
}

/* Zebra striping */
.data-table tbody tr:nth-child(even) {
  background: var(--box-bg);
}

.data-table tbody tr {
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.data-table tbody tr:hover {
  background: var(--box-bg);
  border-left: 3px solid var(--accent-color);
}

/* Smooth scroll for data tables */
.data-table-wrapper {
  scroll-behavior: smooth;
}

/* Summary Items */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  max-width: 100%;
  overflow: hidden;
}

.summary-item {
  background: var(--box-bg);
  padding: 1.5rem;
  border-radius: 0px;
  border: 1px solid var(--surface-border);
  border-top: 3px solid var(--accent-color);
  text-align: center;
  transition: all 0.3s ease;
  min-width: 0;
  animation: cardEntrance 0.5s ease backwards;
}

.summary-item:nth-child(1) {
  animation-delay: 0.05s;
}

.summary-item:nth-child(2) {
  animation-delay: 0.1s;
}

.summary-item:nth-child(3) {
  animation-delay: 0.15s;
}

.summary-item:nth-child(4) {
  animation-delay: 0.2s;
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Only apply hover lift on devices that support hover (not touch) */
@media (hover: hover) {
  .summary-item:hover {
    transform: translateY(-4px);
    border-color: var(--accent-color);
    box-shadow: 0 4px 20px var(--accent-glow);
  }
}

.summary-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.summary-value {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.summary-value.positive {
  color: var(--positive-color);
}

.summary-value.negative {
  color: var(--negative-color);
}

/* Auth page theme toggle */
.auth-theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
}

/* Login Screen Styles */
.login-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  width: 100%;
}

/* Decorative background orbs for visual interest */
.login-container::before {
  content: '';
  position: absolute;
  width: 40vw;
  max-width: 400px;
  aspect-ratio: 1;
  background: var(--accent-color);
  filter: blur(100px);
  border-radius: 50%;
  opacity: 0.15;
  top: 10%;
  left: 15%;
  z-index: -1;
  animation: floatOrb 20s ease-in-out infinite alternate;
}

.login-container::after {
  content: '';
  position: absolute;
  width: 30vw;
  max-width: 300px;
  aspect-ratio: 1;
  background: var(--accent-green);
  filter: blur(100px);
  border-radius: 50%;
  opacity: 0.12;
  bottom: 10%;
  right: 15%;
  z-index: -1;
  animation: floatOrb 15s ease-in-out infinite alternate-reverse;
}

@keyframes floatOrb {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(30px, 30px);
  }
}

.login-form {
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.login-icon-container {
  margin-bottom: 1.5rem;
}

.login-icon {
  width: 56px;
  height: 56px;
  color: var(--accent-color);
}

.login-title {
  margin-bottom: 0.5rem;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.login-input-group {
  text-align: left;
}

/* Login input with icon */
.login-input-wrapper {
  position: relative;
}

.login-input-wrapper .login-input-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.login-input-wrapper input {
  padding-left: 2.75rem !important;
}

.login-error {
  color: var(--negative-color);
  font-size: 0.9rem;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  text-align: left;
  display: none;
}

.btn-primary {
  width: 100%;
  background: var(--accent-color);
  color: #ffffff;
  border: none;
  padding: 0.8rem;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 1rem;
  position: relative;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: none;
}

.btn-primary.loading {
  pointer-events: none;
  opacity: 0.8;
}

.btn-primary.loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  right: 1rem;
  top: 50%;
  margin-top: -9px;
}

/* Modal Overlay Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease-out forwards;
}

.modal-overlay .glass-card {
  animation: modalEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Safe-area padding for notched devices */
body {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* Fixed controls respect safe areas */
.modal-overlay {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Force all Travel Services logos to be pure white and remove white backgrounds in Dark Mode */
body.dark-theme .airline-logo-container img {
  display: block;
  margin: 0 auto;
  filter: grayscale(1) contrast(1000%) invert(1);
  mix-blend-mode: screen;
}

/* Dynamic logo for dark mode SVG inversion */
.dark .dynamic-logo {
  filter: brightness(0) invert(1) !important;
}

/* Travel Partners Logo Grid */
.airline-logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 90px;
  padding: 8px;
  overflow: hidden;
}

.airline-logo-container img {
  display: block;
  margin: 0 auto;
  height: 70px !important;
  width: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain;
}

@media (max-width: 768px) {
  .airline-logo-container {
    height: 60px;
  }
  .airline-logo-container img {
    height: 50px !important;
    max-height: none !important;
  }
}

@media (max-width: 480px) {
  .airline-logo-container {
    height: 90px;
  }
  .airline-logo-container img {
    height: 78px !important;
    max-height: none !important;
  }
}

/* Travel Partners Section Grid */
.partners-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  align-items: center;
  justify-items: center;
  padding: 0 2rem;
}

@media (max-width: 768px) {
  .partners-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .bg-transition-card {
    padding-bottom: 2.5rem !important;
  }
}

@media (max-width: 480px) {
  .partners-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .bg-transition-card {
    padding-bottom: 2.5rem !important;
  }
}

@media (max-width: 768px) {
  .partners-grid {
    padding: 0 0.5rem;
  }
}

/* Hilton Brand Family Footer — all brands same font, size, weight */
.hilton-brands-footer .brand-name,
.brands-grid .brand-name,
.brand-name {
  font-family: "Open Sans", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
  font-size: 0.85rem !important;
  font-weight: 400 !important;
  color: var(--text-secondary) !important;
  text-align: center !important;
  letter-spacing: 0.02em !important;
  text-transform: none !important;
}/* HGV Signature Vacations - Trips Styles (Flat Square Design) */
.trips-header-section {
  text-align: center;
  margin-bottom: 2.5rem;
}

.trips-header-section .section-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.trips-header-section .section-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.trips-filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.filter-btn {
  padding: 0.6rem 1.25rem;
  border-radius: 0px; /* Flat square */
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  background: var(--neutral-bg);
  color: var(--text-primary);
  border-color: var(--accent-color);
}

.filter-btn.active {
  background: var(--accent-color);
  color: #ffffff;
  border-color: var(--accent-color);
  box-shadow: none;
}

body.dark-theme .filter-btn.active {
  background: var(--accent-green);
  color: #000000;
  border-color: var(--accent-green);
}

.trips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.trip-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0px; /* Flat square */
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  height: 100%;
}

.trip-card:hover {
  border-color: var(--accent-green);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

body.dark-theme .trip-card:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.trip-card-header {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 180px;
  position: relative;
}

.trip-points-badge {
  align-self: flex-start;
  margin-bottom: auto;
  background: var(--accent-color);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 0px; /* Flat square */
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--accent-green);
  z-index: 2;
}

body.dark-theme .trip-points-badge {
  background: var(--accent-green);
  color: #000000;
  border: 1px solid var(--accent-green);
}

.trip-destination {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  line-height: 1.2;
  z-index: 2;
}

.trip-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1rem;
}

.trip-info-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.trip-icon {
  color: var(--accent-green);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: rgba(197, 160, 89, 0.1);
  border-radius: 0px; /* Flat square */
}

.trip-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.trip-accommodations {
  margin-top: 0.5rem;
  flex: 1;
}

.trip-accommodations h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.trip-accommodations ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.trip-accommodations li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
  position: relative;
  padding-left: 1rem;
}

.trip-accommodations li::before {
  content: '■'; /* Flat square bullet */
  font-size: 0.6rem;
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--accent-green);
}

.trip-action {
  margin-top: 1.5rem;
}

.trip-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.95rem;
  border-radius: 0px; /* Flat square */
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}
@keyframes fadeUpIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================
   MOBILE RESPONSIVE — all pages
   ========================================== */

/* General mobile adjustments */
@media (max-width: 768px) {
  html {
    font-size: 17.4px;
  }

  body {
    -webkit-text-size-adjust: 100%;
  }

  #app {
    padding: 0.75rem !important;
  }

  .glass-card {
    padding: 1rem !important;
  }

  .card-title {
    font-size: 1.15rem !important;
    margin-bottom: 1rem !important;
  }

  /* Header logo sizing (layout is page-specific) */
  .app-header-modern .app-logos {
    display: flex !important;
    justify-content: center !important;
    padding: 0.5rem 0 !important;
  }

  .header-client-info {
    text-align: center !important;
    width: 100% !important;
  }

  .welcome-text {
    font-size: 0.85rem !important;
  }

  .header-client-stats {
    font-size: 0.75rem !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.4rem !important;
    display: flex !important;
  }

  .header-controls-modern {
    justify-content: center !important;
    gap: 0.25rem !important;
    flex-wrap: wrap !important;
  }

  .header-icon-btn {
    padding: 0.4rem !important;
  }

  .header-icon-btn svg {
    width: 19px !important;
    height: 19px !important;
  }

  /* Tables — scrollable */
  .data-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem !important;
    font-size: 0.8rem !important;
    white-space: nowrap !important;
  }

  /* Modals — full width, proper scrolling */
  .modal-overlay .glass-card {
    width: 95% !important;
    max-width: 95% !important;
    max-height: 82vh !important;
    padding: 0 !important;
    border-radius: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .modal-overlay .glass-card > div:first-child {
    padding: 1rem 1rem 0.75rem !important;
    flex-shrink: 0 !important;
  }

  .modal-overlay .glass-card form,
  .modal-overlay .glass-card > div:last-child:not(:first-child) {
    padding: 1rem 1rem 1.5rem !important;
    overflow-y: auto !important;
    flex: 1 !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Modal: all 2+ column grids become single column */
  .modal-overlay form > div[style*="grid-template-columns: 1fr 1fr"],
  .modal-overlay form > div[style*="grid-template-columns:1fr 1fr"],
  .modal-overlay form > div[style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }

  /* Modal: labels bigger */
  .modal-overlay label {
    font-size: 0.9rem !important;
  }

  /* Modal: inputs/selects bigger */
  .modal-overlay form input,
  .modal-overlay form select {
    font-size: 16px !important;
    padding: 0.6rem !important;
  }

  /* Modal: status pill containers — stack vertically */
  .modal-overlay form > div > div[style*="flex-wrap"] {
    flex-direction: column !important;
    gap: 0.4rem !important;
  }
  .modal-overlay form > div > div[style*="flex-wrap"] label {
    font-size: 0.9rem !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 8px !important;
  }

  /* Modal: all 1fr 1fr grids within form divs */
  .modal-overlay form > div > div[style*="1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 0.4rem !important;
  }
  .modal-overlay form > div > div[style*="1fr 1fr"] label {
    font-size: 0.9rem !important;
  }

  /* Buttons */
  .btn-primary {
    font-size: 0.9rem !important;
    padding: 0.65rem 1rem !important;
  }

  /* Dashboard */
  .dashboard-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }

  /* Sales page */
  #month-filter,
  #status-filter,
  #deal-search {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Tabs */
  .tabs-track {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
  }

  .tab-btn {
    font-size: 0.78rem !important;
    padding: 0.5rem 0.7rem !important;
    flex-shrink: 0 !important;
  }

  /* Summary cards — force 1 column on tablets and below */
  .summary-grid {
    grid-template-columns: 1fr !important;
  }

  /* Home page */
  .home-cards {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  .home-card {
    min-height: 160px !important;
    padding: 1.5rem !important;
  }

  /* Sales filters bar */
  [style*="display: flex; justify-content: center; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem"] {
    flex-wrap: wrap !important;
  }
  .sales-month-filter { order: -1; }

  /* Export modal */
  #export-modal .glass-card {
    width: 90% !important;
  }

  /* View modal */
  #view-modal .glass-card {
    width: 90% !important;
  }

  /* Admin layout */
  .admin-layout {
    flex-direction: column !important;
  }

  .admin-sidebar {
    width: 100% !important;
    padding: 0.75rem !important;
  }

  .admin-content {
    padding: 1rem !important;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .summary-grid {
    grid-template-columns: 1fr !important;
  }
  
  .summary-item[style*="display: none"] {
    display: none !important;
  }

  .header-client-stats {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    font-size: 0.95rem !important;
  }

  .header-controls-modern {
    gap: 0.05rem !important;
  }

  .header-icon-btn {
    padding: 0.3rem !important;
  }

  .header-icon-btn svg {
    width: 22px !important;
    height: 22px !important;
  }

  .data-table th,
  .data-table td {
    padding: 0.4rem !important;
    font-size: 0.75rem !important;
  }

  .tab-btn {
    font-size: 0.7rem !important;
    padding: 0.4rem 0.5rem !important;
  }

  .glass-card {
    padding: 0.75rem !important;
  }

  /* Login */
  .login-form {
    padding: 0 1rem !important;
  }

  /* Calculator grids */
  .calc-grid {
    grid-template-columns: 1fr !important;
  }

  /* Trips */
  .trips-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Sales page header buttons */
  [style*="display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem"] {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 380px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
  pointer-events: auto;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  animation: toastIn 0.25s ease-out;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast--success {
  background: var(--positive-bg);
  border: 1px solid var(--positive-color);
  color: var(--positive-color);
}
.toast--error {
  background: var(--negative-bg);
  border: 1px solid var(--negative-color);
  color: var(--negative-color);
}
.toast--info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid #3b82f6;
  color: #3b82f6;
}
.toast--warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid #f59e0b;
  color: #f59e0b;
}
.toast svg {
  flex-shrink: 0;
  margin-top: 1px;
}
.toast--removing {
  opacity: 0;
  transform: translateX(20px);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast--success svg { color: var(--positive-color); }
.toast--error svg { color: var(--negative-color); }
.toast--info svg { color: #3b82f6; }
.toast--warning svg { color: #f59e0b; }

@media (max-width: 768px) {
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }
}

/* ==========================================
   ACCORDION
   ========================================== */
.accordion-group {
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--box-bg);
  border: none;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.accordion-trigger:hover {
  background: var(--surface-highlight);
}
.accordion-trigger svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: var(--text-secondary);
}
.accordion-group.open .accordion-trigger svg {
  transform: rotate(180deg);
}
.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.accordion-group.open .accordion-panel {
  max-height: 2000px;
}
.accordion-panel-inner {
  padding: 0.5rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
