/* Mizrahnik Flight Search — scoped under .mz-flight-search. Never touch body/html/:root/*. */

.mz-flight-search {
  /* internal tokens mapped from the brand DS, with fallbacks */
  --fs-primary: var(--mz-primary, #5FA886);
  --fs-primary-dark: #488f6e;
  --fs-bg: var(--mz-surface, #f6f7f9);
  --fs-surface: var(--mz-surface-2, #ffffff);
  --fs-text: var(--mz-text, #111827);
  --fs-muted: var(--mz-muted, #6b7280);
  --fs-border: var(--mz-border, rgba(17, 24, 39, 0.15));
  --fs-focus: var(--mz-focus, rgba(51, 100, 173, 0.45));
  --fs-radius: 14px;
  --fs-gap: 14px;

  font-family: var(--font-fredoka, "Fredoka", "Heebo", sans-serif);
  color: var(--fs-text);
  text-align: start;
  line-height: 1.7;
  box-sizing: border-box;
}
.mz-flight-search *,
.mz-flight-search *::before,
.mz-flight-search *::after {
  box-sizing: inherit;
}

/* Ensure [hidden] wins over the field's display:flex (e.g. the return-date
   field in one-way mode). Without this, display:flex overrides the UA [hidden]. */
.mz-flight-search [hidden] {
  display: none !important;
}

html[data-theme="dark"] .mz-flight-search,
body[data-theme="dark"] .mz-flight-search {
  --fs-bg: var(--mz-surface, #111827);
  --fs-surface: var(--mz-surface-2, #0f172a);
  --fs-text: var(--mz-text, #e5e7eb);
  --fs-muted: var(--mz-muted, #9ca3af);
  --fs-border: var(--mz-border, rgba(229, 231, 235, 0.18));
  --fs-focus: var(--mz-focus, rgba(138, 180, 255, 0.55));
}

/* Card */
.mz-flight-search .mz-fs-card {
  background: var(--fs-surface);
  border: 1px solid var(--fs-border);
  border-radius: var(--fs-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--fs-gap);
  max-width: 1040px;
  margin-inline: auto;
}

/* Secondary row: trip-type + cabin + direct — one aligned line of equal-height controls */
.mz-flight-search .mz-fs-row-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}
/* each secondary control is a single inline line (label beside control), not stacked */
.mz-flight-search .mz-fs-row-secondary .mz-fs-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.mz-flight-search .mz-fs-row-secondary .mz-fs-field > label {
  white-space: nowrap;
}
.mz-flight-search .mz-fs-row-secondary select {
  inline-size: auto;
  height: 48px;
  min-height: 0;
}
/* push "direct" to the far (inline-end) side */
.mz-flight-search .mz-fs-row-secondary > [data-slot="direct"] {
  margin-inline-start: auto;
}
/* trip-type pill: match the 48px control height on desktop (stays 44px tap target on mobile) */
@media (min-width: 768px) {
  .mz-flight-search .mz-fs-row-secondary .mz-fs-triptype {
    height: 48px;
    padding: 3px;
  }
  .mz-flight-search .mz-fs-row-secondary .mz-fs-triptype-opt {
    min-height: 0;
    height: 100%;
  }
}

/* Main row: mobile stacks; desktop lays out horizontally */
.mz-flight-search .mz-fs-row-main {
  display: flex;
  flex-direction: column;
  gap: var(--fs-gap);
}
@media (min-width: 768px) {
  .mz-flight-search .mz-fs-row-main {
    flex-direction: row;
    align-items: end;
  }
  .mz-flight-search .mz-fs-row-main > .mz-fs-field {
    flex: 1 1 0;
    min-width: 0;
  }
  .mz-flight-search .mz-fs-row-main > [data-slot="submit"] {
    flex: 0 0 auto;
  }
  /* dates cell holds two inputs (depart + return) → give it more room */
  .mz-flight-search .mz-fs-row-main > [data-slot="departDate"] {
    flex: 2 1 0;
  }
  .mz-flight-search .mz-fs-row-main > [data-slot="submit"] .mz-fs-submit {
    inline-size: auto;
    padding-inline: 32px;
  }
}

.mz-flight-search .mz-fs-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0; /* let flex fields shrink so date inputs can't push past the card */
}
.mz-flight-search .mz-fs-field:empty {
  display: none;
}

.mz-flight-search label {
  font-weight: 700;
  font-size: 14px;
}

/* Inputs — 16px min prevents iOS zoom */
.mz-flight-search input,
.mz-flight-search select {
  font-family: inherit;
  font-size: 16px;
  color: var(--fs-text);
  background: var(--fs-bg);
  border: 1px solid var(--fs-border);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 44px;
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
  box-sizing: border-box;
}
/* iOS/WebKit gives <input type=date> an intrinsic min width that ignores
   width:100% and overflows the card. Force it to shrink to its container. */
.mz-flight-search input[type="date"] {
  min-inline-size: 0;
  max-inline-size: 100%;
  font-size: 16px; /* explicit: never below 16px → no iOS focus-zoom */
  -webkit-appearance: none;
  appearance: none;
  overflow: hidden;
}
/* iOS focus-zoom guard: force 16px inputs on small screens (beats theme overrides) */
@media screen and (max-width: 767px) {
  .mz-flight-search input,
  .mz-flight-search select {
    font-size: 16px;
  }
}
.mz-flight-search input[type="date"]::-webkit-date-and-time-value {
  text-align: start;
  margin: 0;
}

/* Focus — visible on every interactive element */
.mz-flight-search :focus-visible {
  outline: 3px solid var(--fs-focus);
  outline-offset: 2px;
}

/* Trip-type segmented control */
.mz-flight-search .mz-fs-triptype {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--fs-bg);
  border: 1px solid var(--fs-border);
  border-radius: 50px;
}
.mz-flight-search .mz-fs-triptype-opt {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--fs-muted);
  background: transparent;
  border: none;
  border-radius: 50px;
  padding: 8px 18px;
  min-height: 44px;
  cursor: pointer;
}
.mz-flight-search .mz-fs-triptype-opt.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--fs-primary) 0%, var(--fs-primary-dark) 100%);
}

/* Submit button (pill, green gradient — the Mizrahnik feel) */
.mz-flight-search .mz-fs-submit {
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, var(--fs-primary) 0%, var(--fs-primary-dark) 100%);
  border: none;
  border-radius: 50px;
  min-height: 48px;
  padding: 12px 24px;
  inline-size: 100%;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 15px rgba(95, 168, 134, 0.5);
}
.mz-flight-search .mz-fs-submit:hover {
  transform: translateY(-2px);
}
.mz-flight-search .mz-fs-submit:disabled {
  opacity: 0.7;
  cursor: progress;
  transform: none;
}
.mz-flight-search .mz-fs-fallback {
  display: inline-block;
  margin-top: 8px;
  color: var(--fs-primary);
  font-weight: 700;
}

/* City combobox */
.mz-flight-search .mz-fs-combobox {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mz-flight-search .mz-fs-input-wrap {
  position: relative;
  display: block;
}
/* input leaves room for the ✕ on the trailing (inline-end) side */
.mz-flight-search .mz-fs-input-wrap input {
  inline-size: 100%;
  padding-inline-end: 40px;
}
.mz-flight-search .mz-fs-clear {
  position: absolute;
  inset-inline-end: 6px;
  inset-block-start: 50%;
  transform: translateY(-50%);
  inline-size: 28px;
  block-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fs-muted, #6b7280);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.mz-flight-search .mz-fs-clear:hover {
  background: var(--fs-border, #e5e7eb);
  color: var(--fs-text, #111827);
}
.mz-flight-search .mz-fs-clear[hidden] {
  display: none;
}
/* Dark-mode dropdown fix: the site's dark-mode plugin sets
   `[data-theme="dark"] .e-con > * { position:relative; z-index:1 }` on every
   Elementor child, which creates a stacking context per widget and traps our
   absolutely-positioned dropdown behind the section below it. Lift the widget /
   container that holds this form above its siblings so the dropdown escapes.
   (:has is supported by all current browsers.) */
html[data-theme="dark"] .elementor-widget:has(.mz-flight-search),
body[data-theme="dark"] .elementor-widget:has(.mz-flight-search),
html[data-theme="dark"] .e-con:has(.mz-flight-search),
body[data-theme="dark"] .e-con:has(.mz-flight-search),
html[data-theme="dark"] .elementor-column:has(.mz-flight-search),
body[data-theme="dark"] .elementor-column:has(.mz-flight-search) {
  z-index: 50;
}

.mz-flight-search .mz-fs-combobox [role="listbox"] {
  position: absolute;
  z-index: 100;
  inset-block-start: 100%;
  inset-inline-start: 0;
  inline-size: 100%;
  max-block-size: 320px;
  overflow-y: auto;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: var(--fs-surface);
  border: 1px solid var(--fs-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.mz-flight-search .mz-fs-group-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--fs-muted);
  padding: 8px 12px 4px;
  position: sticky;
  inset-block-start: 0;
  background: var(--fs-surface);
}
.mz-flight-search .mz-fs-option {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.mz-flight-search .mz-fs-option:hover,
.mz-flight-search .mz-fs-option.is-active {
  background: var(--fs-primary);
  color: #ffffff;
}
.mz-flight-search .mz-fs-nomatch {
  padding: 12px;
  color: var(--fs-muted);
  font-size: 14px;
}
.mz-flight-search .mz-fs-error {
  color: var(--stories-danger-text, #822727);
  font-size: 14px;
  padding: 8px 0;
}

/* Dates */
.mz-flight-search .mz-fs-dates {
  display: flex;
  flex-direction: column;
  gap: var(--fs-gap);
}
@media (min-width: 768px) {
  .mz-flight-search .mz-fs-dates {
    flex-direction: row;
  }
  .mz-flight-search .mz-fs-dates > .mz-fs-field {
    flex: 1;
    min-width: 0; /* allow shrink so labels/inputs don't overflow into neighbours */
  }
}

/* Passengers */
.mz-flight-search .mz-fs-pax-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.mz-flight-search .mz-fs-pax-row > span:first-child {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
}
.mz-flight-search .mz-fs-step {
  inline-size: 44px;
  block-size: 44px;
  border-radius: 12px;
  border: 1px solid var(--fs-border);
  background: var(--fs-bg);
  color: var(--fs-text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.mz-flight-search .mz-fs-step:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.mz-flight-search .mz-fs-pax-count {
  min-inline-size: 2ch;
  text-align: center;
  font-weight: 700;
}

/* Passenger popover */
.mz-flight-search .mz-fs-pax-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mz-flight-search .mz-fs-pax-label {
  font-weight: 700;
  font-size: 14px;
}
.mz-flight-search .mz-fs-pax-trigger {
  font-family: inherit;
  font-size: 16px;
  text-align: start;
  color: var(--fs-text);
  background: var(--fs-bg);
  border: 1px solid var(--fs-border);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 44px;
  inline-size: 100%;
  cursor: pointer;
}
/* Matches both when nested in the card and when portaled to <body> (panel then
   carries the .mz-flight-search class itself → compound, no descendant space). */
.mz-flight-search .mz-fs-pax-panel,
.mz-flight-search.mz-fs-pax-panel {
  position: fixed; /* JS sets top/left; fixed + body escapes ancestor overflow clipping */
  z-index: 100;
  min-inline-size: 260px;
  max-inline-size: calc(100vw - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 14px;
  background: var(--fs-surface);
  border: 1px solid var(--fs-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Direct-only checkbox — label wraps for a large hit area */
.mz-flight-search .mz-fs-direct {
  display: flex;
  align-items: center;
  gap: 10px;
  min-block-size: 44px;
  cursor: pointer;
  font-size: 14px;
}
.mz-flight-search .mz-fs-direct input {
  inline-size: 20px;
  block-size: 20px;
  min-height: 0;
}

/* Field error bubble — floats under the field, no layout shift */
.mz-flight-search .mz-fs-bubble {
  position: absolute;
  inset-block-start: calc(100% + 6px);
  inset-inline-start: 0;
  z-index: 15;
  background: #dc2626;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.mz-flight-search .mz-fs-bubble::before {
  content: "";
  position: absolute;
  inset-block-end: 100%;
  inset-inline-start: 16px;
  border: 6px solid transparent;
  border-block-end-color: #dc2626;
}

/* Insurance checkbox (secondary row) */
.mz-flight-search .mz-fs-insurance {
  display: flex;
  align-items: center;
  gap: 8px;
  min-block-size: 44px;
  cursor: pointer;
  font-size: 14px;
}
.mz-flight-search .mz-fs-insurance input {
  inline-size: 20px;
  block-size: 20px;
  min-height: 0;
}

/* Lead modal */
.mz-flight-search .mz-fs-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.5);
}
.mz-flight-search .mz-fs-modal-dialog {
  background: var(--fs-surface);
  color: var(--fs-text);
  border: 1px solid var(--fs-border);
  border-radius: var(--fs-radius);
  padding: 24px;
  inline-size: 100%;
  max-inline-size: 420px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mz-flight-search .mz-fs-modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}
.mz-flight-search .mz-fs-modal-consent {
  margin: 0;
  font-size: 13px;
  color: var(--fs-muted);
}
.mz-flight-search .mz-fs-consent-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--fs-text);
  line-height: 1.4;
  cursor: pointer;
}
.mz-flight-search .mz-fs-consent-check input[type="checkbox"] {
  inline-size: 18px;
  block-size: 18px;
  margin-block-start: 1px;
  flex-shrink: 0;
  accent-color: var(--fs-primary);
}
.mz-flight-search .mz-fs-consent-link {
  color: var(--fs-primary);
  text-decoration: underline;
}
.mz-flight-search .mz-fs-modal-errors:not(:empty) {
  color: var(--stories-danger-text, #822727);
  font-size: 14px;
}
.mz-flight-search .mz-fs-modal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.mz-flight-search .mz-fs-modal-submit {
  flex: 1;
}
.mz-flight-search .mz-fs-modal-cancel {
  background: transparent;
  border: 1px solid var(--fs-border);
  border-radius: 50px;
  color: var(--fs-text);
  font-family: inherit;
  font-size: 14px;
  min-height: 44px;
  padding: 0 18px;
  cursor: pointer;
}
/* honeypot — hidden from users, present for bots */
.mz-flight-search .mz-fs-hp {
  position: absolute;
  inset-inline-start: -9999px;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
}

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