/* ==========================================================================
   Component — Booking Flow
   Shared by all four checkout flows (hotels/tours/transfers = 3 steps,
   flights = 4 steps). Step visibility is driven by WayUgo.booking.
   ========================================================================== */

/* --------------------------------------------------------------------------
   FLAT + TRANSLUCENT TREATMENT
   Scoped to the booking context — the rest of the template keeps its rounded,
   opaque surfaces.

   Radius is removed by zeroing the tokens rather than overriding each
   component: everything built on --wu-radius* inside this scope goes square
   for free, including shared pieces like .wu-panel, .wu-input and .wu-btn.
   Only hardcoded radii (circles, the seat shape) need naming below.

   ⚠ The transparency needs something behind it to read. On a plain white page
   rgba(255,255,255,.72) over #fff is invisible — put the booking page section
   on .wu-section-alt, .wu-section-tinted, or a background image.
   -------------------------------------------------------------------------- */
.wu-booking-layout,
.wu-booking-form,
.wu-confirmation,
.wu-receipt {
  --wu-radius-sm:   0;
  --wu-radius:      0;
  --wu-radius-lg:   0;
  --wu-radius-xl:   0;
  --wu-radius-pill: 0;

  --wu-surface:        rgba(255, 255, 255, .72);
  --wu-surface-alt:    rgba(246, 248, 250, .78);
  --wu-surface-sunken: rgba(238, 241, 245, .78);
}

/* Circles inherited from style.css. These need real selectors because the
   value is a literal 50%, not a token — and they outrank the source rule on
   specificity, so declaration order here doesn't matter. Booking-local
   literals are squared at their own rule instead, further down. */
.wu-booking-layout .wu-counter-btn,
.wu-booking-layout .wu-btn-icon,
.wu-booking-form .wu-counter-btn,
.wu-booking-form .wu-btn-icon,
.wu-booking-form .wu-steps li::before {
  border-radius: 0;
}

.wu-booking-form { display: flex; flex-direction: column; gap: var(--wu-space-5); }

/* A step is a panel; only the active one renders. */
.wu-booking-step { display: none; }
.wu-booking-step.is-active { display: block; animation: wu-fade-up var(--wu-duration) var(--wu-ease-out); }

.wu-booking-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wu-space-3);
  margin-top: var(--wu-space-5);
  padding-top: var(--wu-space-5);
  border-top: 1px solid var(--wu-border);
  /* "Back" and "Continue to payment" together need more than 320px, and a
     flex item will not shrink below its min-content width - so at the
     narrowest phone size they stack instead of pushing the page sideways. */
  flex-wrap: wrap;
}

/* --- Selectable option (room, tour package, vehicle, fare class) --------- */
.wu-option {
  display: flex;
  align-items: center;
  gap: var(--wu-space-4);
  padding: var(--wu-space-4);
  border: 2px solid var(--wu-border);
  border-radius: var(--wu-radius-lg);
  background: var(--wu-surface);
  cursor: pointer;
  transition: border-color var(--wu-duration-sm) var(--wu-ease),
              background-color var(--wu-duration-sm) var(--wu-ease),
              box-shadow var(--wu-duration-sm) var(--wu-ease);
}
.wu-option:hover { border-color: var(--wu-border-strong); }
.wu-option.is-selected {
  border-color: var(--wu-service);
  background: color-mix(in srgb, var(--wu-service) 5%, var(--wu-surface));
  box-shadow: 0 0 0 1px var(--wu-service);
}
.wu-option input { accent-color: var(--wu-service); width: 18px; height: 18px; flex: 0 0 auto; }
.wu-option-body { flex: 1 1 auto; min-width: 0; }
.wu-option-title { margin: 0 0 var(--wu-space-1); font-size: var(--wu-fs-base); }
.wu-option-price { text-align: end; flex: 0 0 auto; }
.wu-option img { width: 110px; border-radius: var(--wu-radius); flex: 0 0 auto; }

/* How many of the chosen vehicle. Hidden until one is picked, so it never
   asks a question the traveller has no answer for yet. */
