/* ============================================
   MangaVerse - Dark Theme Elegant Manga Reader
   ============================================ */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --bg-elevated: #1e1e2a;
  --bg-input: #1a1a26;
  --border: #2a2a3a;
  --border-light: #333346;
  --text-primary: #e8e8f0;
  --text-secondary: #9898b0;
  --text-muted: #6a6a82;
  --accent: #7c5cfc;
  --accent-hover: #9478ff;
  --accent-glow: rgba(124, 92, 252, 0.3);
  --accent-soft: rgba(124, 92, 252, 0.12);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --gradient-accent: linear-gradient(135deg, #7c5cfc, #c084fc);
  --gradient-card: linear-gradient(180deg, transparent 0%, rgba(10,10,15,0.95) 100%);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s ease;
  --nav-height: 60px;
  --bottom-nav-height: 70px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  padding-top: var(--nav-height);
  padding-bottom: var(--bottom-nav-height);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Reader page: no nav padding */
body.page-reader {
  padding-top: var(--nav-height);
  padding-bottom: 80px;
}

body.page-reader .main-content {
  padding: 0;
  max-width: none;
}

img {
  max-width: 100%;
  display: block;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ==========================================
   TOP NAV
   ========================================== */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
  transition: var(--transition);
}

.logo:hover { color: var(--accent-hover); }
.logo svg { flex-shrink: 0; }

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

.nav-links a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}

.nav-links a:hover { color: var(--text-primary); background: var(--accent-soft); }
.nav-links a.active { color: var(--accent); background: var(--accent-soft); }

/* ==========================================
   BOTTOM NAV (Mobile)
   ========================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
}

.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item:active { transform: scale(0.92); }

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 16px;
  min-height: calc(100vh - var(--nav-height) - var(--bottom-nav-height));
}

/* ==========================================
   SECTION HEADERS
   ========================================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title .icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.section-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  transition: var(--transition);
}

.section-link:hover { color: var(--accent-hover); }

section { margin-bottom: 40px; }

/* ==========================================
   MANGA CARDS
   ========================================== */
.manga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.manga-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  transition: var(--transition);
  cursor: pointer;
}

.manga-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.manga-card:active { transform: translateY(-2px) scale(0.98); }

.manga-card-cover {
  position: relative;
  aspect-ratio: 193 / 278;
  overflow: hidden;
  background: var(--bg-secondary);
}

.manga-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.manga-card:hover .manga-card-cover img { transform: scale(1.05); }

.manga-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 30px 8px 8px;
  background: var(--gradient-card);
}

.manga-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-ongoing { background: rgba(74, 222, 128, 0.2); color: var(--success); }
.badge-completed { background: rgba(124, 92, 252, 0.2); color: var(--accent); }
.badge-chapter { background: rgba(0,0,0,0.6); color: var(--text-primary); }

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

.manga-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-primary);
}

.manga-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.manga-card-meta svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ==========================================
   HERO / FEATURED SLIDER
   ========================================== */
.hero-section {
  position: relative;
  margin: -20px -16px 30px;
  overflow: hidden;
}

.hero-slider {
  display: flex;
  overflow: hidden;
  position: relative;
  gap: 0;
}

.hero-slider::-webkit-scrollbar { display: none; }

.hero-slide {
  min-width: 100%;
  flex-shrink: 0;
  position: relative;
  height: 280px;
  overflow: hidden;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-slide-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(20px) brightness(0.3);
  transform: scale(1.2);
}

.hero-slide-content {
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 24px;
  height: 100%;
  gap: 20px;
}

.hero-slide-cover {
  width: 120px;
  height: 170px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow-lg);
}

.hero-slide-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-slide-info {
  flex: 1;
  min-width: 0;
}

.hero-slide-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-slide-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.genre-tag {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(124, 92, 252, 0.2);
}

.hero-slide-stats {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.hero-slide-stats svg { width: 14px; height: 14px; }

.hero-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px;
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.hero-dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--accent);
}

/* ==========================================
   HORIZONTAL SCROLL ROW
   ========================================== */
