﻿/* ============================================================
   TarifaAerea Travel — Search Engine styles
   Depends on the CSS variables defined in styles.css
   Covers: trip toggle, engine tabs, search bar + fields,
   popular row, packages note/stepper, and range calendar.
   ============================================================ */

/* ---------------- Trip-type / tabs ---------------- */
.trip-toggle {
  display: flex;
  justify-content: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 22px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-pill);
  backdrop-filter: blur(4px);
}
.trip-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  transition: background 0.2s, color 0.2s;
  user-select: none;
}
/* custom radio dot */
.trip-toggle input {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.2s;
  display: none;
}
.trip-toggle input:checked {
  border-color: var(--lime-700);
}
.trip-toggle input:checked::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--lime-700);
}
/* highlight the whole pill of the checked option */
.trip-toggle label:has(input:checked) {
  background: var(--white);
  color: var(--ink);
}
.trip-toggle label:hover:not(:has(input:checked)) {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.engine-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.engine-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.14);
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.engine-tab:hover { background: rgba(255,255,255,0.18); }
.engine-tab.active { background: var(--primary-color); color: var(--ink); border-color: var(--primary-color); }

/* ---------------- Search Engine ---------------- */
.engine-group { position: relative; }

.search-engine {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  display: flex;
  align-items: stretch;
  gap: 4px;
  max-width: 1260px;
  margin: 0 auto;
}
.search-panel { display: none; width: 100%; }
.search-panel.active { display: flex; align-items: stretch; gap: 4px; width: 100%; }

.field {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  transition: background 0.2s;
  min-width: 0;
}
.field:hover { background: var(--slate-100); }
.field + .field::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  height: 60%;
  width: 1px;
  background: var(--slate-200);
}
.field-icon {
  color: var(--primary-color-700);
  font-size: 1.1rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.field-icon svg { display: block; }
.field-swap svg, .search-submit svg, .pax-caret svg { display: block; }
.search-submit svg { margin-right: 2px; }
.field-body { min-width: 0; flex: 1; }
.field-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--slate-500);
  font-weight: 700;
  margin-bottom: 2px;
}
.field-body input,
.field-body select {
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  width: 100%;
  background: transparent;
  padding: 0;
}
.field-body input::placeholder { color: var(--slate-400); font-weight: 500; }
.field-swap {
  align-self: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--slate-100);
  color: var(--slate-700);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.3s;
}
.field-swap:hover { background: var(--slate-200); transform: rotate(180deg); }

.search-submit {
  flex-shrink: 0;
  margin-left: 6px;
  padding: 0 26px;
  border-radius: var(--radius-pill);
  background: var(--primary-color);
  color: #fff;
  font-weight: 800;
  font-size: 0.98rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: background 0.2s, box-shadow 0.2s;
}
.search-submit:hover { background: var(--primary-color-600); box-shadow: 0 8px 22px var(--ring); }

/* Popular destinations row under engine */
.popular-row {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 26px;
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
}
.popular-row .label { font-weight: 600; opacity: 0.75; }
.popular-row a { font-weight: 700; color: #fff; transition: color 0.2s; }
.popular-row a:hover { color: var(--primary-color); }

/* ---------------- Packages: reassurance note + travelers stepper ---------------- */
.engine-note {
  text-align: center;
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.engine-note .check {
  color: var(--primary-color);
  font-weight: 800;
}

/* Travelers stepper inside a search field */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.stepper button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--slate-100);
  color: var(--slate-700);
  font-size: 1.1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 0.2s;
}
.stepper button:hover { background: var(--slate-200); }
.stepper .count { font-weight: 500; min-width: 62px; text-align: center; font-size: 0.83rem; color: #555; }

/* Combo pill highlighting flight + hotel savings */
.combo-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(200, 240, 0, 0.16);
  color: var(--primary-color);
  border: 1px solid rgba(200, 240, 0, 0.4);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0 auto 18px;
}

/* ============================================================
   Range Calendar (dual-month popover) for search engines
   ============================================================ */

/* A date field is a button styled like the other engine fields */
.date-field {
  text-align: left;
  cursor: pointer;
}
.date-field .date-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.date-field .date-value.placeholder { color: var(--slate-400); font-weight: 500; }

