/* NovelBR — CSS */

/* ─── Tema padrão: Escuro ─── */
:root,
[data-theme="dark"] {
  --bg: #0f0f13;
  --surface: #1a1a24;
  --surface2: #22222e;
  --accent: #c9a84c;
  --accent2: #e8c96a;
  --text: #e0e0e8;
  --text-muted: #888899;
  --reader-bg: #1a1a24;
  --reader-border: #2a2a3a;
  --panel-bg: #22222e;
  --panel-border: #333346;
  --btn-active-bg: #c9a84c;
  --btn-active-text: #000;
  --radius: 8px;
  --font: 'Segoe UI', system-ui, sans-serif;
  --font-read: Georgia, 'Times New Roman', serif;
}

/* ─── Tema Claro ─── */
[data-theme="light"] {
  --bg: #f5f5f0;
  --surface: #ffffff;
  --surface2: #ebebeb;
  --accent: #a07820;
  --accent2: #c9a030;
  --text: #1a1a1a;
  --text-muted: #666666;
  --reader-bg: #ffffff;
  --reader-border: #dddddd;
  --panel-bg: #f9f9f7;
  --panel-border: #cccccc;
  --btn-active-bg: #a07820;
  --btn-active-text: #fff;
}

/* ─── Tema Sépia ─── */
[data-theme="sepia"] {
  --bg: #f4efe8;
  --surface: #faf6ef;
  --surface2: #ede8df;
  --accent: #8b5e3c;
  --accent2: #a87748;
  --text: #3b2b1a;
  --text-muted: #7a6655;
  --reader-bg: #faf6ef;
  --reader-border: #d9cfc2;
  --panel-bg: #ede8df;
  --panel-border: #c8bfb2;
  --btn-active-bg: #8b5e3c;
  --btn-active-text: #fff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background .25s, color .25s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.main-content { flex: 1; padding: 2rem 1rem; }

/* ─── Header ─── */
.site-header {
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  padding: .8rem 0;
  position: sticky; top: 0; z-index: 100;
}
.site-header .container {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.logo { font-size: 1.6rem; font-weight: 800; color: var(--text); }
.logo span { color: var(--accent); }
.main-nav { display: flex; gap: 1rem; flex: 1; }
.main-nav a { color: var(--text-muted); font-size: .9rem; }
.main-nav a:hover { color: var(--accent); }
.search-form { display: flex; gap: .3rem; }
.search-form input {
  background: var(--surface2); border: 1px solid var(--reader-border);
  color: var(--text); border-radius: var(--radius);
  padding: .4rem .8rem; font-size: .9rem; width: 200px;
}
.search-form button {
  background: var(--accent); border: none; border-radius: var(--radius);
  padding: .4rem .8rem; cursor: pointer; font-size: .9rem; color: #000;
}

/* ─── Hero ─── */
.hero { text-align: center; padding: 3rem 0 2rem; }
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: .5rem; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--text-muted); font-size: 1.1rem; }

/* ─── Grid ─── */
.novels-grid h2 { margin-bottom: 1.5rem; font-size: 1.3rem; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.2rem;
}
.novel-card a {
  display: block; background: var(--surface);
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--reader-border); transition: transform .2s, border-color .2s;
  color: var(--text);
}
.novel-card a:hover { transform: translateY(-3px); border-color: var(--accent); }
.novel-card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
.no-cover {
  width: 100%; aspect-ratio: 2/3;
  background: linear-gradient(135deg, var(--surface2), var(--surface));
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; font-weight: 800; color: var(--accent);
}
.novel-info { padding: .6rem; }
.novel-info h3 { font-size: .85rem; line-height: 1.3; margin-bottom: .3rem; }
.genre, .chapters {
  font-size: .75rem; color: var(--text-muted);
  display: block; margin-top: .2rem;
}

