/* Custom Styles */

:root {
  --primary-color: #8b5cf6; /* Vibrant Purple */
  --secondary-color: #ec4899; /* Vibrant Pink */
  --accent-color: #06b6d4; /* Vibrant Cyan */
  --bg-color: #0f172a; /* Slate 900 */
  --sidebar-bg: rgba(30, 41, 59, 0.85); /* Slate 800 with opacity */
  --card-bg: #1e293b;
  --text-dark: #f1f5f9;
  --text-muted: #94a3b8;
  --sidebar-width: 280px;
  
  /* Bootstrap Overrides */
  --bs-primary: var(--primary-color);
  --bs-primary-rgb: 139, 92, 246;
}

/* Light Mode Variables */
body.light-mode {
  --bg-color: #f8fafc;
  --sidebar-bg: rgba(255, 255, 255, 0.95);
  --card-bg: #ffffff;
  --text-dark: #0f172a;
  --text-muted: #475569;
  --primary-color: #7c3aed;
  --secondary-color: #db2777;
  --bs-primary: var(--primary-color);
  --bs-primary-rgb: 124, 58, 237;
}

/* Base colors overrides */
.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }

body.light-mode .content-card {
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.05);
}

body.light-mode .bg-glass-top {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

body.light-mode #sidebarCollapse {
  color: var(--text-dark);
  border-color: rgba(0,0,0,0.2);
}

body.light-mode #sidebarCollapse:hover {
  background: rgba(0,0,0,0.05);
}

body.light-mode .quiz-option {
  background: #f1f5f9;
  border: 1px solid rgba(0,0,0,0.1);
}

body.light-mode .quiz-container {
  background: rgba(0, 0, 0, 0.02);
  box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}

body.light-mode .chapter-title {
  color: var(--text-dark);
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-dark);
  overflow-x: hidden;
}

/* Sidebar Styles */
#sidebar {
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  height: 100vh;
  position: sticky;
  top: 0;
  left: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--sidebar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 1000;
}

#sidebar .sidebar-header {
  background: transparent;
}

#sidebar ul.components {
  padding-bottom: 50px;
}

#nav-chapters li {
  opacity: 0;
  animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
#nav-chapters li:nth-child(1) { animation-delay: 0.1s; }
#nav-chapters li:nth-child(2) { animation-delay: 0.2s; }
#nav-chapters li:nth-child(3) { animation-delay: 0.3s; }
#nav-chapters li:nth-child(4) { animation-delay: 0.4s; }
#nav-chapters li:nth-child(5) { animation-delay: 0.5s; }
#nav-chapters li:nth-child(6) { animation-delay: 0.6s; }
#nav-chapters li:nth-child(7) { animation-delay: 0.7s; }
#nav-chapters li:nth-child(8) { animation-delay: 0.8s; }
#nav-chapters li:nth-child(9) { animation-delay: 0.9s; }

.nav-link {
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.nav-link:hover {
  background-color: rgba(139, 92, 246, 0.1);
  color: #fff;
  transform: translateX(8px);
  border-color: rgba(139, 92, 246, 0.2);
}

.nav-link.active, li.active > a {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  box-shadow: 0 4px 20px rgba(236, 72, 153, 0.4);
  transform: scale(1.02);
}

/* Glass Top Navbar */
.bg-glass-top {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Content Area */
#content {
  width: 100%;
  min-height: 100vh;
  transition: all 0.3s;
}

.content-card {
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  padding: 2.5rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(255,255,255,0.05);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  border-color: rgba(139, 92, 246, 0.3);
}

h1, h2, h3, h4, h5 {
  color: var(--text-dark);
  font-weight: 700;
}

h1 {
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chapter-title {
  position: relative;
  padding-bottom: 15px;
  margin-bottom: 25px;
  color: #fff;
}

.chapter-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  width: 80px;
  background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
  border-radius: 2px;
}

.lead-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-muted);
}

/* Interactive Quiz Styles */
.quiz-container {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 25px;
  margin-top: 20px;
  border-left: 5px solid var(--secondary-color);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
}

.quiz-option {
  cursor: pointer;
  padding: 15px 20px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--bg-color);
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-muted);
}

.quiz-option:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--primary-color);
  color: #fff;
  transform: scale(1.01);
}

.quiz-option.selected {
  background: rgba(67, 97, 238, 0.1);
  border-color: var(--primary-color);
  color: #fff;
  font-weight: 600;
}

.quiz-option.correct {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #10b981;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

/* Landing Screen */
.landing-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100vh;
  background: linear-gradient(rgba(15, 23, 42, 0.75), rgba(15, 23, 42, 0.9)), url('https://images.unsplash.com/photo-1456513080510-7bf3a84b82f8?q=80&w=1920&auto=format&fit=crop') center/cover no-repeat;
  z-index: 9999;
}
.landing-content {
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOutZoom {
  to {
    opacity: 0;
    transform: scale(1.1);
    visibility: hidden;
  }
}

.fade-out-zoom {
  animation: fadeOutZoom 0.6s ease-out forwards;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7); }
  70% { box-shadow: 0 0 0 15px rgba(139, 92, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

.btn-start-animated {
  animation: pulseGlow 2s infinite;
  transition: all 0.3s ease;
}
.btn-start-animated:hover {
  transform: scale(1.05);
}

/* TTS Highlight */
.tts-highlight {
  background-color: rgba(234, 179, 8, 0.2);
  border-left: 4px solid #eab308;
  padding-left: 10px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

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

.slide-in {
  animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.quiz-option.wrong {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

/* Video Embed */
.video-responsive {
  overflow: hidden;
  padding-bottom: 56.25%;
  position: relative;
  height: 0;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}
.video-responsive iframe {
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  position: absolute;
}

@media (max-width: 992px) {
  #sidebar {
    margin-left: calc(-1 * var(--sidebar-width));
    position: fixed;
  }
  #sidebar.active {
    margin-left: 0;
  }
  #content.active {
    filter: blur(2px);
  }
  
  /* Mobile Typography & Spacing adjustments */
  h1 {
    font-size: 1.6rem;
    line-height: 1.3;
  }
  
  .content-card {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  .chapter-title {
    font-size: 1.4rem;
    margin-bottom: 20px;
  }
  
  #btn-tts {
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
  }
}
