/* Apostilas Cebolitos - Dark Mode / Vermelho Neon */
:root {
  --bg: #050505;
  --bg-2: #0a0a0d;
  --surface: #111116;
  --border: #1f1f28;
  --neon: #ff1a1a;
  --neon-2: #e50914;
  --neon-glow: rgba(255, 26, 26, 0.35);
  --neon-soft: rgba(255, 26, 26, 0.12);
  --silver: #e2e8f0;
  --white: #ffffff;
  --muted: #94a3b8;
  --radius: 16px;
  --nav-h: 68px;
  --font: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 8px); }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--silver);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.neon { color: var(--neon); text-shadow: 0 0 18px var(--neon-glow); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--silver); font-weight: 600; font-size: 0.92rem;
  cursor: pointer; transition: all .18s ease; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--neon); color: var(--white); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn--primary {
  background: linear-gradient(135deg, var(--neon), var(--neon-2));
  border-color: var(--neon); color: var(--white);
  box-shadow: 0 0 22px var(--neon-glow);
}
.btn--primary:hover:not(:disabled) { box-shadow: 0 0 32px rgba(255,26,26,.6); transform: translateY(-1px); }
.btn--ghost { background: transparent; }
.btn--lg { padding: 16px 38px; font-size: 1.1rem; border-radius: 14px; }
.btn:focus-visible, .icon-btn:focus-visible, select:focus-visible, input:focus-visible, .item:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--neon); outline-offset: 2px;
}

/* ---------- Landing ---------- */
.landing {
  position: relative; min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 32px 20px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, #140506 0%, var(--bg) 60%);
}
.landing__glow {
  position: absolute; width: 700px; height: 700px; max-width: 120vw; max-height: 120vw;
  top: 50%; left: 50%; transform: translate(-50%, -55%);
  background: radial-gradient(circle, rgba(255,26,26,.22) 0%, rgba(255,26,26,.06) 40%, transparent 70%);
  pointer-events: none; animation: pulse 5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .75; } 50% { opacity: 1; } }
.landing__content { position: relative; z-index: 1; max-width: 640px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.landing__logo { width: clamp(120px, 22vw, 190px); height: auto; filter: drop-shadow(0 0 28px var(--neon-glow)); }
.landing__title { font-size: clamp(2.2rem, 7vw, 4rem); font-weight: 800; color: var(--white); letter-spacing: -0.02em; line-height: 1.05; }
.landing__desc { color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.15rem); max-width: 520px; }
.landing .btn--lg { margin-top: 10px; }

/* ---------- Navbar ---------- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 clamp(16px, 4vw, 40px);
  background: rgba(5,5,5,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transform: translateY(-100%); transition: transform .35s ease;
}
.navbar.is-visible { transform: translateY(0); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--white); font-size: 1.05rem; }
.brand__logo { width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 0 8px var(--neon-glow)); }
.navbar__right { display: flex; align-items: center; gap: 12px; }
.search {
  display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 42px; width: min(300px, 38vw);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--muted);
  transition: border-color .18s;
}
.search:focus-within { border-color: var(--neon); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--white); font-size: .92rem; }
.search input::placeholder { color: #64748b; }

/* ---------- Catálogo ---------- */
.catalog { max-width: 1120px; margin: 0 auto; padding: calc(var(--nav-h) + 56px) clamp(16px, 4vw, 32px) 96px; min-height: 100vh; }
.catalog__head { margin-bottom: 32px; }
.eyebrow { display: inline-block; color: var(--neon); font-weight: 700; font-size: .8rem; letter-spacing: .22em; text-shadow: 0 0 14px var(--neon-glow); }
.catalog__title { font-size: clamp(2rem, 5vw, 3rem); color: var(--white); font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 8px; }
.catalog__sub { color: var(--muted); font-size: 1.02rem; }