/* ─── Novel Detail ─── */
.novel-header {
  display: flex; gap: 2rem; margin-bottom: 2rem; flex-wrap: wrap;
}
.novel-cover, .novel-cover-placeholder {
  width: 200px; min-width: 200px; border-radius: var(--radius);
}
.novel-cover { object-fit: cover; aspect-ratio: 2/3; }
.novel-cover-placeholder {
  aspect-ratio: 2/3;
  background: linear-gradient(135deg, var(--surface2), var(--surface));
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem; font-weight: 800; color: var(--accent);
  border: 1px solid var(--reader-border);
}
.novel-meta h1 { font-size: 2rem; margin-bottom: .5rem; }
.genre-badge {
  display: inline-block; background: var(--accent); color: var(--btn-active-text, #000);
  padding: .2rem .8rem; border-radius: 20px; font-size: .8rem;
  font-weight: 700; margin-bottom: .5rem;
}
.status, .total-chaps { color: var(--text-muted); margin-bottom: .3rem; }
.btn-read {
  display: inline-block; background: var(--accent); color: #000;
  padding: .6rem 1.5rem; border-radius: var(--radius);
  font-weight: 700; margin-top: 1rem;
  transition: background .2s;
}
.btn-read:hover { background: var(--accent2); color: #000; }
.btn-continue {
  display: inline-block; background: var(--surface2); color: var(--accent);
  padding: .6rem 1.5rem; border-radius: var(--radius);
  font-weight: 700; margin-top: .5rem; margin-left: .5rem;
  border: 1px solid var(--accent);
  transition: background .2s, color .2s;
}
.btn-continue:hover { background: var(--accent); color: #000; }
.synopsis { margin-bottom: 2rem; }
.synopsis h2 { margin-bottom: .5rem; }
.chapter-list h2 { margin-bottom: 1rem; }
.chapter-list ul { list-style: none; }
.chapter-list li {
  border-bottom: 1px solid var(--reader-border);
  padding: .5rem 0;
}
.chapter-list li a { color: var(--text); font-size: .95rem; }
.chapter-list li a:hover { color: var(--accent); }

/* ─── Chapter Reader ─── */
.breadcrumb { color: var(--text-muted); font-size: .85rem; margin-bottom: 1.5rem; }
.chapter-content {
  max-width: 780px; /* sobrescrito pelo JS */
  margin: 0 auto;
  transition: max-width .3s;
}
.chapter-content h1 { font-size: 1.5rem; margin-bottom: .3rem; }
.novel-title-sub { font-size: 1rem; font-weight: 400; color: var(--accent); margin-bottom: 1.5rem; }
.chapter-nav {
  display: flex; gap: 1rem; justify-content: center;
  margin: 1.5rem 0; flex-wrap: wrap;
}
.btn-nav {
  background: var(--surface2); color: var(--text);
  padding: .5rem 1.2rem; border-radius: var(--radius);
  border: 1px solid var(--reader-border); font-size: .9rem;
  transition: border-color .2s, color .2s;
}
.btn-nav:hover { border-color: var(--accent); color: var(--accent); }
.chapter-text {
  background: var(--reader-bg);
  padding: 2rem 2.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--reader-border);
  font-family: var(--font-read);
  font-size: 18px;      /* sobrescrito pelo JS */
  line-height: 1.9;     /* sobrescrito pelo JS */
  transition: background .25s, border-color .25s;
}
.chapter-text p {
  margin-bottom: 1.1em;
  text-indent: 1.5em;
}
.chapter-text p:first-child { text-indent: 0; }

/* ─── Barra de leitor (floating) ─── */
.reader-bar {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .5rem;
}

.reader-toggle {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0,0,0,.4);
  transition: transform .2s, background .2s;
  display: flex; align-items: center; justify-content: center;
}
.reader-toggle:hover { transform: scale(1.08); background: var(--accent2); }

.reader-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1rem;
  width: 270px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  display: none;
  flex-direction: column;
  gap: .85rem;
  transition: background .25s;
}
.reader-panel.open { display: flex; }

.reader-section {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.reader-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 600;
}

.reader-group {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}

/* Botões genéricos do painel */
.theme-btn, .family-btn, .width-btn, .spacing-btn, .ctrl-btn {
  flex: 1;
  min-width: 0;
  padding: .4rem .5rem;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--surface2);
  color: var(--text);
  font-size: .82rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.theme-btn:hover, .family-btn:hover,
.width-btn:hover, .spacing-btn:hover, .ctrl-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Botão ativo */
.theme-btn.active, .family-btn.active,
.width-btn.active, .spacing-btn.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-text);
  border-color: var(--btn-active-bg);
  font-weight: 700;
}

.ctrl-btn {
  font-size: .95rem;
  font-weight: 700;
  min-width: 44px;
  flex: 0 0 auto;
}

.reader-hint {
  font-size: .72rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: .2rem;
}

/* ─── Card meta (gênero + último cap) ─── */
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .3rem;
  margin-top: .3rem;
  flex-wrap: wrap;
}
.genre-tag {
  font-size: .7rem;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 4px;
  white-space: nowrap;
}
.last-chap {
  font-size: .7rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.count-badge {
  display: inline-block;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 400;
  padding: .1rem .6rem;
  border-radius: 20px;
  margin-left: .5rem;
  vertical-align: middle;
}

/* ─── Slots de anúncio ─── */
.ad-slot {
  width: 100%;
  min-height: 90px;
  background: var(--surface2);
  border-radius: var(--radius);
  border: 1px dashed var(--reader-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: .75rem;
  margin: 1rem 0;
}
.ad-slot:empty::after { content: 'Publicidade'; }

/* ─── Paginação de capítulos ─── */
.chap-pagination {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin: .8rem 0;
}
.pag-info { color: var(--text-muted); font-size: .85rem; }
.pag-jump { display: flex; gap: .4rem; }
.pag-jump input {
  background: var(--surface2); border: 1px solid var(--reader-border);
  color: var(--text); border-radius: var(--radius);
  padding: .35rem .6rem; font-size: .85rem; width: 90px;
}

/* ─── Search ─── */
.search-big { display: flex; gap: .5rem; margin: 1.5rem 0; }
.search-big input {
  flex: 1; background: var(--surface2); border: 1px solid var(--reader-border);
  color: var(--text); border-radius: var(--radius);
  padding: .6rem 1rem; font-size: 1rem;
}
.search-big button {
  background: var(--accent); border: none; border-radius: var(--radius);
  padding: .6rem 1.5rem; cursor: pointer; font-weight: 700; color: #000;
}

/* ─── Footer ─── */
.site-footer {
  background: var(--surface); border-top: 1px solid var(--reader-border);
  padding: 1.5rem 0; text-align: center;
  color: var(--text-muted); font-size: .85rem; margin-top: 3rem;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ─── Mobile ─── */
@media (max-width: 600px) {
  .main-nav { display: none; }
  .search-form input { width: 140px; }
  .novel-header { flex-direction: column; }
  .novel-cover, .novel-cover-placeholder { width: 140px; min-width: 140px; }
  .hero h1 { font-size: 1.8rem; }
  .chapter-text { padding: 1.2rem 1rem; }
  .reader-bar { bottom: 1rem; right: 1rem; }
  .reader-panel { width: 240px; }
}
