/* ===== GLOBAL STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow-x: hidden;
}

::selection {
  background: rgba(139, 0, 0, 0.4);
  color: #fff;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #111111;
}

::-webkit-scrollbar-thumb {
  background: #8B0000;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #A52A2A;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse-slow {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.animate-fade-in-up {
  animation: fadeInUp 0.8s ease-out forwards;
  opacity: 0;
}

.animate-fade-in {
  animation: fadeIn 0.6s ease-out forwards;
  opacity: 0;
}

.animate-slide-left {
  animation: slideInLeft 0.7s ease-out forwards;
  opacity: 0;
}

.animate-slide-right {
  animation: slideInRight 0.7s ease-out forwards;
  opacity: 0;
}

.animate-pulse-slow {
  animation: pulse-slow 4s ease-in-out infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.delay-200 { animation-delay: 0.2s; }
.delay-400 { animation-delay: 0.4s; }
.delay-600 { animation-delay: 0.6s; }
.delay-800 { animation-delay: 0.8s; }
.delay-1000 { animation-delay: 1s; }

/* ===== NAVBAR ===== */
.nav-scrolled {
  background: rgba(17, 17, 17, 0.95) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: linear-gradient(135deg, #8B0000, #A52A2A);
  color: white;
  font-weight: 600;
  border-radius: 0.875rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #A52A2A, #C9A84C);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary > * {
  position: relative;
  z-index: 1;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(139, 0, 0, 0.4);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: transparent;
  color: white;
  font-weight: 600;
  border-radius: 0.875rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: rgba(201, 168, 76, 0.5);
  background: rgba(201, 168, 76, 0.1);
  transform: translateY(-2px);
}

/* ===== NAV LINKS ===== */
.nav-link {
  padding: 0.5rem 1rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: linear-gradient(to right, #8B0000, #C9A84C);
  border-radius: 1px;
  transition: width 0.3s ease;
}

.nav-link:hover, .nav-link.active {
  color: white;
}

.nav-link:hover::after, .nav-link.active::after {
  width: 60%;
}

.mobile-nav-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  font-size: 1rem;
  border-radius: 0.75rem;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  background: none;
}

.mobile-nav-link:hover, .mobile-nav-link.active {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

/* ===== STORY CARD ===== */
.story-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.story-card:hover {
  border-color: rgba(201, 168, 76, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(201, 168, 76, 0.1);
}

.story-card:hover .story-card-image img {
  transform: scale(1.08);
}

.story-card-image {
  overflow: hidden;
  position: relative;
}

.story-card-image::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to top, rgba(17, 17, 17, 0.8), transparent);
  pointer-events: none;
}

/* ===== GENRE CHIP ===== */
.genre-chip {
  padding: 0.5rem 1.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.genre-chip:hover {
  border-color: rgba(201, 168, 76, 0.4);
  color: white;
  background: rgba(201, 168, 76, 0.1);
}

.genre-chip.active {
  background: linear-gradient(135deg, #8B0000, #A52A2A);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 15px rgba(139, 0, 0, 0.3);
}

/* ===== STAR RATING ===== */
.star-rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.star-rating .star {
  cursor: pointer;
  transition: all 0.2s ease;
  color: rgba(255, 255, 255, 0.2);
}

.star-rating .star.filled {
  color: #C9A84C;
}

.star-rating .star:hover {
  transform: scale(1.2);
}

/* ===== PRODUCT CARD ===== */
.product-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover {
  border-color: rgba(201, 168, 76, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* ===== READER ===== */
.reader-body {
  font-family: 'Lora', serif;
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.8);
  max-width: 65ch;
  margin: 0 auto;
}

.reader-body.light-mode {
  color: rgba(17, 17, 17, 0.85);
}

.reader-body p {
  margin-bottom: 1.5em;
  text-indent: 1.5em;
}

.reader-body p:first-child {
  text-indent: 0;
}

/* Reading progress bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(to right, #8B0000, #C9A84C);
  z-index: 9999;
  transition: width 0.1s linear;
}

/* ===== TOAST ===== */
.toast-enter {
  animation: fadeInUp 0.3s ease-out forwards;
}

/* ===== PAGE TRANSITIONS ===== */
.page-section {
  animation: fadeIn 0.5s ease-out;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 640px) {
  .btn-primary, .btn-secondary {
    padding: 0.65rem 1.5rem;
    font-size: 0.85rem;
  }
}

/* ===== COMMENT CARD ===== */
.comment-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.75rem;
  padding: 1rem;
  transition: all 0.3s ease;
}

.comment-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* ===== GENRE PREVIEW CARD ===== */
.genre-preview-card {
  position: relative;
  padding: 1.5rem;
  border-radius: 1rem;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.4s ease;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.genre-preview-card:hover {
  transform: translateY(-4px);
  border-color: rgba(201, 168, 76, 0.3);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.genre-preview-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.15;
  transition: opacity 0.4s ease;
}

.genre-preview-card:hover::before {
  opacity: 0.25;
}