/*
Theme Name: Manga Reader
Theme URI: https://mangareader.com
Author: Manga Reader Team
Author URI: https://mangareader.com
Description: A complete WordPress theme for reading manga/manhwa/manhua comics online with user registration, library management, and reading history.
Version: 1.0.0
Requires at least: 5.8
Tested up to: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: manga-reader
Tags: manga, manhwa, manhua, comics, reading, dark-mode
*/

:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.15);
  --accent: #f59e0b;
  --accent-pink: #ec4899;
  --bg-dark: #0a0a14;
  --bg-darker: #0f0f1c;
  --bg-card: #161625;
  --bg-card-hover: #1e1e32;
  --bg-input: #1a1a2e;
  --bg-input-focus: #1e1e35;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #1e293b;
  --border-light: #2d3750;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  --gradient-dark: linear-gradient(180deg, #0a0a14 0%, #0f0f1c 100%);
  --gradient-card: linear-gradient(145deg, #161625 0%, #141420 100%);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: all 0.2s ease;
}

[data-theme="light"] {
  --bg-dark: #f8fafc;
  --bg-darker: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f1f5f9;
  --bg-input-focus: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --border-light: #cbd5e1;
  --gradient-dark: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  --gradient-card: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  font-size: 14px;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }

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

ul { list-style: none; }

.container { max-width: 1320px; margin: 0 auto; padding: 0 16px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== HEADER ===== */
.site-header {
  background: var(--bg-darker);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  max-width: 1320px;
  margin: 0 auto;
  gap: 16px;
  height: 56px;
}

/* Brand/Logo */
.head-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.site-logo svg { width: 32px; height: 32px; }

.site-logo span { color: var(--primary); }

/* Search */
.head-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-wrap {
  position: relative;
  width: 100%;
}

.search-wrap form {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 25px;
  overflow: hidden;
  transition: var(--transition);
}

.search-wrap form:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-wrap i {
  color: var(--text-muted);
  font-size: 16px;
  padding: 0 0 0 14px;
}

.search-wrap input {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Poppins', sans-serif;
  outline: none;
}

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

.search-filter {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  border-left: 1px solid var(--border-color);
  white-space: nowrap;
}

.search-filter:hover { color: var(--primary); background: var(--bg-input-focus); }

/* Tools */
.head-tool {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.head-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
}

.head-btn:hover { background: var(--bg-input); color: var(--text-primary); }

.search-btn { display: none; }

/* Dropdown */
.head-dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  min-width: 220px;
  padding: 8px;
  display: none;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}