.wu-vehicle-count {
  margin-top: var(--wu-space-4);
  padding: var(--wu-space-1) var(--wu-space-4);
  border: 1px solid var(--wu-border);
  border-radius: var(--wu-radius);
  background: var(--wu-surface-alt);
}
.wu-vehicle-count strong { font-size: var(--wu-fs-sm); }

/* --- Add-ons (baggage, meals, insurance, car seat) ----------------------- */
.wu-addon {
  display: flex;
  align-items: center;
  gap: var(--wu-space-3);
  padding: var(--wu-space-3) var(--wu-space-4);
  border: 1px solid var(--wu-border);
  border-radius: var(--wu-radius);
  cursor: pointer;
  transition: border-color var(--wu-duration-sm) var(--wu-ease),
              background-color var(--wu-duration-sm) var(--wu-ease);
}
.wu-addon + .wu-addon { margin-top: var(--wu-space-3); }
.wu-addon:hover { border-color: var(--wu-border-strong); }
.wu-addon.is-selected { border-color: var(--wu-service); background: color-mix(in srgb, var(--wu-service) 4%, var(--wu-surface)); }

/* The box is the one on the terms line of the payment step (.wu-filter-check):
   same size, same accent, same pointer. It was the browser default here, which
   read as a different control doing a different job. */
.wu-addon input {
  accent-color: var(--wu-service);
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  cursor: pointer;
}
/* The whole row is the hit area, so the focus ring belongs to the row - on the
   box alone it is easy to lose against the border. */
.wu-addon:has(input:focus-visible) {
  outline: 2px solid var(--wu-primary);
  outline-offset: 2px;
}
.wu-addon-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--wu-radius);
  background: color-mix(in srgb, var(--wu-service) 12%, transparent);
  color: var(--wu-service);
  flex: 0 0 auto;
}

/* --- Booking summary sidebar --------------------------------------------- */
.wu-summary { padding: 0; overflow: hidden; }
.wu-summary-head {
  display: flex;
  gap: var(--wu-space-3);
  padding: var(--wu-space-4);
  background: var(--wu-surface-alt);
  border-bottom: 1px solid var(--wu-border);
}
.wu-summary-head img { width: 72px; height: 60px; object-fit: cover; border-radius: var(--wu-radius-sm); flex: 0 0 auto; }
.wu-summary-body { padding: var(--wu-space-4); }
.wu-summary-foot {
  padding: var(--wu-space-4);
  border-top: 1px solid var(--wu-border);
  background: var(--wu-surface-alt);
}

/* Promo code row */
.wu-promo { display: flex; gap: var(--wu-space-2); margin-top: var(--wu-space-4); }
.wu-promo .wu-input { flex: 1 1 auto; }

/* --- Payment methods ----------------------------------------------------- */
.wu-payment-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--wu-space-3);
  margin-bottom: var(--wu-space-5);
}
.wu-payment-method {
  display: flex;
  align-items: center;
  gap: var(--wu-space-2);
  padding: var(--wu-space-3);
  border: 2px solid var(--wu-border);
  border-radius: var(--wu-radius);
  font-size: var(--wu-fs-sm);
  font-weight: var(--wu-fw-medium);
  cursor: pointer;
}
.wu-payment-method.is-selected { border-color: var(--wu-primary); color: var(--wu-primary); }

/* Card form only appears for the card method */
.wu-payment-details { display: none; }
.wu-payment-details.is-active { display: block; animation: wu-fade-in var(--wu-duration-sm) var(--wu-ease-out); }

/* Security note next to the payment form */
.wu-secure-note {
  display: flex;
  align-items: center;
  gap: var(--wu-space-2);
  padding: var(--wu-space-3);
  border-radius: var(--wu-radius);
  background: var(--wu-success-bg);
  /* "Your payment is encrypted" on the payment step - the one reassurance on
     the page that has to be readable. 12px of the raw green on its own tint
     measured 2.82:1. */
  color: color-mix(in srgb, var(--wu-success) 72%, black);
  font-size: var(--wu-fs-xs);
}

