:root {
  --bg: #0a0b10;
  --bg-2: #11131c;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f5fa;
  --muted: #9aa0b5;
  --gold: #f5c451;
  --gold-2: #e0962b;
  --violet: #7c5cff;
  --cyan: #34d6e8;
  --green: #36d399;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --radius: 18px;
}

* { box-sizing: border-box; }

/* iOS: fonte >= 16px nos campos evita o zoom automático ao focar */
input, textarea, select { font-size: 16px; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(120% 90% at 50% -10%, #161a2b 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(40% 40% at 15% 10%, rgba(124, 92, 255, 0.18), transparent 70%),
    radial-gradient(35% 35% at 85% 5%, rgba(245, 196, 81, 0.14), transparent 70%);
  z-index: 0;
  transform: translateZ(0);
  will-change: transform;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px clamp(16px, 4vw, 48px);
  /* Safe area: no modo app (PWA) não há barra do navegador — o conteúdo
     desceria para trás da barra de status do celular sem este respiro. */
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  background: rgba(10, 11, 16, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

/* Instalado como app: um respiro extra além da safe area. */
@media (display-mode: standalone) {
  .site-header { padding-top: calc(28px + env(safe-area-inset-top, 0px)); }
}

.brand { display: flex; flex-direction: column; gap: 5px; }

.brand-logo-wrap { margin: 0; line-height: 0; }
.brand-logo {
  display: block;
  height: clamp(34px, 5vw, 44px);
  max-height: 44px;
  width: auto;
  max-width: 200px;
  aspect-ratio: 807.98 / 200.65;
}

.tagline { margin: 0; color: var(--muted); font-size: 0.8rem; padding-left: 2px; }

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 320px;
  max-width: 460px;
}

.search-icon {
  position: absolute;
  left: 16px;
  width: 19px;
  height: 19px;
  color: var(--muted);
  pointer-events: none;
}

#search {
  width: 100%;
  padding: 13px 16px 13px 46px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
#search::placeholder { color: var(--muted); }
#search:focus {
  border-color: var(--gold);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px rgba(245, 196, 81, 0.12);
}
/* esconde o "x" nativo do input[type=search] (usamos o nosso) */
#search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.clear-btn {
  position: absolute;
  right: 12px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.clear-btn:hover { background: rgba(255, 255, 255, 0.14); color: var(--text); }
.clear-btn[hidden] { display: none; }

.count {
  position: absolute;
  right: 14px;
  font-size: 0.78rem;
  color: var(--muted);
  pointer-events: none;
}

/* ---------- Grid ---------- */
main { position: relative; z-index: 1; padding: clamp(20px, 4vw, 40px); max-width: 1280px; margin: 0 auto; }

/* Filtro por aliança */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.f-chip {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.f-chip:hover { background: var(--surface-2); color: var(--text); }
.f-chip.active {
  color: #1a1408;
  font-weight: 700;
  background: linear-gradient(145deg, var(--gold), var(--gold-2));
  border-color: transparent;
}

/* Selo de aliança */
.al-chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.al-star { color: #c6ccd9; border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.08); }
.al-oneworld { color: #a3b8f8; border-color: rgba(63, 98, 210, 0.6); background: rgba(30, 58, 138, 0.45); }
.al-skyteam { color: #8fc6ff; border-color: rgba(125, 190, 255, 0.45); background: rgba(125, 190, 255, 0.12); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  cursor: pointer;
  text-align: center;
  content-visibility: auto;
  contain-intrinsic-size: 0 216px;
  transition: transform 0.16s ease, border-color 0.16s, box-shadow 0.16s;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--violet));
  opacity: 0;
  transition: opacity 0.16s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.card:hover::before { opacity: 1; }
.card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.logo-box {
  width: 150px;
  height: 108px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  overflow: hidden;
}
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }

.avatar {
  width: 150px;
  height: 108px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 1.9rem;
  color: #fff;
  letter-spacing: 0.5px;
}

.card-name {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.25;
}

/* skeleton */
@keyframes shimmer { to { background-position: -220% 0; } }

/* peça base de shimmer reutilizável */
.sk {
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
  border-radius: 8px;
}

/* card skeleton — mesma caixa do .card para não dar layout shift */
.skeleton-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.skeleton-card .sk-logo { width: 150px; height: 108px; border-radius: 14px; }
.skeleton-card .sk-name { width: 70%; height: 16px; }
.skeleton-card .sk-chip { width: 90px; height: 18px; border-radius: 999px; }

/* modal skeleton */
.modal-skel { padding-top: 2px; }
.modal-skel .sk-head { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.modal-skel .sk-logo { width: 96px; height: 70px; border-radius: 14px; flex: none; }
.modal-skel .sk-h2 { width: 170px; max-width: 60vw; height: 22px; }
.modal-skel .sk-pill { width: 64px; height: 16px; border-radius: 999px; margin-top: 9px; }
.modal-skel .sk-section { margin-top: 24px; }
.modal-skel .sk-title { width: 140px; height: 12px; margin-bottom: 14px; }
.modal-skel .sk-bar { height: 44px; border-radius: 12px; margin-bottom: 8px; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 1.05rem; }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px calc(18px + env(safe-area-inset-bottom, 0px));
}
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 5, 9, 0.72); backdrop-filter: blur(6px); }

.modal-card {
  position: relative;
  width: min(720px, 100%);
  /* Limita à área segura: no PWA o card não pode passar atrás da barra
     de status (topo) nem da home bar (base). */
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 36px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 22px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #15182296, #0c0e15ee), var(--bg-2);
  box-shadow: var(--shadow);
  animation: pop 0.18s ease;
}
@keyframes pop { from { transform: translateY(12px) scale(0.98); opacity: 0; } }

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.14); border-color: var(--border-strong); }