.cal-popover {
  position: absolute;
  z-index: 60;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: min(700px, calc(100vw - 32px));
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 22px 24px;
  color: var(--ink);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.cal-popover.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cal-header h4 { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.3px; }
.cal-nights {
  background: rgba(20, 52, 81, 0.08);
  color: var(--navy-700);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}

.cal-months {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  position: relative;
}
.cal-month { min-width: 0; }
.cal-month-head {
  text-align: center;
  font-weight: 700;
  font-size: 0.98rem;
  margin-bottom: 12px;
  position: relative;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* prev / next arrows sit at the outer top corners */
.cal-nav {
  position: absolute;
  top: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--slate-200);
  color: var(--slate-700);
  display: grid;
  place-items: center;
  background: var(--white);
  transition: background 0.2s, border-color 0.2s;
  z-index: 2;
}
.cal-nav:hover { background: var(--slate-100); border-color: var(--slate-400); }
.cal-nav.prev { left: 0; }
.cal-nav.next { right: 0; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-dow {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--slate-400);
  padding-bottom: 6px;
  text-transform: uppercase;
}
.cal-day {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.cal-day.empty { visibility: hidden; cursor: default; }
.cal-day.disabled { color: var(--slate-200); cursor: not-allowed; }
.cal-day:not(.disabled):not(.empty):hover { background: var(--slate-100); }

/* range fill uses a square background behind the circle */
.cal-day.in-range {
  background: rgba(20, 52, 81, 0.10);
  border-radius: 0;
}
.cal-day.range-start { border-radius: 50% 0 0 50%; }
.cal-day.range-end { border-radius: 0 50% 50% 0; }
.cal-day.single { border-radius: 50%; }

/* selected endpoints: solid teal circle on top */
.cal-day.selected {
  background: var(--navy-700);
  color: #fff;
}
.cal-day.range-start.selected,
.cal-day.range-end.selected {
  background: var(--navy-700);
}
.cal-day.range-start.selected::before,
.cal-day.range-end.selected::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--navy-700);
  border-radius: 50%;
  z-index: 0;
}
.cal-day.selected span { position: relative; z-index: 1; }

.cal-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cal-summary { font-size: 0.92rem; font-weight: 700; color: var(--navy-800); }
.cal-summary .muted { color: var(--slate-400); font-weight: 500; }
.cal-done {
  background: var(--navy-700);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  transition: background 0.2s;
}
.cal-done:hover { background: var(--navy-600); }
.cal-done:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------- Engine responsive ---------------- */
@media (max-width: 900px) {
  .search-engine { border-radius: 22px; padding: 14px; }
  .search-panel.active { flex-direction: column; }
  .field { border-radius: 12px; background: var(--slate-100);margin-bottom: 8px; }
  .field + .field::before { display: none; }
  .field-swap { 
    align-self: flex-end; 
    margin: -16px 0;
    margin-top: -21px;
    margin-right: 10px;
    box-shadow: 0px 0px 5px 0px #ddd;
    position: relative;
    z-index: 100;}
  .search-submit { width: 100%; justify-content: center; padding: 14px; margin-top: 10px; }
}

@media (max-width: 620px) {
  .cal-months { grid-template-columns: 1fr; gap: 22px; }
  .cal-nav.next { right: 0; top: 0; }
  .cal-popover { padding: 18px 16px;top: 50%; }
}

/* ============================================================
   Passengers & cabin popover (flight engines)
   ============================================================ */