.dropdown-menu.show { display: block; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.dropdown-item:hover { background: var(--bg-input); color: var(--text-primary); }
.dropdown-item i { width: 18px; text-align: center; }

/* Theme Selector */
.theme-select {
  display: flex;
  gap: 4px;
  padding: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.theme-option {
  flex: 1;
  padding: 8px;
  text-align: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  border: none;
  background: transparent;
  font-size: 14px;
}

.theme-option:hover { color: var(--text-secondary); }
.theme-option.active { background: var(--primary); color: #fff; }

/* User Menu */
.user-menu { position: relative; }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}

/* Mobile Toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
}

/* ===== NOTICE BANNER ===== */
.notice-banner {
  background: var(--primary-light);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.notice-banner a { color: var(--primary); font-weight: 600; }

/* ===== SECTION HEADER ===== */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

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

.section-title i { color: var(--primary); }

.head-end {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Section Navigation */
.section-nav {
  display: flex;
  gap: 6px;
}

.nav-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
}

.nav-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.nav-btn:disabled:hover { background: var(--bg-card); border-color: var(--border-color); color: var(--text-secondary); }

/* Section Tabs */
.section-tab {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.section-tab span {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.section-tab span.active { background: var(--primary); color: #fff; }
.section-tab span:hover:not(.active) { color: var(--text-secondary); }

/* ===== COMIC GRID ===== */
.comic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

/* ===== COMIC CARD (MD) ===== */
.comic-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
  border: 1px solid var(--border-color);
}

.comic-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-light);
}

.comic-poster {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: var(--bg-input);
}

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

.comic-card:hover .comic-poster img { transform: scale(1.05); }

/* Rank Number */
.comic-rank {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 2;
}

.comic-card:nth-child(1) .comic-rank { background: #f59e0b; }
.comic-card:nth-child(2) .comic-rank { background: #94a3b8; }
.comic-card:nth-child(3) .comic-rank { background: #cd7f32; }

/* Card Controls */
.comic-ctrl {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  opacity: 0;
  transition: var(--transition);
}

.comic-card:hover .comic-ctrl { opacity: 1; }

.ctrl-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.ctrl-btn:hover { background: var(--primary); }

/* Type Badge */
.comic-type-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
}

.type-manhwa { background: #ef4444; color: #fff; }
.type-manga { background: #3b82f6; color: #fff; }
.type-manhua { background: #10b981; color: #fff; }
.type-comic { background: #f59e0b; color: #000; }

/* Card Detail */
.comic-detail-info {
  padding: 10px 12px 12px;
}

.comic-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.comic-meta span { display: flex; align-items: center; gap: 3px; }

.comic-title-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.comic-title-link:hover { color: var(--primary); }

.comic-genres-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

/* Genre Tags */
.genre-tag {
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.genre-action { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.genre-romance { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.genre-comedy { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.genre-drama { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.genre-fantasy { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.genre-horror { background: rgba(71, 85, 105, 0.3); color: #94a3b8; }
.genre-martial-arts { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.genre-isekai { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.genre-slice-of-life { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.genre-scifi { background: rgba(14, 165, 233, 0.2); color: #38bdf8; }
.genre-supernatural { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.genre-psychological { background: rgba(100, 116, 139, 0.3); color: #94a3b8; }
.genre-mystery { background: rgba(71, 85, 105, 0.3); color: #94a3b8; }
.genre-adventure { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.genre-school-life { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.genre-historical { background: rgba(180, 83, 9, 0.2); color: #d97706; }
.genre-shounen { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.genre-shoujo { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.genre-seinen { background: rgba(71, 85, 105, 0.3); color: #94a3b8; }
.genre-josei { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.genre-yaoi { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.genre-yuri { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.genre-mecha { background: rgba(100, 116, 139, 0.3); color: #94a3b8; }
.genre-sports { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.genre-tragedy { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.genre-webtoon { background: rgba(14, 165, 233, 0.2); color: #38bdf8; }

/* ===== COMIC LIST ITEM (SM for sidebar) ===== */
.comic-list-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-color);
}

.comic-list-item:last-child { border: none; }

.comic-list-poster {
  width: 55px;
  height: 75px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-input);
}

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

.comic-list-content { flex: 1; min-width: 0; }

.comic-list-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.comic-list-title:hover { color: var(--primary); }

.comic-list-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.comic-list-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ===== MAIN-SIDEBAR LAYOUT ===== */
.main-sidebar {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  padding: 24px 0;
}

/* ===== SIDEBAR ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-box {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 18px;
  border: 1px solid var(--border-color);
}

.sidebar-box .section-head {
  margin-bottom: 14px;
}

.sidebar-box .section-title {
  font-size: 16px;
}

.viewmore-btn {
  display: block;
  width: 100%;
  padding: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  margin-top: 12px;
}

.viewmore-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== COMMENTS WIDGET ===== */
.comment-widget {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-widget-item {
  display: block;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  text-decoration: none;
}

.comment-widget-item:last-child { border: none; padding-bottom: 0; }

.comment-widget-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 6px;
}

.comment-widget-poster {
  width: 36px;
  height: 50px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-input);
}

.comment-widget-poster img { width: 100%; height: 100%; object-fit: cover; }

.comment-widget-chapter {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.3;
}

.comment-widget-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.comment-widget-foot {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== PWA / SIDEBAR BUTTONS ===== */
.sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 16px;
  text-decoration: none;
}

.sidebar-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.sidebar-btn i { font-size: 16px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  font-family: 'Poppins', sans-serif;
  background: var(--bg-card);
  color: var(--text-secondary);
  text-decoration: none;
}

.btn:hover { border-color: var(--border-light); color: var(--text-primary); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
}

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-warning { background: var(--warning); color: #000; border-color: var(--warning); }

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

.btn-block { width: 100%; }

/* ===== COMIC DETAIL PAGE ===== */
.comic-detail {
  padding: 24px 0;
}

.comic-detail-header {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border-color);
}

.comic-detail-cover {
  flex-shrink: 0;
  width: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-input);
}

.comic-detail-cover img { width: 100%; display: block; }

.comic-detail-info { flex: 1; min-width: 0; }

.comic-detail-info h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.comic-alt-title {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.comic-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.meta-item {
  font-size: 13px;
  color: var(--text-secondary);
}

.meta-item strong { color: var(--text-primary); font-weight: 600; }

.comic-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.comic-detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.comic-description {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

.comic-description h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
}

.description-content {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 14px;
}

.chapter-list-section {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

.chapter-table {
  width: 100%;
  border-collapse: collapse;
}

.chapter-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chapter-table th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.chapter-table th:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.chapter-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-secondary);
}

.chapter-table tr:hover td { background: var(--bg-input); }
.chapter-table a { color: var(--text-primary); font-weight: 500; }
.chapter-table a:hover { color: var(--primary); }

/* Status Badges */
.status-badge {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
}

.status-ongoing { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.status-completed { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.status-hiatus { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.status-dropped { background: rgba(239, 68, 68, 0.2); color: #f87171; }

/* ===== CHAPTER READER ===== */
.chapter-reader {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 0;
}

.chapter-header-bar {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
}

.chapter-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.chapter-nav-info {
  text-align: center;
  flex: 1;
  min-width: 0;
}

.chapter-nav-info h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.chapter-nav-info h2 a { color: var(--primary); }
.chapter-nav-info h2 a:hover { text-decoration: underline; }

.chapter-select {
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Poppins', sans-serif;
  min-width: 180px;
  cursor: pointer;
}

.chapter-images-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 2px;
  border: 1px solid var(--border-color);
}

.chapter-images-wrapper img {
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

.chapter-footer-bar {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid var(--border-color);
}

.chapter-footer-bar .btn { min-width: 120px; }

/* ===== AUTH PAGES ===== */
.auth-page {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--gradient-dark);
}

.auth-container {
  width: 100%;
  max-width: 430px;
}

.auth-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-header h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-header p { color: var(--text-muted); font-size: 14px; }

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Poppins', sans-serif;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder { color: var(--text-muted); }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.form-check input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.form-check label { font-size: 13px; color: var(--text-secondary); cursor: pointer; }

.auth-footer {
  text-align: center;
  margin-top: 22px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-footer a { color: var(--primary); font-weight: 600; }

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.5;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

/* ===== DASHBOARD ===== */
.dashboard {
  padding: 24px 0;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.dashboard-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.dashboard-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  padding: 5px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow-x: auto;
  border: 1px solid var(--border-color);
}

.tab-btn {
  padding: 9px 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: 'Poppins', sans-serif;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.tab-btn:hover:not(.active) { background: var(--bg-input); color: var(--text-secondary); }

.tab-content { margin-bottom: 24px; }

.following-table,
.history-table {
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.following-table th,
.history-table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.following-table td,
.history-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  font-size: 13px;
}

.following-table tr:hover td,
.history-table tr:hover td { background: var(--bg-input); }

.following-table img,
.history-table img { border-radius: 4px; }

.following-table a,
.history-table a { color: var(--text-primary); font-weight: 500; }

.settings-form {
  max-width: 500px;
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--bg-darker);
  border-top: 1px solid var(--border-color);
  padding: 40px 0 20px;
  margin-top: 40px;
}

.foot-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 16px;
}

.foot-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  margin-bottom: 30px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.foot-head > span {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 500px;
}

.foot-links-wrap {
  display: flex;
  gap: 48px;
}

.foot-links-col h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.foot-links-col ul { display: flex; flex-direction: column; gap: 8px; }

.foot-links-col a {
  font-size: 13px;
  color: var(--text-secondary);
}

.foot-links-col a:hover { color: var(--primary); }

.foot-body {
  text-align: center;
  margin-bottom: 24px;
}

.foot-body span {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.foot-abs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.foot-logo {
  display: flex;
  align-items: center;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}

.foot-logo span { color: var(--primary); }

.foot-abs span { color: var(--text-muted); font-size: 13px; }
.foot-abs a { color: var(--primary); font-weight: 600; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 30px;
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  text-decoration: none;
}

.pagination a:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== BREADCRUMB ===== */
.breadcrumb {
  padding: 14px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text-primary); }

/* ===== COMMENTS ===== */
.comments-section {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 24px;
  border: 1px solid var(--border-color);
}

.comments-section h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
}

/* ===== SEARCH SUGGESTIONS ===== */
.search-suggestion {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  display: none;
  z-index: 300;
}

.search-suggestion.show { display: block; }

.search-suggestion-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
}

.search-suggestion-item:hover { background: var(--bg-input); }

.search-suggestion-item img {
  width: 36px;
  height: 50px;
  border-radius: 4px;
  object-fit: cover;
}

.search-suggestion-item .title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-suggestion-item .meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== LOADING ===== */
.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}

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

.loading-skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mb-5 { margin-bottom: 40px; }
.hidden { display: none; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .main-sidebar {
    grid-template-columns: 1fr;
  }
  .sidebar { display: none; }
  .head-search { max-width: 300px; }
  .foot-head {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mobile-toggle { display: flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    z-index: 150;
  }
  .main-nav.show { display: block; }
  .main-nav ul { flex-direction: column; gap: 4px; }
  .main-nav a { display: block; padding: 10px 14px; border-radius: var(--radius-sm); }
  .head-search { display: none; }
  .search-btn { display: flex; }
  .header-inner { padding: 8px 16px; }
  .comic-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .comic-detail-header { flex-direction: column; text-align: center; }
  .comic-detail-cover { width: 160px; margin: 0 auto; }
  .comic-meta-grid { grid-template-columns: 1fr 1fr; }
  .comic-detail-actions { justify-content: center; }
  .chapter-nav-row { flex-direction: column; }
  .chapter-select { width: 100%; }
  .chapter-footer-bar { flex-direction: column; }
  .chapter-footer-bar .btn { width: 100%; }
  .foot-links-wrap { flex-direction: column; gap: 24px; }
  .following-table td:nth-child(1),
  .history-table td:nth-child(1),
  .following-table th:nth-child(1),
  .history-table th:nth-child(1),
  .following-table td:nth-child(5),
   .history-table td:nth-child(4) { display: none; }
}

/* ========== Back to Top ========== */
.back-to-top {
  position: fixed; bottom: 30px; right: 30px; z-index: 9999;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--primary); color: #fff; font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--primary-hover); transform: translateY(-3px); }

/* ========== Report Button ========== */
.report-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border-radius: 6px; border: 1px solid var(--danger);
  color: var(--danger); background: transparent; font-size: 12px;
   cursor: pointer; transition: all 0.2s;
}

/* ========== Comments ========== */
.comments-section { max-width:800px; margin:30px auto 0; }
.comments-title { font-size:16px; margin-bottom:20px; color:var(--text-primary); }
.comments-title i { margin-right:6px; color:var(--primary); }
.comment-list { list-style:none; padding:0; margin:0; }
.comment-item { display:flex; gap:12px; padding:16px 0; border-bottom:1px solid var(--bg-card-hover, #1e1e32); }
.comment-item:last-child { border-bottom:none; }
.comment-avatar { flex-shrink:0; width:48px; height:48px; border-radius:50%; overflow:hidden; background:var(--primary-light); display:flex; align-items:center; justify-content:center; color:var(--primary); font-weight:700; font-size:18px; }
.comment-avatar img { width:100%; height:100%; object-fit:cover; border-radius:50%; }
.comment-body { flex:1; min-width:0; }
.comment-meta { display:flex; gap:10px; align-items:center; margin-bottom:6px; }
.comment-author { font-weight:600; font-size:14px; color:var(--text-primary); }
.comment-time { font-size:11px; color:var(--text-secondary); }
.comment-text { font-size:14px; line-height:1.6; color:var(--text-primary); word-break:break-word; }
.comment-text p { margin:0 0 8px; }
.comment-reply { margin-top:8px; }
.comment-reply a { font-size:12px; color:var(--primary); }
.comment-form textarea, .comment-form input[type=text], .comment-form input[type=email] {
    width:100%; padding:10px 14px; border:1px solid var(--bg-card-hover); border-radius:8px;
    background:var(--bg-input,#1a1a2e); color:var(--text-primary); font-size:14px; margin-bottom:8px;
}
.comment-form textarea { min-height:100px; resize:vertical; }
.comment-form textarea:focus, .comment-form input:focus { border-color:var(--primary); outline:none; }
.comment-form .btn { margin-top:4px; }
.comment-form-cookies-consent { font-size:12px; color:var(--text-secondary); display:flex; align-items:center; gap:6px; }

/* ========== Responsive Fix ========== */
*, *::before, *::after { box-sizing:border-box; }
html { overflow-x:hidden; }
body { overflow-x:hidden; width:100%; max-width:100vw; position:relative; }
img, video, iframe, object, embed { max-width:100%; height:auto; }
pre, code, table { max-width:100%; word-wrap:break-word; overflow-wrap:break-word; }
.chapter-images-wrapper img { width:100%; max-width:100%; height:auto; display:block; }
.container, .comic-detail, .chapter-reader { max-width:1200px; width:100%; margin-left:auto; margin-right:auto; padding-left:16px; padding-right:16px; overflow:hidden; }
@media (max-width:768px) {
    .container { padding:0 10px; }
    .comic-detail-header { flex-direction:column; }
    .comic-detail-cover { width:100%; max-width:250px; margin:0 auto; }
    .chapter-header-bar .chapter-nav-row { flex-wrap:wrap; gap:8px; }
    .comment-item { flex-direction:column; gap:8px; }
    .comment-avatar { width:36px; height:36px; font-size:14px; }
    .chapter-table { font-size:12px; }
}
@media (max-width:480px) {
    .container { padding:0 8px; }
    h1 { font-size:18px; }
}
.report-btn:hover { background: var(--danger); color: #fff; }
.report-btn i { font-size: 11px; }

/* ========== Ad Placeholder ========== */
.ad-placeholder {
  display: flex; align-items: center; justify-content: center;
  min-height: 90px; background: var(--bg-card); border-radius: 8px;
  margin: 20px 0; color: var(--text-secondary); font-size: 13px;
  border: 1px dashed var(--border-color, #333);
}
.ad-placeholder::before { content: 'Advertisement'; }