/* --- Confirmation -------------------------------------------------------- */
.wu-confirmation { text-align: center; padding-block: var(--wu-space-7); }
.wu-confirmation-icon {
  width: 84px;
  height: 84px;
  margin: 0 auto var(--wu-space-5);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  background: var(--wu-success-bg);
  color: var(--wu-success);
}
.wu-confirmation-icon svg { width: 40px; height: 40px; }

.wu-booking-ref {
  display: inline-block;
  padding: var(--wu-space-3) var(--wu-space-5);
  border: 1px dashed var(--wu-border-strong);
  border-radius: var(--wu-radius);
  font-family: var(--wu-font-mono);
  font-size: var(--wu-fs-lg);
  font-weight: var(--wu-fw-bold);
  letter-spacing: .12em;
  color: var(--wu-heading);
}

/* --- Seat map (flights) --------------------------------------------------- */
.wu-seatmap {
  display: inline-flex;
  flex-direction: column;
  gap: var(--wu-space-2);
  padding: var(--wu-space-5);
  border: 1px solid var(--wu-border);
  border-radius: var(--wu-radius-lg);
  background: var(--wu-surface-alt);
  /* inline-flex sizes to its content, and a 3-3 cabin is 400px wide however
     narrow the phone is. Without this the whole PAGE scrolled sideways on a
     320px screen instead of the seat rows scrolling inside their own box. */
  max-width: 100%;
}
.wu-seat-row { display: flex; align-items: center; gap: var(--wu-space-2); }
.wu-seat-aisle { width: 22px; text-align: center; font-size: var(--wu-fs-xs); color: var(--wu-text-muted); }

.wu-seat {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--wu-border-strong);
  /* Token-driven so the seat keeps its rounded-bottom shape if a buyer
     restores the radius tokens; flat in the default booking scope. */
  border-radius: var(--wu-radius-sm) var(--wu-radius-sm) var(--wu-radius) var(--wu-radius);
  background: var(--wu-surface);
  font-size: 11px;
  color: var(--wu-text-muted);
  cursor: pointer;
  /* A cabin is ~180 of these. `all` asked the compositor to watch every
     animatable property on every one of them; three is all that ever moves. */
  transition: border-color var(--wu-duration-sm) var(--wu-ease),
              background-color var(--wu-duration-sm) var(--wu-ease),
              color var(--wu-duration-sm) var(--wu-ease);
}
.wu-seat:hover:not(.is-taken) { border-color: var(--wu-service); color: var(--wu-service); }
.wu-seat.is-selected { background: var(--wu-service-text); border-color: var(--wu-service); color: #fff; }
/* A taken seat has to be unmistakable at a glance — a slightly darker fill
   alone reads as "available but dimmed" when the whole map is pale. */
.wu-seat.is-taken {
  background: var(--wu-surface-sunken);
  border-color: var(--wu-surface-sunken);
  color: transparent;
  cursor: not-allowed;
  position: relative;
}
.wu-seat.is-taken::after {
  content: "";
  position: absolute;
  inset: 25%;
  border-radius: 2px;
  background: var(--wu-border-strong);
}
.wu-seat.is-premium { border-color: var(--wu-secondary); }

/* Exit rows get extra legroom in the cabin and extra space here, so the map
   reads the way the aircraft actually is. */
.wu-seat-row.is-exit-row { margin-bottom: var(--wu-space-3); }
.wu-seat-row.is-exit-row::after {
  content: "EXIT";
  margin-inline-start: var(--wu-space-2);
  font-size: 9px;
  font-weight: var(--wu-fw-bold);
  letter-spacing: .08em;
  color: var(--wu-success);
}

.wu-seat:disabled { pointer-events: none; }
.wu-seat[aria-pressed="true"] { background: var(--wu-service-text); border-color: var(--wu-service); color: #fff; }

/* The cabin scrolls inside its own frame — a 32-row map would otherwise push
   the summary and the Continue button off the page. */
.wu-seatmap-scroll {
  max-height: min(60vh, 520px);
  overflow-y: auto;
  /* The cabin is a fixed width; on a phone it scrolls HERE rather than taking
     the page with it. A seat row must never wrap - 3-3 that reflows to 4-2 is
     not the aircraft the passenger is booking. */
  overflow-x: auto;
  padding-inline-end: var(--wu-space-2);
}

.wu-seatmap-scroll .wu-seat-row { flex-wrap: nowrap; }

.wu-seat-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wu-space-4);
  margin-top: var(--wu-space-4);
  font-size: var(--wu-fs-xs);
  color: var(--wu-text-muted);
}
.wu-seat-legend span { display: inline-flex; align-items: center; gap: var(--wu-space-2); }
.wu-seat-legend i {
  width: 14px;
  height: 14px;
  border-radius: var(--wu-radius-sm);
  border: 1px solid var(--wu-border-strong);
  display: inline-block;
}

