/* ═══════════════════════════════════════════════════════
   Farefinda — App Mode (Capacitor / body.is-app)
   All rules scoped to body.is-app — zero impact on web.
   ═══════════════════════════════════════════════════════ */

/* ── Safe area + design tokens ──────────────────────────── */
:root {
  --app-nav-h: 58px;
}
body.is-app {
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-total:   calc(var(--app-nav-h) + var(--safe-bottom));
  background: #F0F4F8;
}

/* ── Remove web chrome ──────────────────────────────────── */
body.is-app footer,
body.is-app .site-footer,
body.is-app [class*="footer"] { display: none !important; }

body.is-app header .nav > a,
body.is-app header .nav .lang-switcher { display: none !important; }

/* ── Header: dark + status-bar padding ─────────────────── */
body.is-app .site-header {
  height: calc(54px + var(--safe-top));
  padding-top: var(--safe-top);
  background: linear-gradient(135deg, #0d1f4a 0%, #1e3a8a 100%);
  border-bottom: none;
  box-shadow: none;
}
body.is-app .logo { color: #ffffff; }

/* ── Hero: FareFirst-style in app ───────────────────────── */
body.is-app .hero {
  min-height: 0;
  padding: 24px 0 0;
  /* Dot pattern overlay like FareFirst */
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.12) 1.5px, transparent 1.5px),
    radial-gradient(ellipse 70% 60% at 70% 30%, rgba(59,130,246,.25) 0%, transparent 60%),
    radial-gradient(ellipse 50% 70% at 15% 70%, rgba(29,78,216,.3) 0%, transparent 50%),
    linear-gradient(135deg, #0d1f4a 0%, #14307a 40%, #1e55a8 70%, #2563EB 100%);
  background-size: 22px 22px, auto, auto, auto;
}
body.is-app .hero::after { display: none; }
body.is-app .hero-eyebrow { display: none; }
body.is-app .hero-content { padding: 0 20px 4px; }

/* Greeting line above title */
body.is-app .hero-content::before {
  content: 'Find your next flight ✈️';
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  letter-spacing: .04em;
  margin-bottom: 8px;
}
body.is-app .hero-title {
  font-size: clamp(1.625rem, 6.5vw, 2.125rem);
  margin-bottom: 0;
  white-space: normal;
  line-height: 1.15;
}
body.is-app .hero-sub { display: none; }
body.is-app .search-widget-outer {
  margin-top: 16px;
  padding: 0 12px 24px;
}

/* ── Quick links grid (app-only, hidden on web) ─────────── */
.app-quick-links { display: none; }

body.is-app .app-quick-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 16px 20px;
}

.app-quick-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  text-decoration: none;
  color: #1e293b;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.app-quick-link:active {
  transform: scale(0.93);
  box-shadow: 0 0 0 rgba(0,0,0,0);
}
.app-quick-link-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.app-quick-link-label {
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  text-align: center;
  letter-spacing: 0.01em;
}

/* ── Search form: FareFirst floating-card style ─────────── */
body.is-app input,
body.is-app select,
body.is-app textarea { font-size: 16px !important; }

/* Wrap entire widget in a white card on blue background */
body.is-app .search-widget {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.22);
  padding: 4px 0 0;
  overflow: hidden;
}

/* Each field: tall, clean label + value layout */
body.is-app .search-bar {
  flex-direction: column;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  min-height: 0;
}

body.is-app .search-bar .field {
  flex: none !important;
  width: 100%;
  min-height: 62px;
  border-right: none !important;
  border-bottom: 1px solid #F3F4F6 !important;
  padding: 12px 18px;
  background: #fff;
}

body.is-app .search-bar .field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #9CA3AF;
  margin-bottom: 3px;
}

body.is-app .search-bar .field .field-input {
  font-size: 15px !important;
  font-weight: 600;
  color: #0F172A;
}

body.is-app .search-bar .field-pax {
  flex: none !important;
  border-bottom: 1px solid #F3F4F6 !important;
}

