/* ==========================================================================
   tema.css — sistema de design do Questões de Aviação
   Carregado DEPOIS do <style> de cada página: muda só a aparência
   (cores, fontes, vidro, sombras, botões). Não muda layout nem funções.
   Cor principal: verde escuro #2f4f2f.
   ========================================================================== */

:root {
  --verde: #2f4f2f;
  --verde-claro: #3f6f3f;
  --verde-profundo: #1f3a24;
  --verde-menta: #e7f0e7;
  --cor-destaque: #d4a017;
  --tema-texto: #172017;
  --tema-texto-suave: #4b574b;
  --tema-vidro: rgba(255, 255, 255, 0.66);
  --tema-vidro-forte: rgba(255, 255, 255, 0.84);
  --tema-borda-vidro: rgba(255, 255, 255, 0.78);
  --tema-sombra: 0 1px 2px rgba(16, 32, 16, 0.06), 0 12px 40px rgba(16, 32, 16, 0.12);
  --tema-sombra-alta: 0 2px 4px rgba(16, 32, 16, 0.08), 0 24px 60px rgba(16, 32, 16, 0.18);
  --tema-raio: 22px;
  --fonte-titulo: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --fonte-texto: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }

/* ---------- Tipografia ---------- */
body {
  font-family: var(--fonte-texto) !important;
  -webkit-font-smoothing: antialiased;
  background-color: #eef2ee !important;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--fonte-titulo) !important; letter-spacing: -0.3px; }
button, input, select, textarea { font-family: inherit; }
.btn, .btn-main, .btn-login, .btn-primario, .btn-secundario { font-family: var(--fonte-titulo) !important; }

/* Títulos principais com degradê verde */
h1:not(.sr-only) {
  background: linear-gradient(135deg, var(--verde-profundo) 0%, var(--verde) 45%, #4f8a4f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  text-shadow: none !important;
  letter-spacing: -0.8px;
  text-wrap: balance;
}

/* ---------- Fundo: foto da cabine + véu verde + luzes suaves ---------- */
/* Imagens leves (geradas a partir de background.jpeg, que fica guardado como original):
   - fundo-1920.webp/.jpg  → computador e tablet (horizontal, ~130 KB)
   - fundo-celular.webp/.jpg → celular em pé (recorte do centro da foto, ~120 KB)
   O navegador usa o WebP; navegadores antigos ficam com o JPEG.
   Se trocar a foto, gere os 4 arquivos de novo com outros nomes (as imagens ficam em cache por 30 dias). */
body::before {
  content: "" !important;
  position: fixed !important;
  inset: 0 !important;
  width: auto !important; height: auto !important;
  background:
    linear-gradient(180deg, rgba(238,242,238,0.74) 0%, rgba(238,242,238,0.58) 40%, rgba(31,58,36,0.34) 100%),
    url('fundo-1920.jpg') no-repeat center center / cover !important;
  background:
    linear-gradient(180deg, rgba(238,242,238,0.74) 0%, rgba(238,242,238,0.58) 40%, rgba(31,58,36,0.34) 100%),
    -webkit-image-set(url('fundo-1920.webp') type('image/webp'), url('fundo-1920.jpg') type('image/jpeg')) no-repeat center center / cover !important;
  background:
    linear-gradient(180deg, rgba(238,242,238,0.74) 0%, rgba(238,242,238,0.58) 40%, rgba(31,58,36,0.34) 100%),
    image-set(url('fundo-1920.webp') type('image/webp'), url('fundo-1920.jpg') type('image/jpeg')) no-repeat center center / cover !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
  z-index: -2 !important;
  pointer-events: none;
}
@media (max-width: 820px) and (orientation: portrait) {
  body::before {
    background:
      linear-gradient(180deg, rgba(238,242,238,0.74) 0%, rgba(238,242,238,0.58) 40%, rgba(31,58,36,0.34) 100%),
      url('fundo-celular.jpg') no-repeat center center / cover !important;
    background:
      linear-gradient(180deg, rgba(238,242,238,0.74) 0%, rgba(238,242,238,0.58) 40%, rgba(31,58,36,0.34) 100%),
      -webkit-image-set(url('fundo-celular.webp') type('image/webp'), url('fundo-celular.jpg') type('image/jpeg')) no-repeat center center / cover !important;
    background:
      linear-gradient(180deg, rgba(238,242,238,0.74) 0%, rgba(238,242,238,0.58) 40%, rgba(31,58,36,0.34) 100%),
      image-set(url('fundo-celular.webp') type('image/webp'), url('fundo-celular.jpg') type('image/jpeg')) no-repeat center center / cover !important;
  }
}
/* Celulares: luzes do fundo paradas (a animação pesa em aparelhos mais simples) */
@media (max-width: 820px) {
  body::after { animation: none !important; }
}
body::after {
  content: "";
  position: fixed; inset: -20%;
  background:
    radial-gradient(40% 35% at 20% 25%, rgba(92,160,92,0.26), transparent 70%),
    radial-gradient(35% 30% at 80% 15%, rgba(212,160,23,0.13), transparent 70%),
    radial-gradient(45% 40% at 70% 85%, rgba(47,79,47,0.28), transparent 70%);
  filter: blur(30px);
  animation: tema-aurora 22s ease-in-out infinite alternate;
  z-index: -1;
  pointer-events: none;
}
@keyframes tema-aurora {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(3%, -2%, 0) scale(1.05); }
  100% { transform: translate3d(-3%, 2%, 0) scale(1); }
}

/* ---------- Cartões de vidro ---------- */
.card, .login-card, .post-card, .exam-card, .info-box, .tutorial-card,
.intro-container, .questao-card, details.revisao, .linha-materia,
.tabela-pagina, .vidro {
  background: var(--tema-vidro-forte) !important;
  border: 1px solid var(--tema-borda-vidro) !important;
  border-radius: var(--tema-raio) !important;
  box-shadow: var(--tema-sombra), inset 0 1px 0 rgba(255,255,255,0.9) !important;
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
}
/* largura conta o espaçamento interno (corrige a rolagem lateral no celular
   nas páginas de formulário: cadastro, fale conosco, comunicar erro) */
.card, .login-card, .post-card, .exam-card, .info-box, .tutorial-card,
input:not([type="radio"]):not([type="checkbox"]), select, textarea { box-sizing: border-box; }

.post-card, .info-box, .tutorial-card, .exam-card {
  transition: transform 0.3s cubic-bezier(.2,.8,.2,1), box-shadow 0.3s;
}
.post-card:hover, .info-box:hover, .tutorial-card:hover, .exam-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--tema-sombra-alta), inset 0 1px 0 rgba(255,255,255,0.9) !important;
}