/* --- Receipt / e-ticket --------------------------------------------------- */
.wu-receipt {
  max-width: 760px;
  margin-inline: auto;
  background: var(--wu-surface);
  border: 1px solid var(--wu-border);
  border-radius: var(--wu-radius-lg);
  overflow: hidden;
}
.wu-receipt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wu-space-4);
  padding: var(--wu-space-5);
  background: var(--wu-primary);
  color: var(--wu-on-primary);
}
.wu-receipt-head h2 { color: inherit; margin: 0; }
.wu-receipt-body { padding: var(--wu-space-5); }

/* Perforation between ticket halves */
.wu-receipt-tear {
  height: 1px;
  margin-block: var(--wu-space-5);
  background: repeating-linear-gradient(90deg, var(--wu-border-strong) 0 8px, transparent 8px 16px);
}

@media print {
  .wu-header, .wu-footer, .wu-to-top, .wu-no-print { display: none !important; }
  .wu-receipt { border: 0; box-shadow: none; max-width: none; }
  body { background: #fff; }
}

/* --------------------------------------------------------------------------
   Seat legend keys

   Four swatches that have to match the seats exactly. They were four pairs of
   inline background/border-color declarations, which meant the legend could
   drift away from the thing it explains - change .wu-seat.is-taken and the
   legend kept the old colour. Same tokens, one place.
   -------------------------------------------------------------------------- */
/* Scoped to the legend, because `.wu-seat-legend i` already sets a border and
   a bare `.wu-seat-key-*` would lose to it - the inline styles these replaced
   outranked everything, so the swatches silently went grey without this. */
.wu-seat-legend i.wu-seat-key-free     { background: var(--wu-surface); border-color: var(--wu-border-strong); }
.wu-seat-legend i.wu-seat-key-legroom  { background: var(--wu-surface); border-color: var(--wu-secondary); }
.wu-seat-legend i.wu-seat-key-selected { background: var(--wu-service); border-color: var(--wu-service); }
.wu-seat-legend i.wu-seat-key-taken    { background: var(--wu-border-strong); border-color: var(--wu-surface-sunken); }


/* ==========================================================================
   Flight checkout: passengers, meals, vouchers

   js/pages/flight-booking.js renders all three - the passenger blocks because
   the party is not known until the page opens, the menu and the voucher panel
   because both belong to the service rather than to one flight.
   ========================================================================== */

/* --- One block per traveller --------------------------------------------- */
.wu-pax-list { display: grid; gap: var(--wu-space-4); }

.wu-pax {
  margin: 0;
  padding: var(--wu-space-4) var(--wu-space-5) var(--wu-space-5);
  border: 1px solid var(--wu-border);
  border-radius: var(--wu-radius);
  background: var(--wu-surface);
}
/* "Adult 1", "Child 2" - the heading of one traveller's card, so it is sized
   like one. A bare <legend> renders at the body size, which left it reading as
   just another label among the fields it introduces. */
.wu-pax legend {
  display: flex;
  font-size: var(--wu-fs-xl);
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--wu-space-2);
  padding-inline: var(--wu-space-2);
  margin-inline-start: calc(var(--wu-space-2) * -1);
  font-weight: var(--wu-fw-semibold);
  color: var(--wu-heading);
}
.wu-pax-note { font-size: var(--wu-fs-xs); font-weight: var(--wu-fw-normal); color: var(--wu-text-muted); }