.scroll-row {
  display: flex;
  overflow-x: auto;
  gap: 14px;
  padding-bottom: 8px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.scroll-row::-webkit-scrollbar { display: none; }

.scroll-row .manga-card {
  min-width: 140px;
  max-width: 140px;
  scroll-snap-align: start;
}

/* ==========================================
   LISTS SECTION
   ========================================== */
.lists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.list-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.list-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.list-card-cover {
  width: 70px;
  height: 90px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-secondary);
}

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

.list-card-info { flex: 1; min-width: 0; }

.list-card-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.list-card-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.list-card-meta {
  display: flex;
  gap: 12px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ==========================================
   TOP READERS
   ========================================== */
.readers-row {
  display: flex;
  overflow-x: auto;
  gap: 16px;
  scrollbar-width: none;
  padding-bottom: 8px;
}

.readers-row::-webkit-scrollbar { display: none; }

.reader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 80px;
  text-align: center;
}

.reader-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  padding: 2px;
}

.reader-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.reader-avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
}

.reader-name {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-secondary);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-xp {
  font-size: 0.6rem;
  color: var(--accent);
  font-weight: 600;
}

/* ==========================================
   EXPLORE PAGE
   ========================================== */
.explore-header {
  margin-bottom: 24px;
}

.search-container {
  position: relative;
  margin-bottom: 16px;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

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

.search-input::placeholder { color: var(--text-muted); }

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.filter-chip:hover { border-color: var(--accent); color: var(--text-primary); }
.filter-chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.load-more-btn {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 24px auto 0;
  padding: 12px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.load-more-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================
   SERIES DETAIL PAGE
   ========================================== */
.series-hero {
  position: relative;
  margin: -20px -16px 24px;
  padding: 24px;
  min-height: 300px;
  display: flex;
  align-items: flex-end;
  gap: 20px;
  overflow: hidden;
}

.series-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  filter: blur(25px) brightness(0.25) saturate(1.4);
  transform: scale(1.3);
}

.series-hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-primary) 0%, transparent 50%, rgba(10,10,15,0.4) 100%);
}

.series-cover {
  position: relative;
  width: 140px;
  height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow-lg);
}

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

.series-info {
  position: relative;
  flex: 1;
  min-width: 0;
}

.series-type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.series-title {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
}

.series-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.series-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.series-meta-item svg { width: 14px; height: 14px; flex-shrink: 0; }

.series-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--warning);
}

.series-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.series-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
}

.series-description.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.desc-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.series-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--gradient-accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* Chapters List */
.chapters-section {
  margin-top: 10px;
}

.chapters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chapters-count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chapters-sort {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}

.chapters-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chapter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}

.chapter-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
}

.chapter-item.read {
  opacity: 0.5;
}

.chapter-num {
  font-size: 0.9rem;
  font-weight: 600;
}

.chapter-title {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-left: 8px;
}

.chapter-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ==========================================
   READER PAGE
   ========================================== */
.reader-container {
  max-width: 900px;
  margin: 0 auto;
}

.reader-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1001;
  transition: transform 0.3s ease;
}

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

.reader-back {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
}

.reader-chapter-info {
  text-align: center;
  flex: 1;
}

.reader-chapter-title {
  font-size: 0.85rem;
  font-weight: 600;
}

.reader-chapter-num {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.reader-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.reader-pages img {
  width: 100%;
  max-width: 900px;
  display: block;
  margin: 0;
  padding: 0;
}

.reader-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 1001;
  transition: transform 0.3s ease;
  border-top: 1px solid var(--border);
}

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

.reader-nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.reader-nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.reader-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.reader-progress {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.reader-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
  color: var(--text-secondary);
}

/* Reader end card */
.reader-end-card {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 16px;
  text-align: center;
}

.end-card-inner {
  padding: 30px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

/* Chapter drawer */
.chapter-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.chapter-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.chapter-drawer {
  position: fixed;
  right: -320px;
  top: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--bg-secondary);
  z-index: 2001;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
}

.chapter-drawer.open { right: 0; }