/* Cabeçalhos em "chip" de vidro (matérias, tutoriais, quiz…) */
.title-card {
  background: var(--tema-vidro) !important;
  border: 1px solid var(--tema-borda-vidro) !important;
  border-radius: var(--tema-raio) !important;
  box-shadow: var(--tema-sombra) !important;
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
}
.accent {
  height: 5px !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, var(--verde-claro), var(--cor-destaque)) !important;
  box-shadow: none !important;
}

/* ---------- Botões ---------- */
.btn:not(.btn-secundario), .btn-main.btn-questoes, .btn-login, .btn-primario, #btn-enviar {
  position: relative;
  overflow: hidden;
  color: #fff !important;
  background: linear-gradient(135deg, var(--verde-claro) 0%, var(--verde) 50%, var(--verde-profundo) 100%) !important;
  border: none !important;
  font-weight: 700 !important;
  letter-spacing: -0.1px;
  box-shadow: 0 8px 22px rgba(47, 79, 47, 0.32), inset 0 1px 0 rgba(255,255,255,0.18) !important;
  transition: transform 0.2s cubic-bezier(.2,.8,.2,1), box-shadow 0.2s, filter 0.2s !important;
}
.btn-main { position: relative; overflow: hidden; }
.btn-main.btn-simulado {
  background: linear-gradient(135deg, #6b8540, #556b2f 60%, #43562a) !important;
  box-shadow: 0 8px 22px rgba(85, 107, 47, 0.32), inset 0 1px 0 rgba(255,255,255,0.18) !important;
}
/* brilho que atravessa o botão no hover */
.btn:not(.btn-secundario)::after, .btn-main::after, .btn-login::after, .btn-primario::after {
  content: "";
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.32), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
  pointer-events: none;
}
.btn:not(.btn-secundario):hover:not(:disabled), .btn-main:hover:not(:disabled),
.btn-login:hover:not(:disabled), .btn-primario:hover:not(:disabled) {
  transform: translateY(-2px) !important;
  filter: brightness(1.06);
  box-shadow: 0 14px 32px rgba(47, 79, 47, 0.42), inset 0 1px 0 rgba(255,255,255,0.2) !important;
}
.btn:not(.btn-secundario):hover::after, .btn-main:hover::after, .btn-login:hover::after, .btn-primario:hover::after { left: 120%; }
.btn:active, .btn-main:active, .btn-login:active, .btn-primario:active { transform: translateY(0) scale(0.99) !important; }
.btn:disabled, .btn-main:disabled, .btn-login:disabled {
  background: #cfd5cf !important;
  box-shadow: none !important;
  transform: none !important;
  filter: none !important;
}
.btn:focus-visible, .btn-main:focus-visible, .btn-login:focus-visible, .btn-primario:focus-visible,
.btn-secundario:focus-visible, a:focus-visible {
  outline: 3px solid rgba(92,160,92,0.6);
  outline-offset: 3px;
}
.btn.btn-secundario, .btn-secundario {
  background: var(--tema-vidro-forte) !important;
  color: var(--verde) !important;
  border: 1.5px solid rgba(47,79,47,0.3) !important;
  box-shadow: 0 2px 8px rgba(16,32,16,0.06) !important;
  font-weight: 700 !important;
  transition: background 0.2s, border-color 0.2s, transform 0.2s !important;
}
.btn.btn-secundario:hover, .btn-secundario:hover { background: #fff !important; border-color: rgba(47,79,47,0.5) !important; }
.btn-voltar, .btn-voltar:hover { background: transparent !important; border: none !important; box-shadow: none !important; }

/* ---------- Campos de formulário ---------- */
input:not([type="radio"]):not([type="checkbox"]):not([type="range"]), select, textarea {
  border: 1.5px solid #d3d9d3;
  border-radius: 12px !important;
  background-color: rgba(255,255,255,0.95);
  font-size: 16px; /* evita zoom automático no iPhone */
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:not([type="radio"]):not([type="checkbox"]):focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--verde-claro) !important;
  box-shadow: 0 0 0 4px rgba(63,111,63,0.15) !important;
}