/* The infant has no seat and the child cannot lead the booking, so the two
   read as dependants rather than as another adult. */
.wu-pax[data-pax="child"],
.wu-pax[data-pax="infant"] { background: var(--wu-surface-alt); }

/* --- The meal menu -------------------------------------------------------- */
.wu-meals { display: grid; gap: var(--wu-space-3); }

.wu-meal {
  border: 1px solid var(--wu-border);
  border-radius: var(--wu-radius);
  background: var(--wu-surface);
  transition: border-color var(--wu-duration-sm) var(--wu-ease),
              background-color var(--wu-duration-sm) var(--wu-ease);
}
.wu-meal:hover { border-color: var(--wu-border-strong); }
.wu-meal.is-selected {
  border-color: var(--wu-service);
  background: color-mix(in srgb, var(--wu-service) 4%, var(--wu-surface));
}

.wu-meal-pick {
  display: flex;
  align-items: center;
  gap: var(--wu-space-3);
  padding: var(--wu-space-3) var(--wu-space-4);
  cursor: pointer;
}
/* The same box as the terms line and the add-ons. */
.wu-meal-pick input {
  accent-color: var(--wu-service);
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  cursor: pointer;
}
.wu-meal-pick img {
  width: 80px;
  height: 60px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: var(--wu-radius-sm);
  background: var(--wu-surface-sunken);
}
.wu-meal-body { flex: 1 1 auto; min-width: 0; }
.wu-meal-price { flex: 0 0 auto; font-weight: var(--wu-fw-semibold); font-size: var(--wu-fs-sm); }

.wu-meal:has(input:focus-visible) { outline: 2px solid var(--wu-primary); outline-offset: 2px; }

/* How many of this tray. Kept out of the label so its buttons are not a
   second control inside one: a nested button is not valid there, and clicking
   it would toggle the tray it is counting. */
.wu-meal-qty {
  padding: 0 var(--wu-space-4) var(--wu-space-2);
  border-top: 1px dashed var(--wu-border);
  margin-top: var(--wu-space-1);
}
.wu-meal-qty strong { font-size: var(--wu-fs-sm); }

/* --- Voucher -------------------------------------------------------------- */
.wu-voucher-fields {
  display: grid;
  gap: var(--wu-space-3);
  align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
/* Matches the search submit's 48px: both are the single committing action in
   their block, and sharing one height keeps that role consistent. */
.wu-voucher-action .wu-btn { height: 48px; }

.wu-voucher-card {
  display: grid;
  gap: var(--wu-space-3);
  padding: var(--wu-space-4);
  border: 1px solid var(--wu-success);
  border-radius: var(--wu-radius);
  background: color-mix(in srgb, var(--wu-success) 6%, var(--wu-surface));
}
.wu-voucher-serial {
  display: block;
  font-family: var(--wu-font-mono, ui-monospace, monospace);
  font-size: var(--wu-fs-xs);
  letter-spacing: .08em;
  color: var(--wu-text-muted);
}
.wu-voucher-facts {
  display: grid;
  gap: var(--wu-space-2);
  margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  font-size: var(--wu-fs-xs);
}
.wu-voucher-facts dt { color: var(--wu-text-muted); }
.wu-voucher-facts dd { margin: 0; color: var(--wu-heading); font-weight: var(--wu-fw-medium); }

.wu-voucher-amount {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--wu-space-3);
  padding-top: var(--wu-space-3);
  border-top: 1px solid color-mix(in srgb, var(--wu-success) 35%, transparent);
  font-size: var(--wu-fs-sm);
}
.wu-voucher-amount strong { font-size: var(--wu-fs-lg); color: color-mix(in srgb, var(--wu-success) 78%, black); }

.wu-voucher-card .wu-btn { justify-self: start; }

/* A credit is the one line in the summary that gives money back. */
.wu-row-credit span:last-child { color: color-mix(in srgb, var(--wu-success) 78%, black); }

@media (max-width: 575.98px) {
  .wu-meal-pick { flex-wrap: wrap; }
  .wu-meal-pick img { width: 64px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .wu-meal { transition: none; }
}