.tabs { display: flex; gap: 8px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 28px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; background: none; border: 0; padding: 14px 20px; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: 1rem; white-space: nowrap; transition: color .18s;
}
.tab:hover { color: var(--white); }
.tab.is-active { color: var(--white); }
.tab.is-active::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px;
  background: var(--neon); box-shadow: 0 0 14px var(--neon-glow);
}

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.state { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 48px 0; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; transition: border-color .2s, box-shadow .2s; animation: rise .35s ease both;
}
.card:hover { border-color: var(--neon); box-shadow: 0 0 28px rgba(255,26,26,.12); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card__head { display: flex; align-items: center; gap: 14px; }
.card__icon {
  width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 12px;
  background: var(--neon-soft); border: 1px solid rgba(255,26,26,.3); color: var(--neon);
}
.card__title { flex: 1; font-size: 1.3rem; font-weight: 800; color: var(--white); }
.badge {
  padding: 5px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: var(--neon-soft); color: var(--neon); border: 1px solid rgba(255,26,26,.3); white-space: nowrap;
}
.card__vol { margin: 12px 0 14px 60px; font-size: .74rem; letter-spacing: .14em; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.card__vol:empty { display: none; }
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.card__vol + .list { margin-top: 0; }
.item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  padding: 13px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border);
  transition: all .18s;
}
.item:hover { border-color: var(--neon); background: #14090a; transform: translateX(2px); }
.item__doc { color: var(--silver); flex: none; }
.item__name { flex: 1; font-weight: 600; color: var(--white); }
.item__vol { font-size: .72rem; color: var(--muted); margin-left: 8px; font-weight: 500; }
.item__open { color: var(--muted); flex: none; transition: color .18s; }
.item:hover .item__open { color: var(--neon); }

/* ---------- Leitor ---------- */
.reader { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: var(--bg); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.reader__top, .reader__bottom {
  flex: none; display: flex; align-items: center; gap: 12px; padding: 10px clamp(12px, 3vw, 24px);
  background: var(--bg-2); border-color: var(--border); border-style: solid; border-width: 0;
}
.reader__top { border-bottom-width: 1px; }
.reader__bottom { border-top-width: 1px; justify-content: space-between; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.reader__titles { flex: 1; min-width: 0; }
.reader__title { font-weight: 800; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader__sub { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zoom { display: flex; gap: 6px; }
.icon-btn {
  min-width: 38px; height: 38px; padding: 0 10px; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--silver); font-weight: 700; font-size: 1.05rem;
  transition: all .18s;
}
.icon-btn:hover { border-color: var(--neon); color: var(--white); }
.icon-btn--wide { font-size: .82rem; }

.reader__stage {
  position: relative; flex: 1; min-height: 0; overflow: auto; display: flex;
  background: radial-gradient(ellipse at center, #0e0e12 0%, #060608 100%); padding: 16px;
}
.reader__stage img {
  display: block; margin: auto; background: #fff; border-radius: 4px; user-select: none;
  box-shadow: 0 8px 40px rgba(0,0,0,.7), 0 0 0 1px var(--border);
  transition: opacity .12s;
}
.reader__stage.fit img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; min-width: 0; min-height: 0; }
.reader__stage.zoomed img { max-width: none; max-height: none; height: auto; flex: none; }
.reader__stage img.is-loading { opacity: .25; }

.spinner {
  position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border: 3px solid var(--border); border-top-color: var(--neon); border-radius: 50%;
  animation: spin .7s linear infinite; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.spinner.on { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

.pager { display: flex; align-items: center; gap: 10px; }
.pager__label { color: var(--muted); font-size: .85rem; }
.pager select {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; color: var(--white); font-weight: 600; max-width: 180px; cursor: pointer;
}
.pager select:hover { border-color: var(--neon); }
.pager__total { color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* ---------- Responsivo ---------- */
@media (max-width: 800px) {
  .grid { grid-template-columns: 1fr; }
  .brand__text { display: none; }
  .search { width: 100%; flex: 1; }
  .navbar__right { flex: 1; justify-content: flex-end; }
  .card__vol { margin-left: 0; }
}
@media (max-width: 640px) {
  .hide-sm, .pager__label, .pager__total { display: none; }
  .reader__top { flex-wrap: wrap; }
  .reader__titles { order: 1; flex-basis: calc(100% - 140px); }
  .zoom { order: 3; }
  #reader-download { order: 2; padding: 9px 12px; font-size: .85rem; }
  .btn { padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* =========================================================
   UPGRADE VISUAL CEBOLITOS - LOGO SEAMLESS & EFEITOS NEON
   ========================================================= */

/* 1. Corrige o quadrado preto da logo e adiciona flutuação + brilho neon */
img[src*="logo-cebolitos"] {
  border-radius: 50% !important;
  mix-blend-mode: lighten !important;
  -webkit-mask-image: radial-gradient(circle, #000 62%, transparent 72%) !important;
  mask-image: radial-gradient(circle, #000 62%, transparent 72%) !important;
  object-fit: cover !important;
  background: transparent !important;
  box-shadow: none !important;
  filter: drop-shadow(0 0 16px rgba(255, 26, 26, 0.55));
  transition: transform 0.35s ease, filter 0.35s ease;
}

:not(nav):not(header) > img[src*="logo-cebolitos"],
.hero img[src*="logo-cebolitos"],
.landing img[src*="logo-cebolitos"] {
  animation: cebolitosFloat 4s ease-in-out infinite, cebolitosPulse 3s ease-in-out infinite alternate;
}

img[src*="logo-cebolitos"]:hover {
  transform: scale(1.06);
  filter: drop-shadow(0 0 26px rgba(255, 26, 26, 0.85));
}

@keyframes cebolitosFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-9px); }
}

@keyframes cebolitosPulse {
  0% { filter: drop-shadow(0 0 14px rgba(255, 26, 26, 0.45)); }
  100% { filter: drop-shadow(0 0 28px rgba(255, 26, 26, 0.85)); }
}

/* 2. Fundo com grade sutil tecnológica */
body {
  background-color: #050507;
  background-image:
    radial-gradient(circle at 50% 28%, rgba(255, 26, 26, 0.14) 0%, transparent 55%),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 100% 100%, 42px 42px, 42px 42px;
  background-position: center center;
}

/* 3. Brilho neon no título e feixe de luz no botão principal */
h1 span, .brand-highlight, .text-accent, .accent {
  text-shadow: 0 0 24px rgba(255, 26, 26, 0.5);
}

button, .btn, .btn-primary, a[class*="btn"] {
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease !important;
}

.btn-primary:hover, #btn-ver-apostilas:hover, button[class*="primary"]:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 28px rgba(255, 26, 26, 0.65) !important;
}

.btn-primary::after, #btn-ver-apostilas::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-25deg);
  transition: left 0.55s ease;
}

.btn-primary:hover::after, #btn-ver-apostilas:hover::after {
  left: 140%;
}

/* 4. Efeito Glassmorphism e elevação nos cards do catálogo */
.serie-card, .card, [class*="serie-card"] {
  background: rgba(17, 17, 22, 0.85) !important;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.07) !important;
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease !important;
}

.serie-card:hover, .card:hover, [class*="serie-card"]:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 26, 26, 0.55) !important;
  box-shadow: 0 12px 32px rgba(255, 26, 26, 0.14) !important;
}

/* 5. Scrollbar dark + vermelho neon */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #070709;
}
::-webkit-scrollbar-thumb {
  background: #2a1215;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #ff1a1a;
}

/* =========================================================
   ESTILIZAÇÃO PREMIUM DO LEITOR DE APOSTILAS
   ========================================================= */

/* Container geral do leitor */
[id*="reader"], [id*="leitor"], [class*="reader"], [class*="leitor"] {
  backdrop-filter: blur(14px);
}

/* Barras superior e inferior do leitor */
[id*="reader"] header, [id*="leitor"] header,
[class*="reader-header"], [class*="leitor-header"],
[class*="reader-top"], [class*="leitor-top"] {
  background: rgba(10, 10, 14, 0.92) !important;
  border-bottom: 1px solid rgba(255, 26, 26, 0.32) !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.65);
}