.chapter-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.chapter-drawer-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.chapter-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.chapter-drawer-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.chapter-drawer-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.chapter-drawer-item.current {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* ==========================================
   LIBRARY PAGE
   ========================================== */
.library-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  text-align: center;
  color: var(--text-muted);
  gap: 16px;
}

.library-empty svg {
  width: 64px;
  height: 64px;
  opacity: 0.3;
}

.library-empty p { font-size: 0.9rem; }

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.library-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
}

.library-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.library-card-cover {
  width: 70px;
  height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-secondary);
}

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

.library-card-info { flex: 1; min-width: 0; }

.library-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.library-card-progress {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.library-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.library-card-btn:hover { background: var(--accent); color: white; }

/* ==========================================
   404 PAGE
   ========================================== */
.page-404 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: 16px;
}

.page-404 h1 {
  font-size: 4rem;
  font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ==========================================
   LOADING / SKELETON
   ========================================== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================
   ANIMATIONS
   ========================================== */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

/* ==========================================
   RESPONSIVE
   ========================================== */

/* Hide bottom nav on desktop, hide nav-links on mobile */
@media (min-width: 769px) {
  .bottom-nav { display: none; }
  body { padding-bottom: 0; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }

  .hero-slide { height: 240px; }
  .hero-slide-cover { width: 100px; height: 140px; }
  .hero-slide-title { font-size: 1rem; }

  .series-hero { padding: 16px; flex-direction: column; align-items: center; text-align: center; min-height: auto; }
  .series-cover { width: 120px; height: 170px; }
  .series-title { font-size: 1.2rem; }
  .series-meta { justify-content: center; }
  .series-genres { justify-content: center; }
  .series-actions { justify-content: center; }
  .series-description { text-align: left; }

  .manga-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
  .manga-card-title { font-size: 0.72rem; }

  .lists-grid { grid-template-columns: 1fr; }
  .library-grid { grid-template-columns: 1fr; }

  .section-title { font-size: 1.1rem; }
}

@media (min-width: 1024px) {
  .manga-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

  .hero-slide { height: 340px; }
  .hero-slide-cover { width: 160px; height: 230px; }
  .hero-slide-title { font-size: 1.6rem; }

  .series-cover { width: 180px; height: 260px; }
  .series-title { font-size: 1.8rem; }
}

/* Reader toast notification */
.reader-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.reader-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================
   LIST DETAIL PAGE
   ========================================== */
.list-detail-header {
  display: flex;
  gap: 20px;
  padding: 24px 0;
  align-items: flex-start;
}
.list-detail-cover {
  width: 120px;
  height: 160px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-secondary);
}
.list-detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.list-detail-info {
  flex: 1;
  min-width: 0;
}
.list-detail-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.list-detail-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}
.list-detail-meta {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.list-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  padding: 8px 16px;
}

/* List series grid */
.list-detail-series {
  padding-bottom: 32px;
}
.list-series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}
.list-series-card {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}
.list-series-card:hover {
  transform: translateY(-4px);
}
.list-series-cover {
  position: relative;
  aspect-ratio: 3/4;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
  margin-bottom: 8px;
}
.list-series-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.list-reading-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  background: rgba(99, 102, 241, 0.9);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  text-align: center;
  backdrop-filter: blur(4px);
}
.list-series-title {
  font-size: 0.8rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-series-progress {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================
   LIBRARY - SAVED LISTS SECTION
   ========================================== */
.library-section {
  margin-bottom: 24px;
}
.library-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-primary);
}
.library-lists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.library-list-card {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}
.library-list-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}
.library-list-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.library-list-cover {
  width: 50px;
  height: 65px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-secondary);
}
.library-list-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.library-list-info {
  flex: 1;
  min-width: 0;
}
.library-list-name {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-list-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.library-list-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 12px;
  transition: color 0.2s;
  flex-shrink: 0;
}
.library-list-remove:hover {
  color: var(--danger);
}

@media (max-width: 600px) {
  .list-detail-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .list-detail-meta {
    justify-content: center;
  }
  .list-series-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
  }
  .library-lists-grid {
    grid-template-columns: 1fr;
  }
}
