/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --navy:       #1B3A6B;
  --navy-dark:  #122850;
  --sky:        #3B82F6;
  --sky-light:  #EFF6FF;
  --green:      #16A34A;
  --green-bg:   #DCFCE7;
  --amber:      #B45309;
  --amber-bg:   #FEF3C7;
  --red:        #DC2626;
  --red-bg:     #FEE2E2;
  --gray-50:    #F9FAFB;
  --gray-100:   #F3F4F6;
  --gray-200:   #E5E7EB;
  --gray-400:   #9CA3AF;
  --gray-600:   #4B5563;
  --gray-800:   #1F2937;
  --white:      #FFFFFF;
  --radius:     10px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 25px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.08);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* The hidden attribute must always win over component display rules
   (.badge sets display:inline-block, .bootstrap-status display:flex, …). */
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { display: block; max-width: 100%; }
a  { color: inherit; text-decoration: none; }

/* ── Layout helpers ────────────────────────────────────────────────────── */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--navy);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
}

.logo-plane {
  font-size: 1.4rem;
}

.logo-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.navbar-actions .user-greeting {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-greeting {
  color: rgba(255,255,255,.85);
  font-size: .9rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 22px;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--sky);
  color: var(--white);
  border-color: var(--sky);
}
.btn-primary:hover { background: #2563EB; border-color: #2563EB; }

.btn-success {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
}
.btn-success:hover { background: #15803D; border-color: #15803D; }

.btn-outline {
  background: transparent;
  color: var(--gray-600);
  border-color: var(--gray-200);
}
.btn-outline:hover { background: var(--gray-100); border-color: var(--gray-400); }

.btn-outline-white {
  background: transparent;
  color: var(--white);
  border-color: rgba(255,255,255,.5);
  padding: 7px 18px;
  font-size: .875rem;
}
.btn-outline-white:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.8); }
.btn:disabled,
.btn[aria-busy="true"] {
  cursor: wait;
  opacity: .72;
  box-shadow: none;
}

.btn-lg {
  padding: 13px 32px;
  font-size: 1.05rem;
}

.btn-hero {
  background: var(--white);
  color: var(--navy);
  border-color: var(--white);
  padding: 14px 34px;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
}
.btn-hero:hover { background: var(--sky-light); }

/* ── Error banner ──────────────────────────────────────────────────────── */
.error-banner {
  background: var(--red-bg);
  border-left: 4px solid var(--red);
  color: var(--red);
  padding: 14px 24px;
  font-size: .9rem;
  font-weight: 500;
}
.error-banner:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: -3px;
}

.bootstrap-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: var(--sky-light);
  color: var(--navy);
  font-size: .9rem;
  font-weight: 600;
}

.bootstrap-status__dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--sky);
  box-shadow: 0 0 0 4px rgba(59,130,246,.14);
}

.bootstrap-status--error {
  background: var(--red-bg);
  color: var(--red);
}

.bootstrap-status--error .bootstrap-status__dot {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(220,38,38,.14);
}

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  background: linear-gradient(135deg, var(--navy-dark) 0%, #1B5FAD 60%, #2E86DE 100%);
  min-height: 480px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Subtle grid/pattern overlay */
.hero-overlay {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,.06) 0%, transparent 50%);
}

.hero-inner {
  width: 100%;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
  padding: 60px 0;
}

.hero-tagline {
  color: rgba(255,255,255,.7);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.hero-headline {
  color: var(--white);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.03em;
  margin-bottom: 20px;
}

.hero-sub {
  color: rgba(255,255,255,.8);
  font-size: 1.15rem;
  margin-bottom: 12px;
}

.demo-note {
  color: rgba(255,255,255,.68);
  font-size: .875rem;
  margin-bottom: 28px;
}

/* ── Features ──────────────────────────────────────────────────────────── */
.features {
  padding: 64px 0;
  background: var(--white);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 28px;
}

.feature-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  transition: box-shadow .15s;
}
.feature-card:hover { box-shadow: var(--shadow-md); }

.feature-icon {
  font-size: 2.2rem;
  margin-bottom: 14px;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--navy);
}

.feature-card p {
  font-size: .875rem;
  color: var(--gray-600);
  line-height: 1.5;
}

/* ── CTA band ──────────────────────────────────────────────────────────── */
.cta-band {
  background: var(--sky-light);
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  padding: 56px 0;
}

.cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.cta-inner h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
}

.cta-inner p {
  color: var(--gray-600);
  font-size: .95rem;
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.footer {
  margin-top: auto;
  background: var(--navy-dark);
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: 22px 24px;
  font-size: .85rem;
}
.footer strong { color: rgba(255,255,255,.85); }

/* ── Flights page ──────────────────────────────────────────────────────── */
.flights-main {
  flex: 1;
  padding-bottom: 48px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.section-note {
  color: var(--gray-600);
  font-size: .9rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

.section-note--light {
  color: var(--gray-600);
}

/* ── Search card ───────────────────────────────────────────────────────── */
.search-section {
  background: var(--navy);
  padding: 36px 0;
}

.search-section .section-title {
  color: var(--white);
}

.search-section .section-note {
  color: rgba(255,255,255,.78);
}

.search-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  box-shadow: var(--shadow-lg);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 180px;
}

.form-group--narrow {
  min-width: 100px;
  max-width: 120px;
  flex: 0 0 auto;
}

.form-group label {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-600);
  margin-bottom: 6px;
}

.form-group select,
.form-group input[type="date"],
.form-group input[type="number"] {
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: .95rem;
  color: var(--gray-800);
  background: var(--white);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.form-group input[type="date"] {
  background-image: none;
  cursor: text;
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.form-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

/* ── Results ───────────────────────────────────────────────────────────── */
.results-section {
  padding: 36px 0;
}

.flight-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Flight card ───────────────────────────────────────────────────────── */
.flight-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, border-color .15s;
}

.flight-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--sky);
}

