/* ===========================
   RESET & BASE
   =========================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #22223a;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --accent-dark: #5b21b6;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #2a2a3e;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gradient: linear-gradient(135deg, #7c3aed, #2563eb);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  --transition: 0.3s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.section-title {
  font-size: 1.8rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title i {
  color: var(--accent);
}

.highlight {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===========================
   NAVBAR
   =========================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 0;
  transition: var(--transition);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-links a:hover {
  color: var(--accent-light);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: var(--transition);
}

.nav-links a:hover::after {
  width: 100%;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ===========================
   HERO
   =========================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: url('https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=1920') center/cover;
  padding-top: 80px;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 10, 15, 0.7) 0%,
    rgba(10, 10, 15, 0.95) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.hero-search {
  display: flex;
  gap: 0;
  max-width: 600px;
  margin: 0 auto 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  overflow: hidden;
  transition: var(--transition);
}

.hero-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.hero-search input {
  flex: 1;
  padding: 1rem 1.5rem;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 1rem;
}

.hero-search input::placeholder {
  color: var(--text-muted);
}

.hero-search button {
  padding: 1rem 2rem;
  background: var(--gradient);
  border: none;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.hero-search button:hover {
  opacity: 0.9;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ===========================
   GENRE TAGS
   =========================== */
.genres {
  padding: 3rem 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.genre-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.genre-tag {
  padding: 8px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.genre-tag:hover,
.genre-tag.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ===========================
   CATALOG
   =========================== */
.catalog {
  padding: 4rem 0;
}

.catalog-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--accent);
}

.sort-box select {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  cursor: pointer;
}

/* ===========================
   NOVEL GRID / CARDS
   =========================== */
.novel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.novel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.novel-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.15);
}

.novel-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--bg-secondary);
  overflow: hidden;
}

.novel-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.novel-card:hover .novel-cover img {
  transform: scale(1.05);
}

.novel-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-new {
  background: var(--success);
  color: white;
}

.badge-hot {
  background: var(--danger);
  color: white;
}

.badge-complete {
  background: var(--accent);
  color: white;
}

.novel-info {
  padding: 14px;
}

.novel-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.novel-author {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.novel-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.novel-rating {
  color: var(--warning);
}

.novel-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.genre-label {
  padding: 2px 8px;
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent-light);
  border-radius: 4px;
  font-size: 0.7rem;
}

/* ===========================
   PAGINATION
   =========================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
}

.page-btn:hover,
.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ===========================
   POPULAR
   =========================== */
.popular {
  padding: 4rem 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.popular-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  cursor: pointer;
}

.popular-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.popular-rank {
  font-size: 2rem;
  font-weight: 900;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  min-width: 40px;
}

.popular-cover {
  width: 70px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.popular-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popular-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.popular-info h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.popular-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.popular-stats {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.popular-stats i {
  color: var(--accent-light);
}

/* ===========================
   RECENT
   =========================== */
.recent {
  padding: 4rem 0;
}

.recent-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1rem;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  cursor: pointer;
}

.recent-item:hover {
  border-color: var(--accent);
}

.recent-cover {
  width: 55px;
  height: 75px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.recent-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-info h4 {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.recent-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.recent-date {
  font-size: 0.75rem;
  color: var(--accent-light);
  margin-top: 4px;
}

/* ===========================
   ABOUT
   =========================== */
.about {
  padding: 4rem 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.about-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.about-card {
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  transition: var(--transition);
}

.about-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.about-card i {
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.about-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.about-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ===========================
   FOOTER
   =========================== */
.footer {
  padding: 3rem 0 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand .logo {
  font-size: 1.3rem;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.footer-brand p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links h4,
.footer-contact h4 {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.footer-links a {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 4px 0;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--accent-light);
}

.footer-contact p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.footer-contact i {
  width: 20px;
  color: var(--accent);
}

.footer-bottom {
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===========================
   MODAL
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 10;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--danger);
}

.modal-body {
  padding: 2rem;
}

.modal-header {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
}

.modal-cover {
  width: 180px;
  height: 260px;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}

.modal-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-title h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.modal-title p {
  color: var(--text-muted);
  margin-bottom: 4px;
  font-size: 0.9rem;
}

.modal-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.modal-genre-tag {
  padding: 4px 12px;
  background: rgba(124, 58, 237, 0.2);
  color: var(--accent-light);
  border-radius: 6px;
  font-size: 0.8rem;
}

.modal-stats {
  display: flex;
  gap: 1.5rem;
  margin-top: 12px;
}

.modal-stat {
  text-align: center;
}

.modal-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-light);
}

.modal-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.modal-description {
  margin-bottom: 2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.8;
}

.modal-volumes h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.volume-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.volume-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: var(--transition);
}

.volume-item:hover {
  border-color: var(--accent);
}

.volume-item span {
  font-size: 0.9rem;
}

.volume-downloads {
  display: flex;
  gap: 8px;
}

.dl-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.dl-epub {
  background: var(--success);
  color: white;
}

.dl-pdf {
  background: var(--danger);
  color: white;
}

.dl-txt {
  background: var(--warning);
  color: #1a1a2e;
}

.dl-btn:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

/* ===========================
   BACK TO TOP
   =========================== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 48px;
  height: 48px;
  background: var(--gradient);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-3px);
}

/* ===========================
   NO RESULTS
   =========================== */
.no-results {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.no-results i {
  font-size: 4rem;
  margin-bottom: 1rem;
  color: var(--border);
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem;
    gap: 0;
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links a {
    padding: 12px 16px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero-stats {
    gap: 1.5rem;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .novel-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .modal-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .modal-stats {
    justify-content: center;
  }

  .modal-genres {
    justify-content: center;
  }

  .volume-item {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .recent-list {
    grid-template-columns: 1fr;
  }

  .popular-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.6rem;
  }

  .hero-search {
    flex-direction: column;
    border-radius: var(--radius);
  }

  .hero-search button {
    border-radius: 0 0 var(--radius) var(--radius);
  }

  .novel-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ===========================
   LOADING
   =========================== */
.loading {
  display: flex;
  justify-content: center;
  padding: 3rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px 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(20px);
  animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.novel-card:nth-child(1) { animation-delay: 0.05s; }
.novel-card:nth-child(2) { animation-delay: 0.1s; }
.novel-card:nth-child(3) { animation-delay: 0.15s; }
.novel-card:nth-child(4) { animation-delay: 0.2s; }
.novel-card:nth-child(5) { animation-delay: 0.25s; }
.novel-card:nth-child(6) { animation-delay: 0.3s; }