/* Shared search form + loader styles. Used by /home (hero) and /erlebnisreisen
 * (listing hero). Originally lived inside home.css.
 */

.search {
  position: relative;
  z-index: 3;
  margin-top: 36px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(14px);
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.55),
    0 1px 0 rgba(255, 255, 255, 0.2) inset;
  overflow: visible;
}
.search-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  background: #ffffff;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.search-tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  padding: 16px 24px;
  border: 0;
  border-radius: 0;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  color: #3b4a5a;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
  white-space: nowrap;
}
.tab.active { background: var(--brand); color: var(--on-brand); }
.search-tabs .tab[disabled] { opacity: 0.45; cursor: not-allowed; }

@media (max-width: 560px) {
  /* Equal-distributed underline tabs on mobile. The chunky orange fill
     is replaced by a brand-color label + 2px indicator so the three
     tabs share the same height & visual weight. */
  .search-tabs {
    overflow-x: visible;
    border-bottom: 1px solid var(--line-2);
  }
  .tab {
    flex: 1 1 0;
    min-width: 0;
    padding: 14px 6px;
    font-size: 13px;
    font-weight: 600;
    gap: 6px;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    background: #fff;
    color: var(--muted);
    position: relative;
  }
  .tab svg { display: none; }
  .tab-trail { display: none; }
  .tab.active {
    background: #fff;
    color: var(--brand-text);
    font-weight: 700;
  }
  .tab.active::after {
    content: "";
    position: absolute;
    left: 12px; right: 12px; bottom: -1px;
    height: 2px; background: var(--brand-text);
    border-radius: 2px;
  }
}