.fc-airline {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.fc-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fc-airline-name {
  font-weight: 700;
  font-size: .9rem;
  color: var(--gray-800);
  line-height: 1.3;
}

.fc-flight-no {
  font-size: .78rem;
  color: var(--gray-400);
  margin-top: 2px;
}

.fc-route {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: center;
}

.fc-time {
  text-align: center;
  min-width: 56px;
}

.fc-clock {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gray-800);
  line-height: 1;
}

.fc-airport {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-top: 3px;
}

.fc-time--right { text-align: right; }

.fc-day-offset {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  font-size: .68rem;
  font-weight: 700;
  line-height: 1.2;
  vertical-align: 2px;
}

.fc-arrow {
  flex: 1;
  min-width: 0;
  text-align: center;
  max-width: 180px;
}

.fc-duration {
  font-size: .78rem;
  color: var(--gray-600);
  margin-bottom: 4px;
}

.fc-line {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}
.fc-line span {
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }

/* ── Price column ──────────────────────────────────────────────────────── */
.fc-price-col {
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}

.fc-total {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}

.fc-per-person {
  font-size: .75rem;
  color: var(--gray-600);
  margin-top: 2px;
}

.fc-seats {
  font-size: .75rem;
  color: var(--red);
  font-weight: 600;
  margin: 6px 0 10px;
}

/* ── Review section ────────────────────────────────────────────────────── */
.review-section {
  padding: 36px 0;
}

.review-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
  max-width: 580px;
  margin-bottom: 24px;
}

.review-flight-summary {}

.rfs-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: .9rem;
  gap: 12px;
}

.rfs-row:last-child { border-bottom: none; }

.rfs-label {
  color: var(--gray-600);
  font-weight: 500;
  flex-shrink: 0;
}

.rfs-value {
  min-width: 0;
  color: var(--gray-800);
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.rfs-row--total {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 2px solid var(--gray-200);
}

.rfs-price {
  font-size: 1.2rem;
  color: var(--navy);
}

.review-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ── Confirm section ───────────────────────────────────────────────────── */
.confirm-section {
  padding: 48px 0;
}

.confirm-card {
  background: var(--white);
  border: 1.5px solid var(--green-bg);
  border-radius: var(--radius);
  padding: 48px 36px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}

.confirm-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}

.confirm-card h2 {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 10px;
}

.confirm-ref {
  font-size: 1.05rem;
  color: var(--gray-600);
  margin-bottom: 28px;
}

.confirm-ref strong {
  color: var(--navy);
  font-size: 1.2rem;
  letter-spacing: .05em;
}

.confirm-flight-info {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .9rem;
  color: var(--gray-600);
  text-align: left;
  margin-bottom: 28px;
}

.confirm-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Token inspector panel ─────────────────────────────────────────────── */
.token-panel-wrap { margin-top: 18px; }

.token-panel {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.token-panel > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  font-weight: 600;
  color: var(--navy);
}

.token-panel > summary::-webkit-details-marker { display: none; }

.token-panel > summary::after {
  content: '▸';
  margin-left: auto;
  color: var(--gray-400);
  transition: transform .15s;
}

.token-panel[open] > summary::after { transform: rotate(90deg); }

.token-panel__hint { font-size: .8rem; font-weight: 400; color: var(--gray-600); }

.token-panel__body {
  border-top: 1px solid var(--gray-100);
  padding: 18px 20px 20px;
}

.token-panel__body h4 {
  font-size: .8rem;
  color: var(--gray-600);
  margin: 16px 0 6px;
  letter-spacing: .03em;
}

.token-panel__body pre {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  max-height: 320px;
  overflow: auto;
  white-space: pre;
}

.token-tabs { display: flex; gap: 8px; margin-bottom: 6px; }

.token-tab {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
  color: var(--gray-600);
  padding: 7px 16px;
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  font-family: inherit;
}

.token-tab[aria-selected="true"] {
  background: var(--sky);
  border-color: var(--sky);
  color: var(--white);
}

.token-agent-strip {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 4px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  font-weight: 600;
  font-size: .88rem;
}

.token-agent-strip--agent {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
}

.token-agent-strip--warn {
  background: var(--amber-bg);
  border-color: var(--amber);
  color: var(--amber);
}

.token-meta { margin-top: 12px; font-size: .82rem; color: var(--gray-600); }

.token-raw summary {
  cursor: pointer;
  color: var(--gray-600);
  font-size: .85rem;
  margin-top: 12px;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 700px) {
  .navbar {
    padding-inline: 16px;
    gap: 10px;
  }

  .navbar-brand {
    min-width: 0;
    flex: 1 1 auto;
  }

  .navbar-actions {
    flex: 0 0 auto;
    gap: 8px;
  }

  .navbar-actions .user-greeting {
    max-width: 96px;
  }

  .navbar-actions .btn-outline-white {
    padding-inline: 12px;
  }

  .flight-card {
    flex-direction: column;
    align-items: stretch;
  }

  .fc-airline { min-width: unset; }

  .fc-route {
    justify-content: space-between;
  }

  .fc-price-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 14px;
    text-align: left;
    min-width: 0;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
  }

  .fc-total,
  .fc-per-person,
  .fc-seats {
    grid-column: 1;
  }

  .fc-total { grid-row: 1; }
  .fc-per-person { grid-row: 2; }
  .fc-seats { grid-row: 3; margin: 6px 0 0; }
  .fc-price-col .book-btn {
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .cta-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-content {
    padding: 40px 0;
  }

  .form-group--narrow {
    max-width: unset;
    flex: 1;
  }
}
