/* ==========================================================================
   W3Schools-style LMS Design System (testbook247.com)
   ========================================================================== */

:root {
  --lms-bg: #f8fafc;
  --lms-card-bg: #ffffff;
  --lms-sidebar-bg: #ffffff;
  --lms-border: #e2e8f0;
  --lms-text: #0f172a;
  --lms-text-muted: #64748b;
  --lms-primary: #2563eb;
  --lms-primary-hover: #1d4ed8;
  --lms-accent: #059669;
  --lms-highlight: #fef08a;
  --lms-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --lms-radius: 12px;
}

[data-theme="dark"] {
  --lms-bg: #0f172a;
  --lms-card-bg: #1e293b;
  --lms-sidebar-bg: #1e293b;
  --lms-border: #334155;
  --lms-text: #f8fafc;
  --lms-text-muted: #94a3b8;
  --lms-primary: #3b82f6;
  --lms-primary-hover: #60a5fa;
  --lms-accent: #10b981;
  --lms-highlight: #854d0e;
}

/* 3-Pane W3Schools Responsive Grid */
.lms-wrapper {
  display: flex;
  min-height: calc(100vh - 70px);
  background-color: var(--lms-bg);
}

.lms-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--lms-sidebar-bg);
  border-right: 1px solid var(--lms-border);
  overflow-y: auto;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  padding: 1.25rem 1rem;
}

.lms-content-pane {
  flex: 1;
  min-width: 0;
  padding: 2rem 3rem;
}

.lms-right-pane {
  width: 280px;
  flex-shrink: 0;
  border-left: 1px solid var(--lms-border);
  padding: 1.5rem;
  background: var(--lms-card-bg);
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
}

@media (max-width: 1200px) {
  .lms-right-pane { display: none; }
  .lms-content-pane { padding: 1.5rem; }
}

@media (max-width: 992px) {
  .lms-wrapper { flex-direction: column; }
  .lms-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    top: 0;
  }
}

/* Sidebar Hierarchy Tree */
.tree-chapter-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--lms-text);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tree-topic-item {
  padding-left: 0.75rem;
  margin-top: 0.25rem;
}