.search-fields {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: stretch;
  padding: 14px 18px 10px;
  gap: 8px;
}
.field {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  min-width: 0;
  cursor: pointer;
  min-height: 68px;
  /* Right padding keeps the value clear of the state badge. */
  padding: 12px 36px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
@media (pointer: coarse) {
  /* A swipe may begin anywhere on a stacked mobile field. Keep vertical page
     panning native; search-mask.js separately recognises deliberate taps. */
  .field { touch-action: pan-y; }
}
.field:hover,
.field:focus-within {
  border-color: #d6dce3;
  background: #fff;
}
.field--destination { grid-column: span 4; }
.field--month { grid-column: span 3; }
.field--tour { grid-column: span 5; }
.field--airport { grid-column: span 4; }
.field--duration { grid-column: span 3; }
.field--travelers { grid-column: span 3; }
.search--business-class .field--destination,
.search--business-class .field--airport { grid-column: span 6; }
.search--business-class .field--travelers,
.search--business-class .field--month,
.search--business-class .field--duration,
.search--business-class .search-btn { grid-column: span 3; }
.field + .field::before {
  display: none;
}
.field > div {
  position: relative;
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field .ico {
  width: 22px; height: 22px;
  flex-shrink: 0;
  color: var(--ink);
}
.field .lbl {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.field .sub {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.25;
  font-weight: 500;
}
.field select.sub {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  font-family: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.field select.sub:disabled { color: #788491; cursor: not-allowed; }
.field select.sub:focus { outline: none; }
/* Empty choices stay readable; disabled controls are still visually quieter. */
.field:has(select.sub option:checked[value=""]) select.sub { color: #586574; }
.field select.sub option { color: var(--ink); }

/* ── Guided cascade states ────────────────────────────────────────────────
 * Each field carries a badge that answers "can I use this yet?" at a glance:
 * red padlock = blocked, amber pulse = your next step, green tick = done,
 * spinner = options loading. The states are rendered server-side by
 * partials/search-form.php and kept in sync by search-mask.js, so the very
 * first paint already explains itself. */
.field-flag {
  position: absolute;
  right: 11px;
  top: 50%;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: transparent;
  transition: background .15s ease, color .15s ease;
}
.field-flag__ico { display: none; width: 14px; height: 14px; }

/* Nothing to say — an open field the user simply hasn't reached yet. */
.field.is-open:not(.is-next) .field-flag { display: none; }

/* Blocked. The whole field goes quiet and dashed so it reads as "not yet"
 * rather than "broken", while the badge names the reason in red. */
.field.is-locked {
  background: var(--surface);
  border-style: dashed;
  border-color: #dfe3e8;
}
.field.is-locked:hover { background: #f0f2f5; border-color: #d3d9e0; }
.field.is-locked .ico { color: #8d98a4; }
.field.is-locked .lbl { color: #6b7885; }
.field.is-locked select.sub:disabled { color: #6b7885; cursor: pointer; }
.field.is-locked .field-flag {
  background: #fdeaea;
  color: #c0392b;
  box-shadow: inset 0 0 0 1px rgba(192, 57, 43, 0.22);
}
.field.is-locked .field-flag__ico--lock { display: block; }

/* The one field to answer next. */
.field.is-next {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(244, 155, 6, 0.18);
}
.field.is-next .field-flag { background: var(--brand); color: #fff; }
.field.is-next .field-flag::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.field.is-next .field-flag::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid var(--brand);
  animation: field-flag-pulse 1.8s ease-out infinite;
}
@keyframes field-flag-pulse {
  0%   { transform: scale(1);    opacity: .7; }
  70%  { transform: scale(1.75); opacity: 0;  }
  100% { transform: scale(1.75); opacity: 0;  }
}

/* Answered. */
.field.is-done .field-flag { background: #e6f4ea; color: #1a7f37; }
.field.is-done .field-flag__ico--check { display: block; }

/* Options still in flight. */
.field.is-loading .field-flag { color: var(--muted-2); }
.field.is-loading .field-flag::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: field-flag-spin .8s linear infinite;
}
@keyframes field-flag-spin { to { transform: rotate(360deg); } }

/* Prerequisites are met but upstream returned nothing for this field. */
.field.is-unavailable .field-flag { background: #fdecec; color: #c0392b; }
.field.is-unavailable .field-flag__ico--alert { display: block; }

/* Clicking a blocked field flashes it red and walks the user to the field
 * that unblocks it, which gets the matching amber call-out. */
.field.is-denied {
  animation: field-denied .5s ease;
  border-color: #e2a2a2;
  border-style: solid;
}
@keyframes field-denied {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-4px); }
  45%      { transform: translateX(3px); }
  70%      { transform: translateX(-2px); }
}
.field.is-calling { animation: field-calling 1.1s ease-out; }
@keyframes field-calling {
  0%   { box-shadow: 0 0 0 0 rgba(244, 155, 6, 0.55); }
  60%  { box-shadow: 0 0 0 9px rgba(244, 155, 6, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 155, 6, 0); }
}

/* Focus must win over every state ring above. */
.field:focus-within {
  background: #f4f6f8;
  box-shadow: inset 0 0 0 2px var(--focus-ring);
}

.search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--brand);
  color: var(--on-brand);
  border: none;
  grid-column: span 2;
  min-height: 68px;
  padding: 0 22px;
  height: auto;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  justify-self: stretch;
  align-self: stretch;
  margin-left: 0;
  transition: filter .15s ease, transform .15s ease;
}
.search-btn:hover { filter: brightness(1.05); }
.search-btn:active { transform: scale(0.98); }
.search-btn svg { width: 16px; height: 16px; }
.search-btn.is-loading {
  pointer-events: none;
  opacity: 0.85;
  transform: none;
}
.search-btn.is-loading svg { animation: search-btn-spin .9s linear infinite; }
@keyframes search-btn-spin { to { transform: rotate(360deg); } }

.search-feedback {
  display: flex;
  align-items: center;
  gap: 10px 18px;
  min-height: 28px;
  padding: 4px 20px 16px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: transparent;
  color: #4b5968;
  font-size: 12px;
  line-height: 1.45;
}
.search-status { font-weight: 700; }
/* Answer to "why is this field blocked?" — same red as the padlock badge. */
.search-status.is-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #a02b1f;
}
.search-status.is-hint::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c0392b;
}
.search-error {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #8f1d1d;
  font-weight: 700;
}
.search-error[hidden],
.search-status[hidden] { display: none; }
.search-error button {
  min-height: 44px;
  border: 1px solid #b92b2b;
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: #7f1717;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.search-help { margin-left: auto; text-align: right; }
.search-help a { color: #724100; font-weight: 800; text-decoration: underline; }

/* Search loader overlay */
html.is-search-pending,
html.is-search-pending body { overflow: hidden; }

.search-loader {
  position: fixed;
  inset: 0;
  z-index: 250;
  isolation: isolate;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 22, 32, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .18s ease;
}
.search-loader[hidden] { display: none; }
.search-loader.is-visible { opacity: 1; }

.search-loader__card {
  position: relative;
  width: min(440px, 100%);
  /* The card grows when the patience note appears; keep it inside short
     viewports (landscape phones) instead of letting it bleed off-screen. */
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 36px 32px 28px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.55);
  text-align: center;
  transform: translateY(8px);
  transition: transform .25s cubic-bezier(.4, .2, .2, 1);
}
.search-loader.is-visible .search-loader__card { transform: translateY(0); }
.search-loader__card:focus { outline: none; }

.search-loader__cancel {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.search-loader__cancel:hover {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
}
.search-loader__cancel:focus-visible {
  outline: 3px solid rgba(244, 155, 6, 0.4);
  outline-offset: 2px;
}
.search-loader__cancel svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.search-loader__spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  color: var(--brand-text);
}
.search-loader__spinner svg {
  width: 100%;
  height: 100%;
  animation: search-loader-rotate 1.4s linear infinite;
}
.search-loader__spinner circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 90 150;
  stroke-dashoffset: 0;
  animation: search-loader-dash 1.4s ease-in-out infinite;
  transform-origin: center;
}
@keyframes search-loader-rotate { to { transform: rotate(360deg); } }
@keyframes search-loader-dash {
  0%   { stroke-dasharray: 1 150;  stroke-dashoffset: 0;    }
  50%  { stroke-dasharray: 90 150; stroke-dashoffset: -35;  }
  100% { stroke-dasharray: 90 150; stroke-dashoffset: -124; }
}

.search-loader__title {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.search-loader__desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 14px;
}
.search-loader__progress {
  height: 8px;
  margin-bottom: 20px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.search-loader__progress-bar {
  display: block;
  width: 45%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #ffc25b);
  transform: translateX(-120%);
}
.search-loader.is-visible .search-loader__progress-bar {
  animation: search-loader-progress 1.5s ease-in-out infinite;
}
@keyframes search-loader-progress {
  from { transform: translateX(-120%); }
  to   { transform: translateX(320%); }
}
.search-loader__steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.search-loader__steps li {
  position: relative;
  padding: 10px 14px 10px 36px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}
.search-loader__steps li::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  transform: translateY(-50%);
  opacity: 0.25;
  animation: search-loader-pulse 1.6s ease-in-out infinite;
}
.search-loader__steps li:nth-child(2)::before { animation-delay: .25s; }
.search-loader__steps li:nth-child(3)::before { animation-delay: .5s; }
@keyframes search-loader-pulse {
  0%, 100% { opacity: 0.25; box-shadow: 0 0 0 0 rgba(244, 155, 6, 0.0); }
  50%      { opacity: 1;    box-shadow: 0 0 0 6px rgba(244, 155, 6, 0.15); }
}

/* Patience note, revealed by search-loader-patience.js once the wait runs
   long. The 0fr → 1fr row lets the card grow into it instead of jumping. */
.search-loader__patience {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 0;
  opacity: 0;
  transition: grid-template-rows .34s cubic-bezier(.4, .2, .2, 1),
              margin-top .34s cubic-bezier(.4, .2, .2, 1),
              opacity .28s ease;
}
.search-loader__patience[hidden] { display: none; }
.search-loader__patience.is-visible {
  grid-template-rows: 1fr;
  margin-top: 16px;
  opacity: 1;
}
.search-loader__patience-clip { min-height: 0; overflow: hidden; }
.search-loader__patience-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid rgba(244, 155, 6, 0.35);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff8ed, #fff1dc);
  color: var(--brand-text);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
}
.search-loader__patience-text { text-wrap: balance; }
.search-loader__patience-icon {
  flex: none;
  width: 20px;
  height: 20px;
}
.search-loader__patience-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: search-loader-hourglass 3s ease-in-out infinite;
}
@keyframes search-loader-hourglass {
  0%, 62%   { transform: rotate(0); }
  80%, 100% { transform: rotate(180deg); }
}

/* Tablet: keep the most descriptive controls wide instead of forcing every
   value into equal columns. Tour & Termin gets a full row because its labels
   are usually the longest. */
@media (max-width: 1100px) and (min-width: 561px) {
  .search-fields {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
  }
  .field--destination,
  .field--month,
  .field--airport,
  .field--duration,
  .field--travelers { grid-column: span 3; }
  .field--tour { grid-column: 1 / -1; }
  .search--business-class .field--destination,
  .search--business-class .field--airport,
  .search--business-class .field--travelers,
  .search--business-class .field--month,
  .search--business-class .field--duration,
  .search--business-class .search-btn { grid-column: span 3; }
  .search-btn {
    grid-column: span 3;
    width: 100%;
    justify-self: stretch;
    margin-left: 0;
  }
  .search-feedback { flex-wrap: wrap; }
  .search-help { width: 100%; margin-left: 0; text-align: left; }
}

@media (max-width: 560px) {
  .search-fields { grid-template-columns: 1fr; gap: 8px; padding: 12px; }
  .field,
  .field--destination,
  .field--month,
  .field--tour,
  .field--airport,
  .field--duration,
  .field--travelers,
  .search-btn { grid-column: 1; }
  .search--business-class .field--destination,
  .search--business-class .field--airport,
  .search--business-class .field--travelers,
  .search--business-class .field--month,
  .search--business-class .field--duration,
  .search--business-class .search-btn { grid-column: 1; }
  .search-btn { width: 100%; margin-left: 0; }
  .search-feedback { display: grid; padding: 0 16px 14px; }
  .search-help { margin-left: 0; text-align: left; }
  .search-loader { padding: 16px; }
  .search-loader__card { padding: 30px 20px 22px; }
  .search-loader__patience.is-visible { margin-top: 14px; }
  .search-loader__patience-note { gap: 9px; padding: 10px 12px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .search-loader,
  .search-loader__card,
  .search-loader__patience { transition: none; }
  .search-loader__spinner svg,
  .search-loader__spinner circle,
  .search-loader__progress-bar,
  .search-loader__steps li::before,
  .search-loader__patience-icon svg,
  .search-btn.is-loading svg { animation: none; }
  .search-loader__spinner circle { stroke-dasharray: 60 150; }
  .search-loader__progress-bar { width: 100%; transform: none; opacity: .65; }
  /* The badge colours already carry the state; drop the motion that repeats it. */
  .field.is-next .field-flag::after,
  .field.is-loading .field-flag::before,
  .field.is-denied,
  .field.is-calling { animation: none; }
  .field.is-calling { box-shadow: 0 0 0 3px rgba(244, 155, 6, 0.45); }
}
