/* ============================================================
   Radar de Passagens — sistema de design "painel de embarque noturno"
   Fraunces (display) · Manrope (corpo) · Space Mono (códigos/preços)
   ============================================================ */

:root {
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;

  /* Paleta base (dark = padrão) */
  --bg: #0b1020;
  --bg-deep: #070a16;
  --surface: rgba(22, 29, 51, 0.72);
  --surface-solid: #161d33;
  --surface-2: rgba(30, 39, 66, 0.6);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);

  --ink: #eef1fb;
  --ink-soft: #aab3d4;
  --ink-faint: #6b769b;

  --amber: #f5a623;
  --amber-soft: #ffcf7a;
  --sky: #5ac8fa;
  --mint: #4fd1a5;
  --rose: #ff6b81;

  --accent: var(--amber);
  --accent-ink: #1a1205;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -22px rgba(0, 0, 0, 0.75);
  --shadow-soft: 0 10px 30px -18px rgba(0, 0, 0, 0.6);
  --ring: 0 0 0 3px rgba(245, 166, 35, 0.28);
}

:root[data-theme="light"] {
  --bg: #f4f1ea;
  --bg-deep: #e9e4d8;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-2: rgba(255, 255, 255, 0.6);
  --line: rgba(20, 24, 40, 0.1);
  --line-strong: rgba(20, 24, 40, 0.18);

  --ink: #17203a;
  --ink-soft: #4a5678;
  --ink-faint: #8a93ad;

  --amber: #c9791a;
  --amber-soft: #b9691a;
  --accent: #b45309;
  --accent-ink: #fff7ec;

  --shadow: 0 26px 60px -30px rgba(40, 30, 10, 0.4);
  --shadow-soft: 0 10px 26px -16px rgba(40, 30, 10, 0.28);
  --ring: 0 0 0 3px rgba(180, 83, 9, 0.24);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 78% -12%, rgba(245, 166, 35, 0.14), transparent 55%),
    radial-gradient(1000px 620px at 8% 6%, rgba(90, 200, 250, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Textura de grão + aurora atmosférica */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.4;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}
.aurora {
  position: fixed; inset: -20% -10% auto -10%; height: 60vh; z-index: 0; pointer-events: none;
  background: radial-gradient(600px 300px at 70% 30%, rgba(79, 209, 165, 0.1), transparent 60%);
  filter: blur(20px);
}

.main { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 40px 24px 80px; }
.main--auth { max-width: 460px; display: flex; flex-direction: column; justify-content: center; min-height: 100vh; padding-block: 48px; }

/* ---------- Navegação ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 16px clamp(18px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(140deg, var(--amber), var(--amber-soft));
  color: var(--accent-ink); font-size: 18px; transform: rotate(-8deg);
  box-shadow: 0 8px 20px -8px rgba(245, 166, 35, 0.7);
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -0.01em; }
.brand-name em { font-style: italic; color: var(--ink-faint); font-weight: 400; padding: 0 2px; }

.nav-links { display: flex; gap: 6px; margin-left: 8px; }
.nav-links a {
  padding: 8px 14px; border-radius: 999px; text-decoration: none;
  color: var(--ink-soft); font-weight: 600; font-size: 14px; transition: 0.18s;
}
.nav-links a:hover { color: var(--ink); background: var(--surface-2); }
.nav-links a.is-active { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }

.nav-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.nav-user { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.nav-logout { font-size: 13px; color: var(--ink-faint); text-decoration: none; border-bottom: 1px solid transparent; }
.nav-logout:hover { color: var(--ink); border-bottom-color: var(--line-strong); }

.theme-toggle {
  width: 44px; height: 26px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface-2); cursor: pointer; position: relative; padding: 0; transition: 0.2s;
}
.theme-toggle-dot {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(140deg, var(--amber), var(--amber-soft)); transition: 0.25s cubic-bezier(.5,.1,.2,1);
}
:root[data-theme="light"] .theme-toggle-dot { transform: translateX(18px); background: linear-gradient(140deg, #1b2440, #3a4568); }

/* ---------- Cabeçalho de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 30px; flex-wrap: wrap; }
.eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 8px;
}
h1.title { font-family: var(--font-display); font-weight: 600; font-size: clamp(30px, 5vw, 46px); line-height: 1.02; letter-spacing: -0.02em; margin: 0; }
.title em { font-style: italic; color: var(--ink-soft); }
.subtitle { color: var(--ink-soft); margin: 10px 0 0; max-width: 52ch; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--font-body); font-weight: 700; font-size: 14.5px;
  padding: 12px 20px; border-radius: 999px; border: 1px solid transparent; text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.2s, background 0.2s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: linear-gradient(135deg, var(--amber), var(--amber-soft)); color: var(--accent-ink); box-shadow: 0 12px 28px -12px rgba(245, 166, 35, 0.7); }
.btn--primary:hover { box-shadow: 0 16px 34px -12px rgba(245, 166, 35, 0.85); }
.btn--ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn--block { width: 100%; justify-content: center; }
.btn--danger:hover { border-color: var(--rose); color: var(--rose); }

/* ---------- Cartões (boarding pass) ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }

.pass {
  position: relative; background: var(--surface); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow-soft); overflow: hidden;
  animation: rise 0.5s both;
}
.pass::before { /* recorte lateral do bilhete */
  content: ""; position: absolute; top: 0; bottom: 0; left: 66%;
  border-left: 2px dashed var(--line-strong); opacity: 0.5;
}
.pass.is-paused { opacity: 0.62; }
.pass:hover { border-color: var(--line-strong); }

