/* ==========================================================================
   Dr. Joe Dispenza — Quantum Learning Studio Stylesheet
   Design System: Minimalist, Scandinavian Dark Theme, Focus-Driven Video LMS
   ========================================================================== */

:root {
  --bg-app: #080c14;
  --bg-sidebar: #0d121f;
  --bg-card: #131a2b;
  --bg-card-secondary: #0a0e1a;
  --bg-input: #0a0e18;
  --bg-hover: #1b243b;
  --bg-active: #23304d;
  
  --border-subtle: #1c263b;
  --border-card: #22304d;
  --border-focus: #38bdf8;
  
  --text-main: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;
  
  --accent-cyan: #38bdf8;
  --accent-teal: #2dd4bf;
  --accent-emerald: #10b981;
  --accent-purple: #c084fc;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 24px rgba(56, 189, 248, 0.15);
  
  --sidebar-width: 360px;
  --header-height: 60px;
  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  height: 100%;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Custom Slim Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-card);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Screenreader utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* App Grid Layout */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Mobile Header (Hidden on Desktop) */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: rgba(13, 18, 31, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  background: linear-gradient(135deg, #0ea5e9, #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.mobile-title {
  font-weight: 600;
  font-size: 14px;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-progress-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-hover);
  color: var(--accent-cyan);
  border: 1px solid var(--border-card);
}

/* ==========================================================================
   Curriculum Sidebar
   ========================================================================== */
.curriculum-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform var(--transition-smooth);
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.3);
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #ffffff;
}

.brand-sub {
  font-size: 11px;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.close-sidebar-btn {
  display: none !important;
}

/* Course Switcher */
.course-switcher {
  padding: 14px 18px 6px;
}

.course-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.course-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 10px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.course-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.course-tab-btn.active {
  background: var(--bg-card);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-card);
}

/* Course Progress Card */
.course-progress-card {
  margin: 12px 18px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.progress-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-percent {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-emerald);
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-teal), var(--accent-emerald));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.progress-stats {
  font-size: 11px;
  color: var(--text-muted);
}

/* Search Box */
.search-box {
  position: relative;
  margin: 4px 18px 12px;
}

.search-box input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 32px 9px 34px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12px;
  transition: border-color var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.clear-search-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}

.clear-search-btn:hover {
  color: var(--text-main);
}

/* Lessons Navigation List */
.lessons-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-module-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  color: var(--text-dim);
  padding: 12px 10px 4px;
}

.lesson-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  user-select: none;
}

.lesson-item:hover {
  background: var(--bg-hover);
}

.lesson-item.active {
  background: var(--bg-card);
  border-color: var(--border-card);
  box-shadow: var(--shadow-sm);
}

.lesson-item.active .lesson-title {
  color: var(--accent-cyan);
  font-weight: 600;
}

.lesson-status-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  background: var(--bg-input);
}

.lesson-item.completed .lesson-status-icon {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #000;
}

.lesson-status-icon svg {
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--transition-fast);
}

.lesson-item.completed .lesson-status-icon svg {
  opacity: 1;
  transform: scale(1);
}

.lesson-info {
  flex: 1;
  min-width: 0;
}

.lesson-title {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lesson-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.badge-duration {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}

.badge-type-lecture {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
}

.badge-type-workshop {
  color: var(--accent-teal);
  background: rgba(45, 212, 191, 0.12);
}

.badge-type-meditation {
  color: var(--accent-purple);
  background: rgba(192, 132, 252, 0.15);
  font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
}

.offline-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* ==========================================================================
   Main Stage (Video & Notes)
   ========================================================================== */
.main-stage {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  padding: 24px 32px 48px;
  transition: all var(--transition-smooth);
}

/* Topbar */
.stage-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crumb-course {
  font-weight: 500;
  color: var(--text-muted);
}

.crumb-separator {
  color: var(--text-dim);
}

.crumb-lesson {
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-card);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-highlight);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
}

.btn-primary.completed {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35);
}

.icon-button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.icon-button:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

/* ==========================================================================
   Video Player Ratio Container
   ========================================================================== */
.player-container-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 16px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-card);
  background: #000000;
  transition: max-width var(--transition-smooth);
}

.video-ratio-box {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  background: #000000;
}

.video-ratio-box iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.player-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #05080f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-secondary);
  font-size: 13px;
  z-index: 5;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.player-loader.hidden {
  opacity: 0;
}

.loader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(56, 189, 248, 0.15);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Player Navigation Controls Bar
   ========================================================================== */
.player-nav-controls {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
  max-width: 320px;
}

.nav-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--accent-cyan);
}

.nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.nav-btn-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  overflow: hidden;
}

.prev-btn .nav-btn-text {
  text-align: left;
}

.next-btn .nav-btn-text {
  text-align: right;
}

.nav-sub {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.nav-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-meta-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.type-pill {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.duration-pill, .size-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Lesson Details Grid (Overview & Study Notebook)
   ========================================================================== */
.lesson-details-grid {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.module-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  color: #ffffff;
}

.instructor-tag {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.lesson-summary-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.quantum-key-takeaways {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.quantum-key-takeaways h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.takeaway-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.takeaway-list li {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  position: relative;
  padding-left: 14px;
}

.takeaway-list li::before {
  content: "•";
  color: var(--accent-teal);
  position: absolute;
  left: 0;
  font-size: 14px;
}

.takeaway-list strong {
  color: var(--text-main);
}

/* Notebook Card */
.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.notes-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-cyan);
}

.notes-title-group h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.notes-status-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.save-indicator {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  transition: color 0.2s;
}

.save-indicator.saving {
  color: var(--accent-amber);
}

.save-indicator.saved {
  color: var(--accent-emerald);
}

.icon-tool-btn {
  background: transparent;
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  padding: 5px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-tool-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.notes-textarea {
  width: 100%;
  flex: 1;
  min-height: 180px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--transition-fast);
}

.notes-textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.12);
}

.notes-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.notes-hint {
  font-size: 11px;
  color: var(--text-dim);
}

.btn-text-danger {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.btn-text-danger:hover {
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.1);
}

/* ==========================================================================
   Theater Mode Overrides
   ========================================================================== */
.app-layout.theater-mode .curriculum-sidebar {
  margin-left: calc(-1 * var(--sidebar-width));
}

.app-layout.theater-mode .player-container-wrapper {
  max-width: 100%;
}

.app-layout.theater-mode .player-nav-controls,
.app-layout.theater-mode .lesson-details-grid {
  max-width: 100%;
}

/* ==========================================================================
   Responsive & Mobile Styling
   ========================================================================== */
@media (max-width: 992px) {
  .lesson-details-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .main-stage {
    padding: calc(var(--header-height) + 16px) 16px 36px;
  }

  .curriculum-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    min-width: 320px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .curriculum-sidebar.open {
    transform: translateX(0);
  }

  .close-sidebar-btn {
    display: flex !important;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 35;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .player-nav-controls {
    flex-wrap: wrap;
  }

  .lesson-meta-pill {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .action-text {
    display: none;
  }
}