.modal-body { padding: 28px clamp(20px, 4vw, 34px) 32px; }

.modal-head { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.modal-head .logo-box, .modal-head .avatar { width: 96px; height: 70px; }
.modal-head h2 {
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: clamp(1.3rem, 3.5vw, 1.8rem);
  margin: 0;
  letter-spacing: -0.02em;
}
.head-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 7px; }

.airline-nota {
  margin: 16px 0 0;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--gold);
  background: rgba(245, 196, 81, 0.08);
  border: 1px solid rgba(245, 196, 81, 0.25);
}
.modal-head .iata-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--gold);
  background: rgba(245, 196, 81, 0.12);
  border: 1px solid rgba(245, 196, 81, 0.3);
}

/* Sections */
.section { margin-top: 22px; }
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}
.section-title .dot { width: 10px; height: 10px; border-radius: 50%; }

.section-desc {
  margin: 0 0 12px 20px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 56ch;
}
.s-disp .dot { background: var(--cyan); }
.s-ferr .dot { background: var(--violet); }
.s-cod  .dot { background: var(--gold); }
.s-emis .dot { background: var(--green); }

.items { display: flex; flex-direction: column; gap: 8px; }

.item {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.item-name { font-weight: 600; font-size: 0.95rem; }
.item .note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  margin-right: 6px;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--gold);
  background: rgba(245, 196, 81, 0.1);
  border: 1px solid rgba(245, 196, 81, 0.22);
}
.item .note::before { content: "ⓘ"; font-size: 0.8rem; }

/* Destaque "Melhor opção" */
.best-chip {
  display: inline-block;
  margin-left: 9px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #1a1408;
  background: linear-gradient(145deg, var(--gold), var(--gold-2));
  vertical-align: 2px;
}
.item.is-best { border-color: rgba(245, 196, 81, 0.35); }

/* Ficha de regras de cancelamento do programa */
.prog { margin-top: 9px; }
.prog + .prog { margin-top: 5px; }
.prog summary {
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--muted);
  user-select: none;
  transition: color 0.15s;
}
.prog summary:hover { color: var(--text); }
.prog ul {
  margin: 8px 0 2px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

/* Assentos em tarifa award */
.s-seats .dot { background: #ff96a8; }
.seats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.seat-chip {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.seat-num {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  border-radius: 11px;
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: var(--gold);
  background: var(--surface-2);
  border: 1px solid rgba(245, 196, 81, 0.3);
}
.seat-cabin { font-weight: 600; font-size: 0.9rem; }
.seat-info .note { font-size: 0.74rem; }
.seats-obs {
  margin: 12px 0 0;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--muted);
}

.children {
  margin-top: 10px;
  padding-left: 14px;
  border-left: 2px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.child {
  font-size: 0.88rem;
  color: var(--text);
}
.child .tag {
  display: inline-block;
  margin-right: 7px;
  font-size: 0.66rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.child .note { display: flex; width: fit-content; font-size: 0.74rem; margin-top: 5px; }

/* Promo de ferramenta paga (discreto) */
.tool-promo {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.promo-tip {
  margin: 0 0 7px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted);
}
.btn-assinar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.btn-assinar:hover { border-bottom-color: var(--gold); }

/* Codes */
.codes { display: flex; flex-wrap: wrap; gap: 10px; }
.code-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.code-chip .cabin { font-size: 0.9rem; font-weight: 500; }
.code-chip .letter {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border-radius: 9px;
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: #11131c;
}
.cab-eco  .letter { background: linear-gradient(145deg, #6fe3b8, var(--green)); }
.cab-prem .letter { background: linear-gradient(145deg, #34d6e8, #2aa6d6); color: #07212a; }
.cab-exec .letter { background: linear-gradient(145deg, #b69bff, var(--violet)); color: #fff; }
.cab-first .letter { background: linear-gradient(145deg, var(--gold), var(--gold-2)); }

.modal-loading, .modal-error { padding: 40px 0; text-align: center; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 36px 16px 48px;
  color: var(--muted);
  font-size: 0.82rem;
  max-width: 680px;
  margin: 0 auto;
}

.suggest {
  margin-bottom: 30px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--border);
}
.suggest-text {
  margin: 0 0 14px;
  font-size: 0.95rem;
  color: var(--text);
}
.btn-suggest {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gold);
  text-decoration: none;
  border: 1px solid rgba(245, 196, 81, 0.4);
  background: rgba(245, 196, 81, 0.07);
  transition: background 0.16s, border-color 0.16s, transform 0.16s;
}
.btn-suggest:hover {
  background: rgba(245, 196, 81, 0.14);
  border-color: var(--gold);
  transform: translateY(-2px);
}

.copyright { margin: 0 0 10px; font-size: 0.85rem; color: var(--text); }
.legal {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--muted);
}

@media (max-width: 540px) {
  .brand { flex: 1; flex-direction: row; align-items: center; justify-content: space-between; }
  .tagline { padding-left: 0; }
  .filters { justify-content: center; gap: 6px; }
  .f-chip { padding: 7px 12px; font-size: 0.76rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .logo-box, .avatar, .skeleton-card .sk-logo { width: 118px; height: 84px; }
  .avatar { font-size: 1.5rem; }
  .card { contain-intrinsic-size: 0 190px; }
  .search-wrap { max-width: none; order: 3; flex-basis: 100%; }
}
