/* =============================================================
   MangaVerse — Hoja de estilos principal
   Estructura:
     1. Variables CSS (tokens de diseño)
     2. Reset & Base
     3. Navegación
     4. Botones
     5. Páginas (contenedor genérico)
     6. Página: Home (hero + secciones)
     7. Tarjetas de manga
     8. Página: Biblioteca (toolbar + filtros)
     9. Página: Detalle de manga
    10. Lista de capítulos
    11. Lector
    12. Panel de configuración del lector
    13. Modales y formularios
    14. Panel Admin
    15. Toast / notificaciones
    16. Utilidades
    17. Media queries
   ============================================================= */


/* ─── 1. Variables CSS ─────────────────────────────────────── */
:root {
  /* Colores de fondo */
  --bg: #0D0D0F;
  --surface: #13131A;
  --surface2: #1C1C28;
  --surface3: #252535;

  /* Acentos */
  --accent: #E94560;
  --accent2: #FF6B35;
  --accent-glow: rgba(233, 69, 96, 0.3);

  /* Texto */
  --text: #F0F0F5;
  --text-muted: #8888AA;

  /* Otros */
  --border: rgba(255, 255, 255, 0.08);
  --nav-h: 64px;
}


/* ─── 2. Reset & Base ──────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Grid decorativo de fondo */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 59px, rgba(255, 255, 255, 0.012) 59px, rgba(255, 255, 255, 0.012) 60px),
    repeating-linear-gradient(90deg, transparent, transparent 59px, rgba(255, 255, 255, 0.012) 59px, rgba(255, 255, 255, 0.012) 60px);
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 3px;
}


/* ─── 3. Navegación ────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: rgba(13, 13, 15, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
  z-index: 1000;
}

.nav-logo {
  font-family: 'Bangers', cursive;
  font-size: 28px;
  letter-spacing: 2px;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.nav-logo span {
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
  font-family: inherit;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--surface2);
}

.nav-link.active {
  color: var(--accent);
}

.nav-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  align-items: center;
  flex-shrink: 0;
}


/* ─── 4. Botones ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover {
  background: #ff5270;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--surface2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-danger {
  background: #c0392b;
  color: white;
}

.btn-danger:hover {
  background: #e74c3c;
}


/* ─── 5. Páginas (contenedor genérico) ─────────────────────── */
.page {
  display: none;
  padding-top: var(--nav-h);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.page.active {
  display: block;
}


/* ─── 6. Página: Home ──────────────────────────────────────── */
.hero {
  position: relative;
  padding: 80px 24px 60px;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(233, 69, 96, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

.hero h1 {
  font-family: 'Bangers', cursive;
  font-size: clamp(56px, 10vw, 100px);
  line-height: 0.95;
  letter-spacing: 3px;
  margin-bottom: 20px;
}

.hero h1 .line2 {
  color: var(--accent);
}

.hero p {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.section {
  padding: 48px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 28px;
}

.section-title {
  font-family: 'Bangers', cursive;
  font-size: 28px;
  letter-spacing: 1px;
}

.section-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  background: rgba(233, 69, 96, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.see-all {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  background: none;
  border: none;
  font-family: inherit;
}

.see-all:hover {
  color: var(--accent);
}


/* ─── 7. Tarjetas de manga ─────────────────────────────────── */
.manga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
}

.manga-card {
  cursor: pointer;
  transition: transform 0.2s;
  position: relative;
}

.manga-card:hover {
  transform: translateY(-4px);
}

.manga-card-cover {
  width: 100%;
  aspect-ratio: 5/7;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border);
}

.manga-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.manga-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 1;
}

.badge-new {
  background: var(--accent);
  color: white;
}

.badge-ongoing {
  background: #27ae60;
  color: white;
}

.badge-completed {
  background: #7f8c8d;
  color: white;
}

.badge-hiatus {
  background: #e67e22;
  color: white;
}

.badge-abandoned {
  background: #4a4a5a;
  color: #aaa;
}

.manga-card-info {
  padding: 10px 4px 0;
}

.manga-card-title {
  font-size: 11px;
  white-space: normal;
  overflow: visible;
}

.manga-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}


/* ─── 8. Página: Biblioteca ────────────────────────────────── */
.library-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
}

.search-box::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}