[id*="reader"] footer, [id*="leitor"] footer,
[class*="reader-footer"], [class*="leitor-footer"],
[class*="reader-controls"], [class*="leitor-controls"],
[class*="reader-bottom"], [class*="leitor-bottom"] {
  background: rgba(10, 10, 14, 0.94) !important;
  border-top: 1px solid rgba(255, 26, 26, 0.32) !important;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.65);
}

/* Moldura da imagem da página (efeito folha física elevada) */
[id*="reader"] img, [id*="leitor"] img,
[class*="reader-stage"] img, [class*="leitor-stage"] img,
[class*="page-view"] img, [class*="pagina-img"] {
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.88),
    0 0 32px rgba(255, 26, 26, 0.12) !important;
  transition: transform 0.22s ease, opacity 0.2s ease !important;
}

/* Seletor de páginas ("Escolher página") */
[id*="reader"] select, [id*="leitor"] select,
[class*="reader"] select, [class*="leitor"] select {
  background-color: #14141c !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 26, 26, 0.45) !important;
  border-radius: 8px !important;
  padding: 6px 12px !important;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[id*="reader"] select:focus, [id*="leitor"] select:focus,
[class*="reader"] select:focus, [class*="leitor"] select:focus {
  outline: none !important;
  border-color: #ff1a1a !important;
  box-shadow: 0 0 0 3px rgba(255, 26, 26, 0.28) !important;
}

/* Botões de navegação e Zoom do leitor */
[id*="reader"] button, [id*="leitor"] button,
[class*="reader"] button, [class*="leitor"] button {
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  transition: all 0.2s ease !important;
}

[id*="reader"] button:not(:disabled):hover,
[id*="leitor"] button:not(:disabled):hover,
[class*="reader"] button:not(:disabled):hover,
[class*="leitor"] button:not(:disabled):hover {
  border-color: #ff1a1a !important;
  box-shadow: 0 0 16px rgba(255, 26, 26, 0.4) !important;
  transform: translateY(-1px);
}

/* Destaque para o botão Baixar PDF */
a[href*="download"], button[id*="download"], [class*="download"] {
  background: linear-gradient(135deg, #ff1a1a 0%, #b80000 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 100, 100, 0.4) !important;
  box-shadow: 0 4px 18px rgba(255, 26, 26, 0.35) !important;
}

a[href*="download"]:hover, button[id*="download"]:hover, [class*="download"]:hover {
  box-shadow: 0 6px 26px rgba(255, 26, 26, 0.65) !important;
  transform: translateY(-1px);
}

/* =========================================================
   EFEITOS ESPECIAIS DO LEITOR - CEBOLITOS READER FX
   ========================================================= */

/* 1. Iluminação de palco atrás da página */
[id*="reader"] main, [id*="leitor"] main,
[class*="reader-stage"], [class*="leitor-stage"],
[class*="reader-body"], [class*="leitor-body"],
[class*="page-container"], [class*="pagina-container"] {
  background: radial-gradient(circle at 50% 48%, rgba(255, 26, 26, 0.09) 0%, transparent 68%) !important;
}

/* 2. Animação de virada de página */
@keyframes cebolitosPageTurn {
  0% {
    opacity: 0.25;
    transform: perspective(1200px) rotateY(-3.5deg) translateX(14px) scale(0.985);
    filter: brightness(0.85);
  }
  100% {
    opacity: 1;
    transform: perspective(1200px) rotateY(0deg) translateX(0) scale(1);
    filter: brightness(1);
  }
}

.cebolitos-page-anim {
  animation: cebolitosPageTurn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* 3. Borda luminosa sutil ao passar o mouse na folha */
[id*="reader"] img:not([src*="logo-cebolitos"]):hover,
[id*="leitor"] img:not([src*="logo-cebolitos"]):hover,
[class*="reader"] img:not([src*="logo-cebolitos"]):hover,
[class*="leitor"] img:not([src*="logo-cebolitos"]):hover {
  border-color: rgba(255, 26, 26, 0.38) !important;
  box-shadow:
    0 26px 65px rgba(0, 0, 0, 0.92),
    0 0 38px rgba(255, 26, 26, 0.22) !important;
}

/* 4. Barra de progresso de leitura neon */
#cebolitos-read-progress-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  pointer-events: none;
}

#cebolitos-read-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #b80000, #ff1a1a, #ff6b6b);
  box-shadow: 0 0 12px rgba(255, 26, 26, 0.85);
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 5. Feedback de clique e brilho nos botões do leitor */
[id*="reader"] button:not(:disabled):active,
[id*="leitor"] button:not(:disabled):active,
[class*="reader"] button:not(:disabled):active,
[class*="leitor"] button:not(:disabled):active,
a[href*="download"]:active {
  transform: scale(0.95) !important;
}