.tree-lesson-link {
  display: block;
  padding: 0.4rem 0.75rem 0.4rem 1.5rem;
  font-size: 0.875rem;
  color: var(--lms-text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  transition: all 0.2s ease;
}

.tree-lesson-link:hover,
.tree-lesson-link.active {
  color: var(--lms-primary);
  background-color: rgba(37, 99, 235, 0.08);
  border-left-color: var(--lms-primary);
  font-weight: 600;
}

/* Callout Boxes */
.callout {
  padding: 1.25rem;
  border-left: 4px solid var(--lms-primary);
  background: rgba(37, 99, 235, 0.05);
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
}

.callout-warning {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

.callout-tip {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.callout-note {
  border-left-color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
}

/* Rich Content Spans & Modernized TTS Sentence Highlight */
.tts-sentence {
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 3px;
}

.tts-sentence:hover {
  background: rgba(37, 99, 235, 0.08);
}

html[data-theme="dark"] .tts-sentence:hover {
  background: rgba(96, 165, 250, 0.15);
}

.tts-sentence.active-sentence {
  background: linear-gradient(120deg, rgba(37, 99, 235, 0.2) 0%, rgba(16, 185, 129, 0.2) 100%);
  color: #1e3a8a;
  border-left: 3px dashed #2563eb;
  padding-left: 6px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.15);
}

html[data-theme="dark"] .tts-sentence.active-sentence {
  background: linear-gradient(120deg, rgba(59, 130, 246, 0.3) 0%, rgba(16, 185, 129, 0.3) 100%);
  color: #93c5fd;
  border-left-color: #60a5fa;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

/* Floating Glassmorphic Audio Player Capsule */
.floating-tts-player {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1045;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  border-radius: 50px;
  padding: 0.55rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html[data-theme="dark"] .floating-tts-player {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(30, 41, 59, 0.8);
  box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.floating-tts-player:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -6px rgba(37, 99, 235, 0.25);
}

/* Equalizer Bars Animation */
.tts-equalizer-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  margin-right: 2px;
}

.tts-equalizer-bar {
  width: 3px;
  height: 4px;
  background: #2563eb;
  border-radius: 2px;
  transition: height 0.2s ease;
}

html[data-theme="dark"] .tts-equalizer-bar {
  background: #60a5fa;
}

.floating-tts-player.is-playing .tts-equalizer-bar {
  animation: ttsEqualizerAnim 0.8s infinite ease-in-out alternate;
}

.floating-tts-player.is-playing .tts-equalizer-bar:nth-child(1) { animation-delay: 0s; }
.floating-tts-player.is-playing .tts-equalizer-bar:nth-child(2) { animation-delay: 0.2s; }
.floating-tts-player.is-playing .tts-equalizer-bar:nth-child(3) { animation-delay: 0.4s; }

@keyframes ttsEqualizerAnim {
  0% { height: 4px; }
  100% { height: 14px; }
}

/* Action Buttons inside Audio Player */
.floating-tts-player .btn-tts-action {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  transition: all 0.25s ease;
  position: relative;
}

.floating-tts-player .btn-tts-action:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.55);
}

.floating-tts-player.is-playing .btn-tts-action {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
  animation: ttsPulseRing 2s infinite;
}

@keyframes ttsPulseRing {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.floating-tts-player .btn-tts-sub-action {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(241, 245, 249, 0.8);
  color: #475569;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

html[data-theme="dark"] .floating-tts-player .btn-tts-sub-action {
  background: rgba(30, 41, 59, 0.8);
  color: #94a3b8;
}

.floating-tts-player .btn-tts-sub-action:hover {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
  transform: scale(1.06);
}

html[data-theme="dark"] .floating-tts-player .btn-tts-sub-action:hover {
  background: rgba(96, 165, 250, 0.18);
  color: #60a5fa;
}

/* Speed Selector Pill */
.floating-tts-player .tts-speed-select {
  border: 1px solid rgba(226, 232, 240, 0.8) !important;
  background: rgba(248, 250, 252, 0.9) !important;
  color: #334155 !important;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  border-radius: 20px;
  padding: 3px 8px;
  transition: all 0.2s ease;
}

html[data-theme="dark"] .floating-tts-player .tts-speed-select {
  border-color: rgba(51, 65, 85, 0.8) !important;
  background: rgba(15, 23, 42, 0.9) !important;
  color: #cbd5e1 !important;
}

.floating-tts-player .tts-speed-select:hover {
  border-color: #2563eb !important;
}

/* Sentence Counter Badge */
.tts-progress-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
}

html[data-theme="dark"] .tts-progress-badge {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.15);
}

/* Mobile Responsiveness */
@media (max-width: 576px) {
  .floating-tts-player {
    bottom: 80px;
    right: 14px;
    left: 14px;
    justify-content: space-between;
    padding: 0.5rem 0.85rem;
    border-radius: 24px;
  }
}

/* Quiz Card Widget */
.quiz-container-card {
  background: var(--lms-card-bg);
  border: 1px solid var(--lms-border);
  border-radius: var(--lms-radius);
  padding: 2rem;
  margin-top: 3rem;
  box-shadow: var(--lms-shadow);
}

.quiz-option-label {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border: 1px solid var(--lms-border);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 0.5rem;
  transition: all 0.2s ease;
}

.quiz-option-label:hover {
  background: rgba(37, 99, 235, 0.05);
  border-color: var(--lms-primary);
}

/* Reading Progress Header Bar */
.lms-progress-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #2563eb, #059669);
  z-index: 1090;
  width: 0%;
  transition: width 0.1s ease;
}