.filter-btn {
  padding: 10px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(233, 69, 96, 0.08);
}


/* ─── 9. Página: Detalle de manga ──────────────────────────── */
.manga-detail-hero {
  position: relative;
  padding: 40px 24px;
  display: flex;
  gap: 40px;
  align-items: flex-start;
  max-width: 1200px;
  margin: 0 auto;
}

.manga-detail-cover {
  flex-shrink: 0;
  width: 220px;
  aspect-ratio: 2/3;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);
  background: var(--surface2);
}

.manga-detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.manga-detail-info {
  flex: 1;
  padding-top: 8px;
}

.detail-genre-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.genre-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface2);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
}

.detail-title {
  font-family: 'Bangers', cursive;
  font-size: clamp(32px, 5vw, 52px);
  letter-spacing: 2px;
  line-height: 1;
  margin-bottom: 16px;
}

.detail-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.8;
  max-width: 600px;
  margin-bottom: 24px;
}

.detail-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 28px;
}

.stat {
  text-align: center;
}

.stat-num {
  font-family: 'Bangers', cursive;
  font-size: 28px;
  color: var(--accent);
  display: block;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: 'JetBrains Mono', monospace;
}


/* ─── 10. Lista de capítulos ────────────────────────────────── */
.chapter-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

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

.chapter-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.chapter-item:hover {
  background: var(--surface2);
  border-color: rgba(233, 69, 96, 0.4);
  transform: translateX(4px);
}

.chapter-item.chapter-read .chapter-num::after {
  content: ' ✓';
  color: #4caf50;
  font-size: 12px;
}

.chapter-thumb {
  width: 56px;
  height: 42px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.chapter-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chapter-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  min-width: 60px;
}

.chapter-title-text {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}

.chapter-date {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

.chapter-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.chapter-read-btn {
  font-size: 12px;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  flex-shrink: 0;
}


/* ─── 11. Lector ────────────────────────────────────────────── */
#page-reader {
  padding-top: 0;
  background: #000;
}

.reader-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1001;
  height: var(--nav-h);
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  transition: transform 0.3s;
}

.reader-topbar.hidden {
  transform: translateY(-100%);
}

.reader-manga-title {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.reader-chap-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  flex-shrink: 0;
}

.reader-spacer {
  flex: 1;
}

.reader-nav-btns {
  display: flex;
  gap: 6px;
}

.reader-page-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.reader-chap-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
  max-width: 160px;
}

.reader-canvas {
  padding-top: var(--nav-h);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-bottom: 100px;
}

.reader-page-img {
  width: 100%;
  max-width: 800px;
  display: block;
  cursor: pointer;
  user-select: none;
}

.reader-page-placeholder {
  width: 100%;
  max-width: 800px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
  min-height: 500px;
  font-size: 14px;
}

.reader-page-placeholder .page-num-big {
  font-family: 'Bangers', cursive;
  font-size: 80px;
  color: var(--surface3);
  line-height: 1;
}

.reader-page-placeholder .page-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.reader-bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1001;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  transition: transform 0.3s;
}

.reader-bottombar.hidden {
  transform: translateY(100%);
}

.reader-progress {
  width: 100%;
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  cursor: pointer;
  overflow: hidden;
}

.reader-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}

.reader-prev-chap,
.reader-next-chap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.reader-prev-chap:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.3);
  background: var(--surface3);
}

.reader-next-chap:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.reader-prev-chap:disabled,
.reader-next-chap:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Zonas de toque (izq/der) para navegar páginas */
.tap-zone {
  position: fixed;
  top: var(--nav-h);
  bottom: 80px;
  width: 30%;
  z-index: 100;
  cursor: pointer;
}

.tap-left {
  left: 0;
}

.tap-right {
  right: 0;
}

.reader-pdf-badge {
  background: rgba(233, 69, 96, 0.15);
  border: 1px solid rgba(233, 69, 96, 0.3);
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}


/* ─── 12. Panel de configuración del lector ─────────────────── */
.reader-config-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.reader-config-btn:hover,
.reader-config-btn.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.12);
}

.reader-config-panel {
  position: fixed;
  top: calc(var(--nav-h) + 8px);
  right: 12px;
  z-index: 1200;
  background: rgba(19, 19, 26, 0.97);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  width: 260px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
  display: none;
  flex-direction: column;
  gap: 16px;
}

