/* =====================================================================
   Leisure form controls — `.lf-*`
   =====================================================================

   Everything here is scoped under `.lf-form` for one specific reason:
   `leisure-new-style.css` sets `input.form-control, select.form-select
   { height: 40px; border: 0 }` globally, which is why callers all over the
   app have to re-add `border` by hand. Rather than fight that cascade, these
   controls do not use `.form-control` at all — `.lf-form .lf-control` (0,2,0)
   also outranks that global rule (0,1,1), so the two systems can coexist on
   the same page without either one winning by accident.

   Colours are restated here as `--lf-*` so a component never reaches for a raw
   hex and both themes stay in step.

   Deliberately NOT using `light-dark()`, even though leisure-new-style.css
   does. Next builds this file through Lightning CSS, which lowers
   `light-dark(a, b)` to `var(--lightningcss-light, a) var(--lightningcss-dark, b)`
   — a pair that only resolves when those helper variables are in scope.
   Where they are not, the custom property becomes invalid at computed-value
   time and every declaration substituting it is dropped, so the controls lose
   their borders and surfaces entirely. Dark mode is handled instead by the
   `html[data-bs-theme="dark"]` override below, which is the mechanism the rest
   of the app's stylesheets already use.
   ===================================================================== */

.lf-form {
  /* Geometry */
  --lf-h: 44px;
  --lf-radius: 10px;

  /* Surfaces & lines */
  --lf-border: #dbe3e7;
  --lf-border-hover: #b3c3cb;
  --lf-surface: #ffffff;
  --lf-surface-subtle: #f6f9fa;
  --lf-surface-sunken: #eef3f5;

  /* Ink */
  --lf-ink: #243238;
  --lf-muted: #69787e;

  /* Accent — the teal from --color-first */
  --lf-accent: #2f6271;
  --lf-accent-soft: rgba(47, 98, 113, 0.13);
  --lf-accent-ring: rgba(47, 98, 113, 0.18);

  /* Semantic — separate from the accent, per the usual rule */
  --lf-danger: #c33643;
  --lf-danger-ink: #a8323d;
  --lf-danger-border: #e79aa2;
  --lf-danger-surface: #fff6f7;
  --lf-danger-ring: rgba(195, 54, 67, 0.16);
  --lf-danger-strong: #9c2733;
  --lf-ok: #1c7a5c;

  /* Elevation */
  --lf-popup-shadow: 0 12px 28px rgba(20, 40, 48, 0.16);

  color: var(--lf-ink);
}

html[data-bs-theme="dark"] .lf-form {
  --lf-border: #3c4c52;
  --lf-border-hover: #566a71;
  --lf-surface: #2c2c2c;
  --lf-surface-subtle: #333333;
  --lf-surface-sunken: #3a3a3a;

  --lf-ink: #ededed;
  --lf-muted: #a7b4b9;

  --lf-accent: #7fd6ee;
  --lf-accent-soft: rgba(127, 214, 238, 0.2);
  --lf-accent-ring: rgba(127, 214, 238, 0.26);

  --lf-danger: #ff9aa3;
  --lf-danger-ink: #ffb3ba;
  --lf-danger-border: #a85a63;
  --lf-danger-surface: #3b2a2c;
  --lf-danger-ring: rgba(255, 154, 163, 0.22);
  --lf-danger-strong: #ffc2c8;
  --lf-ok: #5fd0a6;

  --lf-popup-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

/* ---------------------------------------------------------------- field */

.lf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* A label names the field; a hint qualifies it. They were both muted and one
   pixel apart, which left a long form reading as one flat wall of grey — the
   eye had nothing to jump between. The label now carries ink and a size, the
   hint keeps the muted 12px, and the gap between them does the work. */
.lf-label {
  font-family: var(--font-family-inter);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--lf-ink);
  margin: 0;
}

/* The asterisk is decorative — the accessible name carries `aria-required`,
   so hide the glyph from assistive tech rather than reading "star" aloud. */
.lf-required {
  color: var(--lf-danger);
  margin-inline-start: 2px;
  font-weight: 600;
}

/* `.webNewContent p` (the page container these forms live in) sets
   `font-size: 1.15rem` and `line-height: 1.5 !important` on every paragraph.
   Both of these are paragraphs, so they have to out-specify it — hence the
   `.lf-form` prefix and the `!important` on line-height only, which is the one
   declaration that is itself important upstream. */