.pass-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.pass-label { font-size: 12px; color: var(--ink-faint); font-family: var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; }

.route { display: flex; align-items: center; gap: 14px; }
.iata { font-family: var(--font-mono); font-weight: 700; font-size: 30px; letter-spacing: 0.02em; color: var(--ink); }
.route-line { flex: 1; height: 1px; background: repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 12px); position: relative; }
.route-line::after { content: "✈"; position: absolute; right: -4px; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: 13px; }

.pass-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip {
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line);
}

.pass-prices { display: flex; gap: 22px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.price-block .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-faint); font-family: var(--font-mono); }
.price-block .v { font-family: var(--font-mono); font-weight: 700; font-size: 21px; margin-top: 3px; }
.v--target { color: var(--ink); }
.v--hit { color: var(--mint); }
.v--over { color: var(--ink-soft); }
.v--none { color: var(--ink-faint); font-size: 15px; }

.status-dot { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; }
.status-dot i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-hit { background: var(--mint); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mint) 22%, transparent); }
.dot-watch { background: var(--amber); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 20%, transparent); }
.dot-paused { background: var(--ink-faint); }

.spark { margin-top: 16px; height: 40px; width: 100%; overflow: visible; }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark path.area { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: none; }
.spark .target { stroke: var(--mint); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.7; }

.pass-actions { display: flex; gap: 8px; margin-top: 18px; }
.icon-btn {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft);
  border-radius: 10px; padding: 7px 11px; font-size: 13px; cursor: pointer; text-decoration: none; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; transition: 0.16s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--accent); }
.icon-btn--danger:hover { color: var(--rose); border-color: var(--rose); }
.pass-actions form { display: inline; }

/* ---------- Estado vazio ---------- */
.empty {
  text-align: center; padding: 70px 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface); backdrop-filter: blur(8px);
}
.empty .big { font-size: 46px; margin-bottom: 10px; }
.empty h3 { font-family: var(--font-display); font-size: 24px; margin: 0 0 8px; font-weight: 600; }
.empty p { color: var(--ink-soft); margin: 0 auto 22px; max-width: 40ch; }

/* ---------- Formulários / cartão de auth ---------- */
.card {
  background: var(--surface); backdrop-filter: blur(14px); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(24px, 4vw, 38px); box-shadow: var(--shadow);
}
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; max-width: 900px; }
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 19px; margin: 0 0 18px; letter-spacing: -0.01em; }