.reader-config-panel.open {
  display: flex;
}

.cfg-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.cfg-brightness-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cfg-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--surface3);
  outline: none;
  cursor: pointer;
}

.cfg-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  cursor: pointer;
}

.cfg-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

.cfg-brightness-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  min-width: 38px;
  text-align: right;
}

.cfg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cfg-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}

.cfg-filter-btn {
  padding: 7px 4px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
}

.cfg-filter-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.cfg-filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}


/* ─── 13. Modales y formularios ─────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-title {
  font-family: 'Bangers', cursive;
  font-size: 28px;
  letter-spacing: 1px;
  margin-bottom: 24px;
}

.modal-title span {
  color: var(--accent);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 18px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-family: inherit;
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface3);
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  appearance: none;
  cursor: pointer;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Filas de URL de páginas */
.page-url-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.page-url-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.page-url-row input {
  flex: 1;
}

.page-url-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  min-width: 28px;
}

/* Pestañas de fuente (URL vs PDF) */
.source-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  background: var(--surface3);
  padding: 4px;
  border-radius: 8px;
}

.source-tab {
  flex: 1;
  padding: 7px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
  text-align: center;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-muted);
  transition: all 0.2s;
}

.source-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}



/* ─── 14. Panel Admin ───────────────────────────────────────── */
.admin-header {
  background: linear-gradient(135deg, var(--surface), var(--surface2));
  border-bottom: 1px solid var(--border);
  padding: 32px 24px;
}

.admin-title {
  font-family: 'Bangers', cursive;
  font-size: 36px;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.admin-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.admin-manga-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.admin-manga-card:hover {
  border-color: rgba(233, 69, 96, 0.4);
}

.admin-card-cover {
  height: 140px;
  background: var(--surface2);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bangers', cursive;
  font-size: 56px;
  color: var(--accent);
}

.admin-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-card-body {
  padding: 16px;
}

.admin-card-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
}

.admin-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 14px;
}

.admin-card-actions {
  display: flex;
  gap: 8px;
}


/* ─── 15. Toast / notificaciones ────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 14px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  max-width: 320px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-color: rgba(39, 174, 96, 0.5);
}

.toast.error {
  border-color: rgba(233, 69, 96, 0.5);
}


/* ─── 16. Utilidades ────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
  margin-bottom: 8px;
  transition: color 0.2s;
}

.back-btn:hover {
  color: var(--text);
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
}

.separator-line {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 32px;
}


/* ─── 17. Media queries ── */
/* ─── RESPONSIVE MÓVIL ─── */

@media (max-width: 640px) {

  /* NAV */
  nav {
    padding: 0 12px;
    gap: 8px;
  }

  .nav-logo {
    font-size: 22px;
  }

  .nav-links .nav-link:not(.active) {
    display: none;
  }

  /* HOME HERO */
  .hero {
    padding: 40px 16px 32px;
  }

  /* SECCIONES */
  .section {
    padding: 28px 16px;
  }

  /* GRID DE MANGAS: 2 columnas en móvil */
  .manga-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .manga-card-title {
    font-size: 11px;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .manga-card-meta {
    font-size: 10px;
  }

  /* DETALLE DEL MANGA */
  .manga-detail-hero {
    flex-direction: column;
    padding: 20px 16px;
    gap: 20px;
    align-items: center;
  }

  .manga-detail-cover {
    width: 160px;
  }

  .manga-detail-info {
    padding-top: 0;
    text-align: center;
  }

  .detail-genre-tags {
    justify-content: center;
  }

  .detail-stats {
    gap: 20px;
    justify-content: center;
  }

  .detail-desc {
    font-size: 13px;
  }

  /* LISTA DE CAPÍTULOS */
  .chapter-section {
    padding: 0 16px 60px;
  }

  .chapter-item {
    gap: 10px;
    padding: 12px 14px;
  }

  .chapter-date {
    display: none;
  }

  /* ahorra espacio */
  .chapter-title-text {
    font-size: 13px;
  }

  /* TOOLBAR BIBLIOTECA */
  .library-toolbar {
    gap: 8px;
  }

  .filter-btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* LECTOR */
  .reader-manga-title {
    display: none;
  }

  .reader-chap-select {
    max-width: 110px;
    font-size: 11px;
  }

  .reader-prev-chap,
  .reader-next-chap {
    padding: 8px 10px;
    font-size: 12px;
  }

  .reader-topbar {
    padding: 0 10px;
    gap: 8px;
  }

  /* MODALES */
  .modal-box {
    width: 95vw;
    max-width: 95vw;
    padding: 20px 16px;
    margin: 12px;
  }

  /* BOTONES */
  .btn {
    padding: 8px 14px;
    font-size: 12px;
  }
}


/* ═══════════════════════════════════════════════════════════
   SISTEMA DE GÉNEROS
   ═══════════════════════════════════════════════════════════ */

/* ── Selector de géneros en el modal de nuevo manga ──────── */

/* Contenedor que envuelve todos los chips del picker */
.genre-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: var(--surface3);
  border-radius: 8px;
  min-height: 44px;
  max-height: 160px;
  overflow-y: auto;
}