/* ---------- Tabelas ---------- */
table thead, table th { background: var(--verde-menta) !important; color: var(--verde-profundo) !important; font-family: var(--fonte-titulo); }
.licenca-title {
  background: linear-gradient(135deg, var(--verde-claro), var(--verde-profundo)) !important;
  border-radius: 16px !important;
  font-family: var(--fonte-titulo);
  font-weight: 700;
}
table tbody tr:nth-child(odd) { background-color: rgba(231,240,231,0.55) !important; }
table tbody tr:nth-child(even) { background-color: rgba(255,255,255,0.7) !important; }
table tr.total, table .total { background: rgba(47,79,47,0.12) !important; color: var(--verde-profundo); }

/* ---------- Detalhes de cada página ---------- */
.tag { background: var(--verde-menta) !important; color: var(--verde) !important; border-radius: 999px !important; }
.post-date { color: var(--verde-claro) !important; letter-spacing: 0.3px; }
.option-btn { border-radius: 14px; }
.selo { background: linear-gradient(135deg, var(--verde-claro), var(--verde-profundo)) !important; }

/* Luz que acompanha o mouse nos cartões (só computador) */
.vidro, .card, .login-card, .post-card, .info-box, .tutorial-card { --mx: 50%; --my: -20%; }
@media (hover: hover) {
  .post-card, .info-box, .tutorial-card {
    background-image: radial-gradient(420px circle at var(--mx) var(--my), rgba(92,160,92,0.10), transparent 45%) !important;
  }
}

/* ---------- Ajustes para celular ---------- */
@media (max-width: 600px) {
  /* Estatísticas: a tabela desliza para o lado em vez de quebrar as palavras letra por letra */
  .table-estatisticas thead, .table-estatisticas tbody, .table-estatisticas tr { min-width: 560px; }
  .table-estatisticas th, .table-estatisticas td { word-break: normal !important; overflow-wrap: normal; }

  /* Cronômetro dos simulados vira uma barra no rodapé (não cobre o título nem as questões) */
  #cronometro-container {
    top: auto !important; bottom: 0 !important; left: 0 !important; right: 0 !important;
    border-radius: 0 !important; border-width: 1px 0 0 !important;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px;
    padding: 6px 16px calc(6px + env(safe-area-inset-bottom)) !important;
    background: rgba(255,255,255,0.9) !important;
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  }
  #cronometro-container #cronometro { margin-bottom: 0 !important; }
  #cronometro-container .btn { margin: 0 !important; padding: 7px 14px !important; }
  .main-content { padding-bottom: 96px !important; }
}

/* ---------- Animação ao rolar (só com JavaScript; sem JS tudo aparece) ---------- */
.js .revelar { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(.2,.8,.2,1); }
.js .revelar.visivel { opacity: 1; transform: none; }

/* ---------- Acessibilidade ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::after { animation: none; }
  .js .revelar { opacity: 1; transform: none; transition: none; }
  *, *::after { transition: none !important; }
}
