/* ==========================================================================
   TRUNG TÂM TRI THỨC SỐ - NXB PHỤ NỮ VIỆT NAM (DESIGN SYSTEM & EDITORIAL STYLES)
   ========================================================================== */

:root {
  /* Brand Colors */
  --color-primary: #D32F2F;
  --color-primary-hover: #B71C1C;
  --color-primary-light: #FDE8E9;
  --color-primary-surface: #FFF5F5;

  /* Neutral & Editorial Palette */
  --color-bg: #FAF9F6;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F4F1EA;
  --color-border: #E8E4DC;
  --color-border-subtle: #F0EDE6;
  
  --color-text-main: #1C1917;
  --color-text-body: #44403C;
  --color-text-muted: #78716C;
  --color-text-light: #A8A29E;

  --color-accent-badge: #EFECE6;
  --color-accent-amber: #D97706;
  --color-accent-amber-light: #FEF3C7;
  --color-accent-emerald: #059669;
  --color-accent-emerald-light: #D1FAE5;

  /* Typography */
  --font-serif: 'Playfair Display', 'Merriweather', 'Georgia', serif;
  --font-sans: 'Be Vietnam Pro', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing & Layout */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-card: 0 4px 16px -2px rgba(28, 25, 23, 0.06), 0 2px 6px -1px rgba(28, 25, 23, 0.03);
  --shadow-hover: 0 12px 28px -4px rgba(211, 47, 47, 0.12), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
  --shadow-player: 0 16px 36px -6px rgba(0, 0, 0, 0.18), 0 6px 12px -2px rgba(0, 0, 0, 0.08);

  --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Theme */
[data-theme="dark"] {
  --color-bg: #141312;
  --color-surface: #1E1D1B;
  --color-surface-alt: #282623;
  --color-border: #33302C;
  --color-border-subtle: #242220;
  --color-text-main: #F5F2EB;
  --color-text-body: #D6D0C4;
  --color-text-muted: #A39D93;
  --color-primary-light: rgba(211, 47, 47, 0.18);
  --color-primary-surface: rgba(211, 47, 47, 0.1);
  --color-accent-badge: #2C2926;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-body);
  line-height: 1.68;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-text-main);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.015em;
}

.font-serif {
  font-family: var(--font-serif);
}

.font-sans {
  font-family: var(--font-sans);
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-smooth);
}

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

/* Container */
.container-custom {
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

@media (min-width: 1536px) {
  .container-custom {
    max-width: 1360px;
  }
}

/* Category Sub-Nav Styling */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.nav-sub-item {
  transition: var(--transition-smooth);
  font-weight: 500;
}
.nav-sub-item:hover {
  color: var(--color-primary);
  background-color: var(--color-primary-light);
}
.nav-sub-item.active {
  background-color: var(--color-primary) !important;
  color: #FFFFFF !important;
  font-weight: 600;
}

/* Spotlight Text Gradient (Chỉ kéo dài đến đầu text, không làm mờ cả thumbnail) */
.spotlight-text-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 130px;
  background: linear-gradient(
    to top,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(255, 255, 255, 0.90) 45%,
    rgba(255, 255, 255, 0.25) 80%,
    rgba(255, 255, 255, 0) 100%
  );
  pointer-events: none;
  z-index: 5;
}

[data-theme="dark"] .spotlight-text-gradient {
  background: linear-gradient(
    to top,
    rgba(24, 23, 22, 0.98) 0%,
    rgba(24, 23, 22, 0.90) 45%,
    rgba(24, 23, 22, 0.25) 80%,
    rgba(24, 23, 22, 0) 100%
  );
}

/* Uniform Thumbnail Sizes */
.thumb-media-standard {
  width: 100%;
  height: 185px;
  object-fit: cover;
}

.thumb-book-standard {
  aspect-ratio: 3 / 4.2;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: -4px 6px 16px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
}

.editorial-card:hover .thumb-book-standard {
  transform: scale(1.02) rotate(-0.5deg);
}

/* Drop Cap */
.drop-cap::first-letter {
  float: left;
  font-family: var(--font-serif);
  font-size: 3.5rem;
  line-height: 0.8;
  padding-right: 0.5rem;
  padding-top: 0.2rem;
  color: var(--color-primary);
  font-weight: 700;
}

/* Badge styling */
.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  background-color: var(--color-accent-badge);
  color: var(--color-text-body);
  font-size: 0.725rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  transition: var(--transition-smooth);
}

.badge-tag:hover {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.badge-primary {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background-color: var(--color-primary);
  color: #FFFFFF;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.8125rem;
  border: 1px solid var(--color-primary);
  box-shadow: 0 2px 8px rgba(211, 47, 47, 0.2);
  cursor: pointer;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(211, 47, 47, 0.35);
  transform: translateY(-1px);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background-color: transparent;
  color: var(--color-text-main);
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.8125rem;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.btn-outline:hover {
  background-color: var(--color-surface-alt);
  border-color: var(--color-text-muted);
}

/* Card Styles */
.editorial-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
  transition: var(--transition-smooth);
}

.editorial-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(211, 47, 47, 0.25);
}

/* Playlist Selected Active Item */
.playlist-item-active {
  border-color: var(--color-primary) !important;
  background-color: var(--color-primary-surface) !important;
}

/* Partner Logos Grayscale & Hover */
.partner-logo-item {
  filter: grayscale(100%);
  opacity: 0.7;
  transition: all 0.3s ease;
}

.partner-logo-item:hover {
  filter: grayscale(0%);
  opacity: 1;
  transform: translateY(-2px);
}

/* Animated Sound Wave */
.sound-wave {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 18px;
}

.sound-bar {
  width: 3px;
  background-color: var(--color-primary);
  border-radius: 2px;
  animation: equalize 1.2s ease-in-out infinite alternate;
}

.sound-bar:nth-child(1) { height: 30%; animation-delay: 0.1s; }
.sound-bar:nth-child(2) { height: 90%; animation-delay: 0.3s; }
.sound-bar:nth-child(3) { height: 60%; animation-delay: 0.15s; }
.sound-bar:nth-child(4) { height: 100%; animation-delay: 0.4s; }
.sound-bar:nth-child(5) { height: 45%; animation-delay: 0.25s; }

.paused .sound-bar {
  animation-play-state: paused;
  height: 25% !important;
}

@keyframes equalize {
  0% { height: 20%; }
  50% { height: 100%; }
  100% { height: 35%; }
}

/* Sticky Mini Audio Player */
.sticky-audio-player {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 440px;
  max-width: calc(100vw - 3rem);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-player);
  z-index: 999;
  backdrop-filter: blur(12px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.sticky-audio-player.minimized {
  width: auto;
  border-radius: var(--radius-full);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.sticky-audio-player.hidden-player {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}

.audio-progress {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: height 0.15s;
}

.audio-progress:hover {
  height: 6px;
}

.audio-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

/* Countdown Clock */
.countdown-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.6rem;
  min-width: 58px;
}

.countdown-number {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}

.countdown-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-top: 0.2rem;
  font-weight: 600;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 13, 12, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 1060px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.96) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container {
  transform: scale(1) translateY(0);
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: var(--color-bg);
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .sticky-audio-player {
    bottom: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    max-width: none;
  }
}