/* Chip individual: estado normal (no seleccionado) */
.genre-chip {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.genre-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* Chip seleccionado: se rellena con el color de acento */
.genre-chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ── Panel colapsable de géneros en la biblioteca ────────── */

/* Contenedor del panel completo */
.genre-panel {
  margin-top: 16px;
  margin-bottom: 24px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

/* Cabecera clicable: título + "(mostrar/ocultar)" */
.genre-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.genre-panel-header:hover {
  background: var(--surface3);
}

/* Título "🏷 Géneros" */
.genre-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
}

/* Texto pequeño "(mostrar/ocultar)" a la derecha */
.genre-panel-toggle {
  font-size: 12px;
  color: var(--text-muted);
}

/* Cuerpo con los chips, usa flex para el wrap */
.genre-panel-body {
  display: flex;
  padding: 10px 16px 14px;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid var(--border);
}

/* Fila de chips de filtro */
.genre-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Chip de filtro: estado normal */
.genre-filter-chip {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.genre-filter-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* Chip activo: resaltado en acento */
.genre-filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ── Modal de gestión de géneros ─────────────────────────── */

/* Fila de cada género en la lista del modal */
.genre-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface3);
  margin-bottom: 6px;
  transition: background 0.15s;
}

.genre-manage-row:hover {
  background: var(--surface2);
}

/* Nombre del género dentro de la fila */
.genre-manage-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════════
   UPLOAD — Drop zone de capítulos
   ═══════════════════════════════════════════════════════════ */

.up-drop-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface2);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}

.up-drop-zone:hover,
.up-drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.06);
}

/* Ocultar el input nativo del browser */
.up-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.drop-icon {
  font-size: 36px;
  margin-bottom: 10px;
  line-height: 1;
}

.up-drop-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.up-drop-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.upload-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  background: rgba(233, 69, 96, 0.15);
  border: 1px solid rgba(233, 69, 96, 0.35);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

/* Grid de previews: 5 columnas en desktop, fluye en móvil */
.up-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.up-preview-item {
  position: relative;
  aspect-ratio: 3/4;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface3);
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}

.up-preview-item:hover {
  border-color: var(--accent);
}

.up-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Número de página (esquina inferior izquierda) */
.up-preview-num {
  position: absolute;
  bottom: 4px;
  left: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

/* Indicador de estado (esquina superior derecha) */
.up-preview-status {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  pointer-events: none;
}

.up-preview-status.pending {
  background: rgba(0, 0, 0, 0.55);
  color: #aaa;
}

.up-preview-status.uploading {
  background: var(--accent);
  color: #fff;
  animation: spin 1s linear infinite;
}

.up-preview-status.done {
  background: #27ae60;
  color: #fff;
}

.up-preview-status.error {
  background: #c0392b;
  color: #fff;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Botón ✕ para eliminar una preview */
.up-preview-remove {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: background 0.15s;
}

.up-preview-item:hover .up-preview-remove {
  display: flex;
}

.up-preview-remove:hover {
  background: var(--accent);
}

/* Barra de progreso de subida */
.pdf-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.pdf-progress-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.pdf-progress-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent);
}

.pdf-progress-bar {
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
}

.pdf-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s;
  width: 0%;
}

.pdf-progress-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
}