/* Swap button: hidden in app (fields are stacked vertically) */
body.is-app .search-bar .swap-btn { display: none !important; }

/* Date fields: side by side in app */
body.is-app .search-bar .field-date {
  flex: 1 1 50% !important;
  width: 50%;
  display: inline-flex;
}

/* Tab row: stay clean in app */
body.is-app .widget-tabs {
  padding: 12px 16px 0;
  background: #fff;
}
body.is-app .widget-tab {
  background: #F3F4F6;
  color: #6B7280;
  padding: 8px 18px;
  font-size: 13px;
}
body.is-app .widget-tab.active {
  background: #2563EB;
  color: #fff;
}

/* Search button: full-width pill */
body.is-app .search-bar .btn-search,
body.is-app .btn-search {
  flex: none !important;
  width: calc(100% - 24px);
  margin: 12px 12px;
  border-radius: 100px;
  height: 52px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
}

/* Pax panel: open upward in app */
body.is-app .search-bar .pax-panel {
  bottom: calc(100% + 4px);
  top: auto;
}

/* Autocomplete ──────────────────────────────────────────
   Airport picking in the app uses the shared full-screen .ac-sheet panel
   (style.css + search.js), the same one mobile web gets. It deliberately lives
   on <body> rather than inside the search widget: .hero and
   .results-search-header both set z-index:150, which makes them stacking
   contexts, so an in-widget panel can never paint above a body-level element
   no matter how high its own z-index is. That is what put a dark backdrop on
   top of the old in-widget bottom sheet and swallowed every tap on it. */

/* ── Content padding above bottom nav ──────────────────── */
body.is-app main,
body.is-app .main-content,
body.is-app .page-content,
body.is-app article,
body.is-app .results-layout { padding-bottom: calc(var(--nav-total) + 20px); }

/* Search-detail: results need extra room ───────────────── */
body.is-app .results-list { padding-bottom: 8px; }

/* ═══════════════════════════════════════════════════════
   BOTTOM NAVIGATION
   ═══════════════════════════════════════════════════════ */
.app-bottom-nav { display: none; }

body.is-app .app-bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-total);
  padding-bottom: var(--safe-bottom);
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 900;
  box-shadow: 0 -1px 0 rgba(0,0,0,.05), 0 -6px 20px rgba(0,0,0,.07);
}

.app-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #60A5FA;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px 6px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
  position: relative;
}

.app-nav-item svg {
  width: 23px;
  height: 23px;
  flex-shrink: 0;
  transition: transform 0.12s ease, stroke 0.15s ease;
}

/* Active indicator: small pill above the icon */
.app-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: #2563EB;
  border-radius: 0 0 3px 3px;
}

.app-nav-item.active { color: #2563EB; }
.app-nav-item.active svg { stroke: #2563EB; }

/* Tap press animation */
.app-nav-item:active svg { transform: scale(0.82); }

/* ═══════════════════════════════════════════════════════
   MORE SHEET (bottom drawer)
   ═══════════════════════════════════════════════════════ */
.app-more-sheet,
.app-more-overlay { display: none; }

body.is-app .app-more-sheet {
  display: block;
  position: fixed;
  bottom: calc(-100% - 120px);
  left: 0; right: 0;
  background: #F9FAFB;
  border-radius: 24px 24px 0 0;
  padding: 0 0 calc(20px + var(--safe-bottom));
  z-index: 1000;
  transition: bottom 0.36s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.18);
}

body.is-app .app-more-sheet.open { bottom: 0; }

.app-more-sheet__handle {
  width: 40px;
  height: 4px;
  background: #D1D5DB;
  border-radius: 2px;
  margin: 14px auto 20px;
}

/* Sheet title */
body.is-app .app-more-sheet::before {
  content: 'Menu';
  display: block;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #0F172A;
  padding: 0 24px 16px;
  border-bottom: 1px solid #E5E7EB;
  margin-bottom: 8px;
}

body.is-app .app-more-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  z-index: 999;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

body.is-app .app-more-overlay.open { display: block; }

.app-more-list {
  list-style: none;
  padding: 8px 16px 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 500;
  color: #111827;
  text-decoration: none;
  border-radius: 14px;
  background: #ffffff;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease;
  border: 1px solid rgba(0,0,0,0.05);
}

.app-more-item:active { background: #F3F4F6; }

/* Icon container: rounded square like iOS */
.app-more-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #EFF6FF;
}
.app-more-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #2563EB;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* App-mode back button (hidden on web) */
.app-back-btn { display: none; }
body.is-app .app-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  margin-right: 6px;
}
body.is-app .app-back-btn svg { stroke: #fff; fill: none; }

/* Quick-link icons: SVG sizing */
.app-quick-link-icon svg { width: 24px; height: 24px; }

/* About section in more sheet */
.app-more-about {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 0 16px 16px;
  border-bottom: 1px solid #E5E7EB;
  margin-bottom: 8px;
}
.app-more-about-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #EFF6FF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.app-more-about-name {
  font-size: 15px;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 4px;
}
.app-more-about-text {
  font-size: 13px;
  color: #64748B;
  line-height: 1.5;
  margin: 0;
}