.auth-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 26px; }
.auth-brand .brand-mark { width: 40px; height: 40px; font-size: 21px; }
.auth-brand .brand-name { font-size: 22px; }

.form-grid { display: grid; gap: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 13px; font-weight: 700; color: var(--ink-soft); letter-spacing: 0.01em; }
.field .hint { font-size: 12px; color: var(--ink-faint); }

.input, .select {
  width: 100%; font-family: var(--font-body); font-size: 15px; color: var(--ink);
  background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 12px 14px; transition: 0.16s; appearance: none;
}
.input::placeholder { color: var(--ink-faint); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input--mono { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a93ad' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}

/* Autocomplete de aeroportos */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; max-height: 260px; overflow-y: auto;
  background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); display: none;
}
.combo-list.open { display: block; }
.combo-item { padding: 10px 14px; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.combo-item:hover, .combo-item.active { background: var(--surface-2); }
.combo-item .code { font-family: var(--font-mono); font-weight: 700; color: var(--accent); min-width: 42px; }
.combo-item .desc { font-size: 13.5px; color: var(--ink-soft); }

/* Seletor de tipo (ida / ida-volta) */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 4px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: block; padding: 8px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); transition: 0.16s; }
.segmented input:checked + span { background: var(--accent); color: var(--accent-ink); }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Chips selecionáveis (dias da semana / companhias) */
.pillset { display: flex; flex-wrap: wrap; gap: 8px; }
.pillset--wrap { max-height: 168px; overflow-y: auto; padding: 2px; }
.pill { position: relative; cursor: pointer; user-select: none; }
.pill input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.pill span {
  display: block; padding: 8px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--line); transition: 0.14s;
}
.pill span:hover { border-color: var(--line-strong); color: var(--ink); }
.pill input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.pill input:focus-visible + span { box-shadow: var(--ring); }

.form-actions { display: flex; gap: 12px; margin-top: 6px; align-items: center; }
.form-actions .spacer { flex: 1; }

/* ---------- Flash ---------- */
.flash { padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-weight: 600; font-size: 14px; border: 1px solid; animation: rise 0.4s both; }
.flash--ok { background: color-mix(in srgb, var(--mint) 14%, transparent); border-color: color-mix(in srgb, var(--mint) 40%, transparent); color: var(--mint); }
.flash--err { background: color-mix(in srgb, var(--rose) 12%, transparent); border-color: color-mix(in srgb, var(--rose) 40%, transparent); color: var(--rose); }

.form-error { color: var(--rose); font-size: 13.5px; font-weight: 600; }

.auth-alt { text-align: center; margin-top: 20px; font-size: 14px; color: var(--ink-soft); }
.auth-alt a { color: var(--accent); font-weight: 700; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }

.note { font-size: 13px; color: var(--ink-faint); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.note b { color: var(--ink-soft); }

/* ---------- Animações ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.pass:nth-child(2) { animation-delay: 0.05s; }
.pass:nth-child(3) { animation-delay: 0.1s; }
.pass:nth-child(4) { animation-delay: 0.15s; }
.pass:nth-child(5) { animation-delay: 0.2s; }
.pass:nth-child(6) { animation-delay: 0.25s; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media (max-width: 640px) {
  .nav { gap: 8px 12px; padding: 12px 16px; flex-wrap: wrap; }
  .nav-links { margin-left: 0; }
  .nav-links a { padding: 7px 12px; font-size: 13px; }
  .nav-user { display: none; }               /* nome some, mas Alertas/Ajustes/Sair continuam */
  .brand-name { font-size: 16px; }
  .nav-right { gap: 10px; }
  .row2 { grid-template-columns: 1fr; }
  .pass::before { display: none; }
  .page-head { align-items: flex-start; }
  .main { padding: 24px 16px 64px; }
}

/* Ajuste fino p/ telas bem estreitas */
@media (max-width: 380px) {
  .brand-name em { display: none; }          /* "Radar Passagens" -> "Radar" fica so a marca */
  .iata { font-size: 26px; }
}