.lf-form .lf-hint {
  font-size: 0.75rem;
  line-height: 1.4 !important;
  color: var(--lf-muted);
  font-family: var(--font-family-inter);
  margin: 0;
}

/* The message sits in a `<span>` so the icon can stay out of the text flow.
   `.webNewContent p span` in leisure-new-style.css targets that span directly
   at 1.15rem, which beats anything inherited from the paragraph — so the span
   has to be sized explicitly, not just the `<p>`. Without this the error reads
   half again as large as the hint immediately above it. */
.lf-form .lf-error,
.lf-form .lf-error span {
  font-size: 0.75rem;
  line-height: 1.4 !important;
  font-weight: 500;
  font-family: var(--font-family-inter);
  color: var(--lf-danger-ink);
}

.lf-form .lf-error {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin: 0;
}

.lf-error svg {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-top: 2px;
  color: var(--lf-danger);
}

/* -------------------------------------------------------------- control */

.lf-form .lf-control {
  display: block;
  width: 100%;
  min-width: 0;
  height: var(--lf-h);
  padding: 0 12px;
  font-family: var(--font-family-content);
  font-size: 0.9375rem;
  line-height: 1.2;
  color: var(--lf-ink);
  background-color: var(--lf-surface);
  border: 1px solid var(--lf-border);
  border-radius: var(--lf-radius);
  appearance: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

.lf-form textarea.lf-control {
  height: auto;
  min-height: 88px;
  padding: 10px 12px;
  line-height: 1.45;
  resize: vertical;
}

.lf-form .lf-control::placeholder {
  color: var(--lf-muted);
  opacity: 0.75;
}

.lf-form .lf-control:hover:not(:disabled):not(:focus) {
  border-color: var(--lf-border-hover);
}

.lf-form .lf-control:focus,
.lf-form .lf-control:focus-visible {
  outline: none;
  border-color: var(--lf-accent);
  box-shadow: 0 0 0 3px var(--lf-accent-soft);
}

.lf-form .lf-control:disabled {
  background-color: var(--lf-surface-sunken);
  color: var(--lf-muted);
  cursor: not-allowed;
}

.lf-form .lf-control--invalid,
.lf-form .lf-control--invalid:hover {
  border-color: var(--lf-danger-border);
  background-color: var(--lf-danger-surface);
}

.lf-form .lf-control--invalid:focus {
  border-color: var(--lf-danger);
  box-shadow: 0 0 0 3px var(--lf-danger-ring);
}

/* Uppercase entry for document numbers, without shouting in the placeholder. */
.lf-form .lf-control--upper {
  text-transform: uppercase;
}

.lf-form .lf-control--upper::placeholder {
  text-transform: none;
}

/* select needs its own chevron once `appearance: none` removes the native one */
.lf-form select.lf-control {
  padding-inline-end: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%2369787e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

/* Positive validation — Baymard: a confirmation tick on high-cost fields
   measurably helps. Applied only where a field is expensive to re-check
   (passport number, date of birth), never blanket across the form. */
.lf-control-wrap {
  position: relative;
  display: block;
}

.lf-control-wrap .lf-control--checked {
  padding-inline-end: 36px;
}

.lf-tick {
  position: absolute;
  top: 50%;
  inset-inline-end: 12px;
  translate: 0 -50%;
  width: 15px;
  height: 15px;
  color: var(--lf-ok);
  pointer-events: none;
  animation: lf-tick-in 0.18s ease-out;
}

@keyframes lf-tick-in {
  from {
    opacity: 0;
    scale: 0.7;
  }
  to {
    opacity: 1;
    scale: 1;
  }
}

/* ---------------------------------------------------------------- radio */

.lf-radiogroup {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.lf-radiogroup > legend {
  float: none;
  width: auto;
  padding: 0;
  margin-bottom: 6px;
}

.lf-radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lf-radio {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--lf-h);
  padding: 0 16px 0 13px;
  border: 1px solid var(--lf-border);
  border-radius: var(--lf-radius);
  background-color: var(--lf-surface);
  cursor: pointer;
  font-size: 0.9375rem;
  line-height: 1;
  color: var(--lf-ink);
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.lf-radio:hover {
  border-color: var(--lf-border-hover);
}

/* The native input stays in the layout (not display:none) so it remains
   focusable and announceable; it is the ring below that is drawn. */
.lf-radio input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.lf-radio-dot {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--lf-border-hover);
  border-radius: 50%;
  background-color: var(--lf-surface);
  transition:
    border-color 0.15s ease,
    border-width 0.15s ease;
}

.lf-radio:has(input:checked) {
  border-color: var(--lf-accent);
  background-color: var(--lf-accent-soft);
}

.lf-radio:has(input:checked) .lf-radio-dot {
  border-color: var(--lf-accent);
  border-width: 5.5px;
}

.lf-radio:has(input:focus-visible) {
  border-color: var(--lf-accent);
  box-shadow: 0 0 0 3px var(--lf-accent-soft);
}

.lf-radiogroup--invalid .lf-radio {
  border-color: var(--lf-danger-border);
}

/* ------------------------------------------------------------- checkbox */

.lf-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1.3;
  color: var(--lf-ink);
  user-select: none;
}

.lf-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--lf-accent);
  cursor: pointer;
}