/* Chevron on each item */
.app-more-item::after {
  content: '›';
  margin-left: auto;
  font-size: 18px;
  color: #D1D5DB;
  font-weight: 400;
}

/* ═══════════════════════════════════════════════════════
   CARDS & SECTIONS in app mode
   ═══════════════════════════════════════════════════════ */

/* Flight result cards: slightly more radius in app */
body.is-app .flight-card,
body.is-app .fc-wrap { border-radius: 18px !important; }

/* Destination cards */
body.is-app .dest-card { border-radius: 18px !important; }

/* Feature cards */
body.is-app .feature-card { border-radius: 18px !important; }

/* Section spacing — tighter in app */
body.is-app .section { padding: 28px 0; }

/* Popular section background */
body.is-app #popular { background: #F0F4F8 !important; }

/* ═══════════════════════════════════════════════════════
   EXPLORE PAGE
   ═══════════════════════════════════════════════════════ */
body.is-app .explore-hero {
  padding-top: 28px;
  margin-top: 0;
}

/* Explore body: respect safe area + nav height */
body.is-app .exp-body {
  padding-bottom: calc(var(--nav-total) + 24px) !important;
}

/* ═══════════════════════════════════════════════════════
   SECONDARY PAGES (about, help, privacy, terms)
   ═══════════════════════════════════════════════════════ */
body.is-app .page-hero,
body.is-app .page-header {
  padding-top: calc(24px + var(--safe-top));
}

/* ═══════════════════════════════════════════════════════
   RESULTS PAGE (search-detail.html)
   ═══════════════════════════════════════════════════════ */
body.is-app .results-search-header {
  padding-top: 8px;
}

/* Filter sidebar: extra bottom padding for nav bar */
body.is-app .filter-sidebar {
  padding-bottom: calc(var(--nav-total) + 16px);
}

/* ═══════════════════════════════════════════════════════
   GLOBAL APP POLISH
   ═══════════════════════════════════════════════════════ */

/* Momentum scrolling throughout */
body.is-app { -webkit-overflow-scrolling: touch; }

/* Bigger counter buttons in pax picker on mobile */
body.is-app .pax-dec,
body.is-app .pax-inc {
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
}

/* Search button: full-width, taller in app */
body.is-app .btn-search,
body.is-app .search-bar .btn-search {
  min-height: 52px;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

/* Widget tabs: pill style */
body.is-app .widget-tab { padding: 8px 20px; font-size: .8125rem; }

/* ═══════════════════════════════════════════════════════
   APP PAGE TOPBAR (secondary pages: privacy, terms, etc.)
   ═══════════════════════════════════════════════════════ */
.app-page-topbar { display: none; }
body.is-app .app-page-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(14px + var(--safe-top)) 16px 14px;
  background: linear-gradient(135deg, #0d1f4a 0%, #14307a 45%, #2563EB 100%);
}
body.is-app .app-page-topbar + header { display: none !important; }
.app-page-topbar-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: #fff;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