/* the field acts as a button trigger */
.pax-field { text-align: left; cursor: pointer; position: relative; flex: 1.3; }
.pax-field .field-body {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
}
.pax-field .field-body > div { min-width: 0; flex: 1; }
.pax-field .pax-value {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pax-field .pax-caret {
  color: var(--slate-400);
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.pax-field.open .pax-caret { transform: rotate(180deg); }

.pax-popover {
  position: absolute;
  z-index: 60;
  top: calc(100% + 12px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--white);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 20px;
  color: var(--ink);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.pax-popover.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.pax-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
}
.pax-row + .pax-row { border-top: 1px solid var(--slate-100); }
.pax-row .pax-info h5 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}
.pax-row .pax-info p {
  font-size: 0.8rem;
  color: var(--slate-500);
}

.pax-stepper {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.pax-stepper button {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--slate-200);
  color: var(--navy-700);
  font-size: 1.15rem;
  line-height: 1;
  display: grid;
  place-items: center;
  background: var(--white);
  transition: border-color 0.2s, background 0.2s, opacity 0.2s;
}
.pax-stepper button:hover:not(:disabled) { border-color: var(--navy-700); background: var(--slate-100); }
.pax-stepper button:disabled { opacity: 0.4; cursor: not-allowed; }
.pax-stepper .pax-count {
  min-width: 20px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
}

.pax-cabin {
  margin: 14px 0 16px;
}
.pax-cabin select {
  width: 100%;
  border: 1.5px solid var(--slate-200);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--white);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.pax-cabin select:focus { border-color: var(--navy-700); }

.pax-done {
  width: 100%;
  background: var(--navy-700);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 13px;
  border-radius: 12px;
  transition: background 0.2s;
}
.pax-done:hover { background: var(--navy-600); }

/* ============================================================
   Airport / city autocomplete dropdown (From / To fields)
   ============================================================ */
.ac-menu {
  position: absolute;
  z-index: 70;
  top: calc(100% + 10px);
  left: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: 320px;
  overflow-y: auto;
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  color: var(--ink);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.ac-menu.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.ac-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.ac-item:hover,
.ac-item.active { background: var(--slate-100); }
.ac-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ac-item.disabled:hover { background: transparent; }

/* brief flash when origin and destination would match */
.field.field-invalid {
  animation: fieldShake 0.4s ease;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.55) inset;
  border-radius: 12px;
}
@keyframes fieldShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.ac-code {
  flex-shrink: 0;
  min-width: 42px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(20, 52, 81, 0.08);
  color: var(--navy-700);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: grid;
  place-items: center;
}
.ac-body { min-width: 0; }
.ac-city {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-sub {
  font-size: 0.8rem;
  color: var(--navy-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-empty {
  padding: 16px 14px;
  color: var(--slate-500);
  font-size: 0.9rem;
  text-align: center;
}
/* ensure the field that hosts the menu positions it correctly */
.field.has-ac { position: relative; }

/* Hotel-city dropdown variant (header + pin rows) */
.ac-header {
  padding: 12px 14px 8px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--slate-500);
}
.ac-city-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.ac-city-item:hover,
.ac-city-item.active { background: var(--slate-100); }
.ac-city-item .ac-pin {
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: 9px;
  background: rgba(20, 52, 81, 0.08);
  color: var(--navy-700);
  display: grid;
  place-items: center;
}
.ac-city-item .ac-place { min-width: 0; }
.ac-city-item .ac-c {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-city-item .ac-country { font-size: 0.8rem; color: var(--slate-500); }

/* Engine field validation (missing destination / dates on Search) */
.field.field-error {
  box-shadow: inset 0 0 0 1.5px #e11d48;
  background: rgba(225, 29, 72, 0.06);
}
.field.field-error .field-label { color: #e11d48; }
.engine-hint {
  text-align: center;
  margin-top: 14px;
  color: #ffd7de;
  background: rgba(225, 29, 72, 0.25);
  border: 1px solid rgba(225, 29, 72, 0.4);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  display: none;
}
.engine-hint.show { display: inline-block; }
.engine-hint-wrap { text-align: center; }

/* Header phone button (replaces Sign in) */
.nav-phone {
  font-size: 0.9rem;
  padding: 9px 18px;
  white-space: nowrap;
}
.nav-phone svg { display: block; }
/* Keep the phone visible on mobile even though it carries .btn-desktop */
@media (max-width: 760px) {
  .nav-actions .nav-phone.btn-desktop { display: inline-flex; }
  .nav-phone { font-size: 0.82rem; padding: 8px 14px; }
}
@media (max-width: 480px) {
  /* on very small screens show just the number a touch tighter */
  .nav-phone { padding: 7px 12px; }
}