/* ---------------------------------------------------------- date parts */

/* Day / Month / Year as three controls, per GOV.UK + NHS: a single
   `<input type="date">` is unusable for a 1950s birth year and parses
   dd/mm vs mm/dd differently by locale. */
.lf-dateparts {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) 5.5rem;
  gap: 8px;
  min-width: 0;
}

.lf-datepart {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* Day / Month / Year are sub-labels under a legend that has already named the
   field, so they step back rather than competing with it. Previously 11px
   uppercase with tracking, which made the quietest labels on the page the
   loudest-looking. */
.lf-datepart .lf-label {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--lf-muted);
}

.lf-form .lf-dateparts input.lf-control {
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* -------------------------------------------------------------- section */

/* A group of fields under its own heading, inside one card.
   The rule belongs to the section that follows it, not to the gap: equal space
   above and below keeps the heading attached to its own fields instead of
   floating equidistant between two groups, which is what a bare <hr> plus a
   paragraph produced. */
.lf-section {
  border-top: 1px solid var(--lf-border);
  margin-top: 4px;
  padding-top: 20px;
}

.lf-form .lf-section-title {
  font-family: var(--font-family-inter);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3 !important;
  color: var(--lf-ink);
  margin: 0 0 14px;
}

/* "* Required field" — a legend for the asterisks, not a sentence.
   Needs its own class because `.webNewContent p span` in leisure-new-style.css
   sets 1.15rem on any span inside a paragraph, which blows this up to larger
   than the label it is explaining. Sits tight to the fields it describes. */
.lf-form .lf-required-note,
.lf-form .lf-required-note span {
  font-family: var(--font-family-inter);
  font-size: 0.75rem !important;
  line-height: 1.4 !important;
  color: var(--lf-muted);
  margin: 0;
}

.lf-form .lf-required-note .lf-required-star {
  color: var(--lf-danger);
  font-weight: 600;
}

/* Rows of fields need more air between them than the columns need beside them,
   or a two-column grid reads as an undifferentiated mesh. Bootstrap's `g-3`
   sets both to 1rem; this raises only the vertical. */
/* `.row.g-3` sets --bs-gutter-y at the same specificity, and Bootstrap loads
   after this file, so the class has to be doubled up to win. */
.row.lf-rows {
  --bs-gutter-y: 1.25rem;
}

/* ------------------------------------------------- saved travellers */

.lf-saved {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px dashed var(--lf-border-hover);
  border-radius: var(--lf-radius);
  background-color: var(--lf-surface-subtle);
}

.lf-form .lf-saved-current {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  line-height: 1.4 !important;
  color: var(--lf-ok);
}

.lf-saved-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lf-saved-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--lf-border);
  border-radius: var(--lf-radius);
  background-color: var(--lf-surface);
  text-align: start;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.lf-saved-chip:hover:not(:disabled) {
  border-color: var(--lf-accent);
  background-color: var(--lf-accent-soft);
}

.lf-saved-chip:focus-visible {
  outline: none;
  border-color: var(--lf-accent);
  box-shadow: 0 0 0 3px var(--lf-accent-soft);
}

/* Not hidden — a traveller who cannot fill this slot still has to be visible,
   or their absence reads as their record having been lost. */
.lf-saved-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lf-saved-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--lf-ink);
}

.lf-saved-note {
  font-size: 0.6875rem;
  line-height: 1.3;
  color: var(--lf-muted);
}

/* Toggle chips (relationship). Same object as a saved-traveller chip, with an
   on state — one visual language for "pick one of these" throughout the form. */
