/*
 * Booking flow — additions to the Jordan Aviation design system.
 *
 * Only what the design pack does not already cover: pieces the static mockups
 * faked (the order summary, the review cards) and the held-space timer, which
 * does not exist in a static page at all. Everything else reuses the pack's own
 * classes. Loaded after style-{lang}.css, and written to inherit its tokens.
 */

/* ---- price pills: real fares are longer than the mockup's placeholders ---- */
.date-pill {
  flex: 0 0 auto;
  width: auto;
  min-width: 6.5rem;
}
.date-pill__val {
  white-space: nowrap;
  /* Figma 18px @1920. This file is loaded after style-{lang}.css, so the size has to be set
     here or the base rule never applies. */
  font-size: clamp(0.9375rem, 0.892rem + 0.194vw, 1.125rem);
}

/* ---- held-space countdown ---- */
.hold-timer {
  border-radius: var(--r-md, 0.75rem);
  font-size: 0.9375rem;
}
.hold-timer .ic {
  width: 1.125rem;
  height: 1.125rem;
  flex: 0 0 auto;
}
.hold-timer b {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ---- order summary ---- */
.bk-summary {
  position: sticky;
  top: 1.5rem;
}
.sum-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.375rem;
  font-size: var(--fs-body-sm, 0.875rem);   /* the design's 14, not 15 */
}
.sum-row__k {
  color: var(--ja-grey-600, #4a5565);
}
.sum-row__v {
  text-align: end;
  font-variant-numeric: tabular-nums;
}
.sum-row--total {
  font-size: 1.0625rem;
  padding-block: 0.625rem;
}
.sum-row--total .sum-row__k {
  color: inherit;
  font-weight: 600;
}

/* ---- review screen ---- */
.bk-card__edit {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ja-gold-700, #9a7c47);
  text-decoration: none;
}
.bk-card__edit:hover {
  text-decoration: underline;
}
.bk-card__edit .ic {
  width: 0.9375rem;
  height: 0.9375rem;
}

.rev-flight + .rev-flight {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ja-line-soft, #eceff3);
}
.rev-flight__label {
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ja-muted, #6b7280);
  margin-bottom: 0.25rem;
}
.rev-flight__route {
  font-size: 1.0625rem;
  margin-bottom: 0.125rem;
}
.rev-flight__meta {
  font-size: 0.8125rem;
  margin-bottom: 0;
}

.rev-pax {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding-block: 0.5rem;
}
.rev-pax__num {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--ja-gold, #b79a69);
  color: #fff;
}

/* ---- seat map: keep the released-seat highlight distinct from selected ---- */
.seat.is-mine {
  outline: 2px solid var(--ja-navy, #0c1a35);
  outline-offset: 1px;
}

/* ---- add-ons ----
   The add-on card, its flag chip, the Add button and the quantity stepper all
   live in the main stylesheet now (section 22.10), matched to Figma 79:15176.
   Nothing is overridden here — the card and its control are one piece. */

/* ---- confirmation ----
   This layer used to restyle .bpass__head into a centred stack and carried six more rules
   (.bpass__tick/__grid/__cell/__k/__v/__leg) for a version of the markup Confirmation.cshtml
   has never had. The centring was actively wrong: the design's head is a two-column navy band
   with the record locator at one end and the status chip at the other, which is what section
   22.13 of the main stylesheet now draws. Only the passenger table's padding was real. */
.bpass__pax {
  padding: 1.5rem;
}

/* ---- forms inside booking cards ---- */
.bk-card .form-label {
  font-size: 0.75rem;                   /* the design's 12 / w600 */
  font-weight: 600;
  color: var(--ja-grey-500, #6a7282);
  margin-bottom: 0.375rem;
}

@media (max-width: 640px) {
  .bpass__leg { flex-wrap: wrap; }
  .addon__qty .form-control { width: 4.5rem; }
}

/* ---- helper text and the optional passenger panel ---- */
/* The pack has the opt-toggle button but no panel behind it, because its mockup never opens
   one. These two are ours, kept in this layer so the pack stylesheet stays untouched. */
.bk-note {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--ja-muted, #6b7280);
  margin: 0 0 0.75rem;
}
.opt-panel {
  margin-top: 0.875rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--ja-line-soft, #eceff3);
  border-radius: 0.75rem;
  background: var(--ja-tint, #f7f8fa);
}
.opt-panel .bk-note:last-child { margin-bottom: 0; }

/* ---- passenger tab strip ---- */
/* The tick and the numbered chip are both in the markup and CSS picks one: which passenger is
   done changes as seats are picked, and toggling a class beats rebuilding the tab in script. */
.pax-tab .pax-tab__done { display: none; }
.pax-tab--done .pax-tab__done { display: inline-block; }
.pax-tab--done .pax-tab__num { display: none; }
.pax-tab .pax-acc__num {
  width: 1.125rem;
  height: 1.125rem;
  font-size: 0.625rem;
  flex: 0 0 auto;
}

/* The terms checkbox turns red when it is what is holding the payment up. */
.check-ja.is-invalid .check-ja__box { border-color: var(--ja-red, #c0392b); }
.check-ja.is-invalid { color: var(--ja-red, #c0392b); }

/* A reservation VRS has not returned HK for is not "Confirmed" — say Pending, and do not
   colour it like a success. */
.chip-status--pending {
  background: var(--ja-amber-tint, #fdf3e0);
  color: var(--ja-amber-700, #8a5a00);
}

/* ---- a document the airline has not supplied ---- */
/* The old site linked 14 PDFs that are not in the backup. Keeping the label and the PDF icon
   without a link made them look clickable, so they are marked plainly instead: dimmed, struck
   through, and not offering a pointer. Restoring the file turns them back into real links on
   the next content regeneration. */
.doc-unavailable {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--ja-muted, #6b7280);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  cursor: not-allowed;
  opacity: 0.75;
}
.doc-unavailable img { filter: grayscale(1); opacity: 0.6; }
.doc-unavailable::after {
  content: " (" attr(title) ")";
  text-decoration: none;
  font-size: 0.75em;
  opacity: 0.9;
}

/* The simulator's own card form. Shaped like a card so the funnel can be demonstrated while
   the real gateway is unavailable - and visibly ours, not the processor's, which is the point of
   the notice above it. */
.sim-card {
  border: 1px solid var(--ja-line-cool-2, #dfe4ec);
  border-radius: 10px;
  padding: var(--sp-4, 1rem);
  margin-bottom: var(--sp-4, 1rem);
  background: var(--ja-cream, #fdfbf7);
}
.sim-card .form-field { margin-bottom: 0.75rem; }
.sim-card .form-field:last-child { margin-bottom: 0; }

/* ---- HyperPay COPYandPAY widget ----
   Deliberately NOT themed.

   These rules used to restyle HyperPay's widget into the airline's design - gold pay button, our
   labels, our field borders. The airline asked for the opposite: the card form should look like
   HyperPay's, because a passenger typing a card number should recognise the processor's own form
   rather than a lookalike drawn by the airline's site.

   So the widget now renders with HyperPay's stock appearance and nothing here overrides it. The
   only thing kept is direction: the widget is laid out left-to-right by HyperPay, and the Arabic
   page must not mirror the card, expiry and CVV fields, which are Latin data everywhere.

   If a future design brief asks for the form to match the site again, restyle .wpwl-form,
   .wpwl-label, .wpwl-control and .wpwl-button-pay - but check with the airline first. */
.wpwl-form { direction: ltr; text-align: left; }

/* Card now, or reserve and pay cash at an office — the passenger's choice on Review. */
.pay-choice { display: grid; gap: 0.75rem; margin: 0; padding: 0; border: 0; }
.pay-choice__opt {
  display: grid; grid-template-columns: auto 1fr; gap: 0.85rem; align-items: start;
  padding: 1rem 1.15rem; cursor: pointer;
  background: var(--ja-white); border: 1.5px solid var(--ja-line); border-radius: var(--r-lg);
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.pay-choice__opt:hover { border-color: var(--ja-gold-200); }
.pay-choice__opt:has(input:checked) { border-color: var(--ja-gold); box-shadow: 0 0 0 3px var(--ja-gold-100); }
.pay-choice__opt input { margin-top: 0.3rem; accent-color: var(--ja-gold-700); width: 1.1rem; height: 1.1rem; }
.pay-choice__body { display: grid; gap: 0.25rem; }
.pay-choice__title { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font-head); font-weight: 600; color: var(--ja-navy); }
.pay-choice__title .ic { width: 1.15rem; height: 1.15rem; color: var(--ja-gold-700); }
.pay-choice__text { font-size: 0.875rem; line-height: 1.55; color: var(--ja-text); }

/* Passport-validity pop-up (passengers step, 2026-10-08): any expiry date can be
   picked; one short of six months after the flight is acknowledged with OK. */
.pp-dialog {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(13, 27, 42, 0.55);
}
.pp-dialog.is-open { display: flex; }
.pp-dialog__box {
  width: 100%;
  max-width: 26rem;
  background: #fff;
  border-radius: 14px;
  border-top: 4px solid var(--ja-gold, #d3a35e);
  box-shadow: 0 18px 40px rgba(13, 27, 42, 0.25);
  padding: 1.25rem 1.25rem 1rem;
  text-align: start;
}
.pp-dialog__title { font-weight: 700; font-size: 1.05rem; color: var(--ja-navy, #0d1b2a); margin: 0 0 0.5rem; }
.pp-dialog__text { font-size: 0.9375rem; line-height: 1.6; color: var(--ja-text, #2b3a48); margin: 0 0 1rem; }
.pp-dialog__ok { width: 100%; }

/* Booking fee under "Total paid" on the confirmation (2026-10-08). */
.bpass__paid dt.bpass__fee, .bpass__paid dd.bpass__fee { font-size: 0.8125rem; font-weight: 500; opacity: 0.75; }
.bpass__paid:has(.bpass__fee) { display: grid; grid-template-columns: 1fr auto; row-gap: 0.25rem; align-items: baseline; }
.bpass__paid:has(.bpass__fee) dd { text-align: end; }
.bpass__paid dd.bpass__fee { color: var(--ja-grey-600); }

/* Terms and conditions on the Review step (client note 2026-10-14) */
.terms-accept .check-ja { align-items: flex-start; }
.terms-accept__link {
  padding: 0; border: 0; background: none; font: inherit; font-weight: 700;
  color: var(--ja-gold-700, #A9762F); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer;
}
.terms-accept__link:hover { color: var(--ja-navy, #0C1A35); }
.terms-accept__error { margin: 0.4rem 0 0; color: var(--ja-red, #DC1737); font-size: 0.875rem; font-weight: 600; }
.terms-accept .check-ja.is-invalid .check-ja__box { border-color: var(--ja-red, #DC1737); box-shadow: 0 0 0 3px rgba(220, 23, 55, 0.15); }
.terms-dialog {
  width: min(48rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
  padding: 0; border: 0; border-radius: 1rem; box-shadow: 0 28px 70px rgba(12, 26, 53, 0.25);
  display: none; flex-direction: column;
}
.terms-dialog[open] { display: flex; }
.terms-dialog::backdrop { background: rgba(12, 26, 53, 0.6); }
.terms-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid #E9E3D9; }
.terms-dialog__title { margin: 0; font-size: 1.2rem; color: var(--ja-navy, #0C1A35); }
.terms-dialog__close { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border: 1px solid #E9E3D9; border-radius: 50%; background: #fff; cursor: pointer; }
.terms-dialog__close .ic { width: 1rem; height: 1rem; }
.terms-dialog__body { flex: 1 1 auto; overflow-y: auto; padding: 1rem 1.25rem; font-size: 0.9rem; line-height: 1.7; color: #4A5361; }
.terms-dialog__body p { margin: 0 0 0.75rem; }
.terms-dialog__foot { display: flex; justify-content: flex-end; padding: 0.9rem 1.25rem; border-top: 1px solid #E9E3D9; background: #FDFAF5; border-radius: 0 0 1rem 1rem; }

/* ---- Fare comparison on the flight list (client notes 2026-11-19) ----
   Trip.com style: every fare card of a flight has the same rows in the same order, and the rows
   line up across the cards (CSS subgrid) so "Refund" reads straight across. On a phone or tablet
   the cards sit in one swipeable row instead of a stack, so they can still be compared side by
   side; the rows stay aligned there too. Browsers without subgrid get the plain cards. */
.fare-grid.fare-grid--compare { row-gap: 0; column-gap: var(--sp-4); }
@media (min-width: 1025px) {
  .fare-grid.fare-grid--compare,
  .fare-grid.fare-grid--compare:has(> .fare-opt:nth-child(2):last-child),
  .fare-grid.fare-grid--compare:has(> .fare-opt:only-child) {
    grid-template-columns: repeat(var(--fare-cols, 3), minmax(0, 1fr));
  }
}
@supports (grid-template-rows: subgrid) {
  .fare-grid--compare > .fare-opt {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span var(--fare-span);
    row-gap: 0;
  }
  .fare-grid--compare .fare-feats {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span var(--fare-feats);
  }
}
.fare-grid--compare .fare-opt__head { margin-bottom: 0; }

.fare-feats { list-style: none; margin: 0; padding: var(--sp-2) 0 0; }
.fare-feat {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding-block: 0.5rem;
  border-bottom: 1px dashed var(--ja-line-soft, #EEE8DF);
  font-size: var(--fs-body-sm, 0.875rem);
}
.fare-feat:last-child { border-bottom: 0; }
.fare-feat__ic {
  flex: 0 0 auto;
  width: 1.5rem; height: 1.5rem;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #EEF1F5;
  color: var(--ja-navy, #0C1A35);
}
.fare-feat__ic .ic { width: 0.8125rem; height: 0.8125rem; }
.fare-feat--yes .fare-feat__ic { background: #E3F3EC; color: var(--ja-green, #1C906B); }
.fare-feat--no .fare-feat__ic { background: #FCE8EB; color: var(--ja-red, #DC1737); }
.fare-feat--fee .fare-feat__ic { background: #FBF0E0; color: var(--ja-gold-700, #A9762F); }
.fare-feat--unknown .fare-feat__ic { background: #F4F5F7; color: var(--ja-muted, #8A929E); }
.fare-feat__body { display: grid; gap: 0.125rem; min-width: 0; }
.fare-feat__label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ja-muted, #8A929E);
}
[dir="rtl"] .fare-feat__label { letter-spacing: 0; text-transform: none; font-size: 0.75rem; }
.fare-feat__val { color: var(--ja-text, #4A5361); line-height: 1.45; overflow-wrap: anywhere; }
.fare-feat--yes .fare-feat__val,
.fare-feat--no .fare-feat__val,
.fare-feat--fee .fare-feat__val { font-weight: 600; color: var(--ja-navy, #0C1A35); }
.fare-feat--unknown .fare-feat__val { color: var(--ja-muted, #8A929E); font-style: italic; }
.fare-feat__more { font-size: 0.75rem; font-weight: 700; color: var(--ja-green, #1C906B); }

.fare-addons { padding-block: var(--sp-3, 0.75rem); border-top: 1px solid var(--ja-line-soft, #EEE8DF); }
.fare-addons__title {
  margin: 0 0 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ja-gold-700, #A9762F);
}
[dir="rtl"] .fare-addons__title { letter-spacing: 0; text-transform: none; font-size: 0.75rem; }
.fare-addons__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.fare-addons__list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.4rem; font-size: 0.8125rem; color: var(--ja-text, #4A5361); }
.fare-addons__list .ic { width: 0.875rem; height: 0.875rem; flex: 0 0 auto; color: var(--ja-gold-700, #A9762F); }
.fare-addons__price { margin-inline-start: auto; font-size: 0.75rem; color: var(--ja-muted, #8A929E); white-space: nowrap; }

.fare-opt__notes { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.fare-opt__notes .fare-list { margin-bottom: 0; }
.fare-opt__notes .fare-opt__per { margin-bottom: 0; }
.fare-grid--compare .fare-opt__cta { align-self: end; padding-top: var(--sp-3, 0.75rem); }
.fare-terms-noscript { display: flex; align-items: flex-start; gap: 0.4rem; margin-bottom: 0.5rem; font-size: 0.75rem; color: var(--ja-navy, #0C1A35); }

.fare-swipe-hint { display: none; }
@media (max-width: 1024px) {
  .fare-grid.fare-grid--compare {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(16rem, 46%);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--sp-5, 1.25rem);
    padding-top: 0.875rem;     /* room for the "Lowest fare" tag that sits on the card's edge */
    scrollbar-width: thin;
  }
  .fare-grid--compare > .fare-opt { scroll-snap-align: start; }
}
@media (max-width: 639px) {
  .fare-grid.fare-grid--compare { grid-auto-columns: minmax(15rem, 80%); column-gap: var(--sp-3, 0.75rem); }
  .fare-swipe-hint {
    display: block;
    margin: 0 0 var(--sp-4, 1rem);
    text-align: center;
    font-size: 0.75rem;
    color: var(--ja-muted, #8A929E);
  }
}

/* The fare's terms, agreed to before the booking goes on (client notes 2026-11-19). Built on the
   Review step's terms window. */
.fare-terms-dialog__heading { min-width: 0; }
.fare-terms-dialog__kicker {
  margin: 0 0 0.15rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ja-gold-700, #A9762F);
}
[dir="rtl"] .fare-terms-dialog__kicker { letter-spacing: 0; text-transform: none; font-size: 0.8125rem; }
.fare-terms-dialog__price { margin-inline-start: 0.35rem; font-size: 0.9375rem; font-weight: 600; color: var(--ja-muted, #8A929E); }
.fare-terms-dialog__route { margin: 0.2rem 0 0; font-size: 0.8125rem; color: var(--ja-muted, #8A929E); }
.fare-terms__sec { margin-bottom: 1.1rem; }
.fare-terms__h { margin: 0 0 0.4rem; font-size: 0.9375rem; font-weight: 700; color: var(--ja-navy, #0C1A35); }
.fare-terms__list { margin: 0 0 0.5rem; padding-inline-start: 1.15rem; display: grid; gap: 0.3rem; }
.fare-terms__status { font-style: italic; color: var(--ja-muted, #8A929E); }
.fare-terms__dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.3rem 1rem; margin: 0; }
.fare-terms__dl dt { font-weight: 700; color: var(--ja-navy, #0C1A35); }
.fare-terms__dl dd { margin: 0; }
.fare-terms__more { margin: 0; padding-top: 0.75rem; border-top: 1px solid #E9E3D9; font-size: 0.8125rem; }
.fare-terms-dialog__foot { flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; }
.fare-terms-dialog__foot .check-ja { flex: 1 1 18rem; align-items: flex-start; font-weight: 600; color: var(--ja-navy, #0C1A35); }
.fare-terms-dialog__actions { display: flex; gap: 0.5rem; margin-inline-start: auto; }
.fare-terms-dialog [data-fare-terms-continue]:disabled { opacity: 0.45; cursor: not-allowed; }
@media (max-width: 639px) {
  /* A long panel on a phone: the whole screen, the agreement always in reach at the foot. */
  .fare-terms-dialog {
    width: 100%; max-width: 100%;
    height: 100%; max-height: 100%;
    margin: 0; border-radius: 0;
  }
  .fare-terms-dialog .terms-dialog__foot { border-radius: 0; }
  .fare-terms-dialog__actions { width: 100%; }
  .fare-terms-dialog__actions .btn-ja { flex: 1 1 0; }
}