.lf-form .lf-chip--on {
  border-color: var(--lf-accent);
  background-color: var(--lf-accent-soft);
}

.lf-form .lf-chip--on .lf-saved-name {
  color: var(--lf-accent);
  font-weight: 600;
}

.lf-saved-note--blocked {
  color: var(--lf-danger-ink);
}

/* ------------------------------------------------------------ combobox */

/* SearchDropdown renders its own trigger inside `.lf-combobox-root`; these
   rules only bring it onto the same geometry and palette as the controls
   above. The popup itself keeps the component's existing Bootstrap styling. */
.lf-form .lf-combobox .lf-combobox-root > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: var(--lf-h);
  padding: 0 12px;
  font-family: var(--font-family-content);
  font-size: 0.9375rem;
  text-align: start;
  color: var(--lf-ink);
  background-color: var(--lf-surface);
  border: 1px solid var(--lf-border);
  border-radius: var(--lf-radius);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.lf-form .lf-combobox .lf-combobox-root > button:hover {
  border-color: var(--lf-border-hover);
}

.lf-form .lf-combobox .lf-combobox-root > button:focus-visible,
.lf-form .lf-combobox .lf-combobox-root[data-open="true"] > button {
  outline: none;
  border-color: var(--lf-accent);
  box-shadow: 0 0 0 3px var(--lf-accent-soft);
}

.lf-form .lf-combobox--invalid .lf-combobox-root > button {
  border-color: var(--lf-danger-border);
  background-color: var(--lf-danger-surface);
}

.lf-form .lf-combobox--placeholder .lf-combobox-root > button {
  color: var(--lf-muted);
}

/* The popup sits above the sticky price sidebar and the step nav. */
.lf-form .lf-combobox .search-dropdown-popup {
  z-index: 1060;
  box-shadow: var(--lf-popup-shadow);
  border-color: var(--lf-border) !important;
}

.lf-form .lf-combobox .search-dropdown-option {
  font-size: 0.9rem;
}

/* ------------------------------------------------------------ phone input */

/* PhoneInput sets minHeight/background/border inline, so matching its
   geometry to the rest of the form needs !important. Scoped to .lf-form so
   nothing else that uses the component is affected. */
.lf-form .phone-input-custom {
  min-height: var(--lf-h) !important;
  height: var(--lf-h);
  background-color: var(--lf-surface) !important;
  border-color: var(--lf-border) !important;
  border-radius: var(--lf-radius) !important;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.lf-form .phone-input-custom:focus-within {
  border-color: var(--lf-accent) !important;
  box-shadow: 0 0 0 3px var(--lf-accent-soft);
}

.lf-form .phone-input-custom.is-invalid {
  border-color: var(--lf-danger-border) !important;
  background-color: var(--lf-danger-surface) !important;
}

.lf-form .phone-input-custom input.form-control {
  height: calc(var(--lf-h) - 2px);
  background-color: transparent;
  font-size: 0.9375rem;
  color: var(--lf-ink);
}

.lf-form .phone-input-custom input.form-control:focus {
  box-shadow: none;
}

/* PhoneInput renders its own label and error; bring both onto the same type
   scale as `.lf-label` / `.lf-error` so the contact row reads as one block. */
.lf-form label.form-label {
  font-family: var(--font-family-inter);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--lf-muted);
  margin-bottom: 6px;
}

.lf-form .invalid-feedback.d-block {
  font-size: 0.75rem;
  line-height: 1.4;
  font-weight: 500;
  font-family: var(--font-family-inter);
  color: var(--lf-danger-ink);
  margin-top: 6px;
}

/* ---------------------------------------------------------------- motion */

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

/* Day / Month / Year sub-labels are available to assistive tech but not shown.
   Two reasons, one visual and one editorial:

   1. Alignment. The legend already names the field, so a visible sub-label row
      makes a date field exactly one line taller than every single-label field
      beside it — which is why "Date of birth" and "Nationality" sat on
      different baselines in the same grid row. Removing the row from the visual
      flow makes them line up with no magic spacer on the neighbour.

   2. The controls already say it. The day and year inputs are placeholdered
      DD and YYYY, and the month select's empty option now reads "Month" rather
      than "Select", so the visible form still reads DD / Month / YYYY.

   Kept in the DOM (not `display: none`) so the accessible name of each control
   is still "Day", "Month", "Year" — the labels are doing their real job, they
   just aren't painted twice. */
.lf-datepart .lf-datepart-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
