/* ==========================================================================
   Course Live Player - Modern Dark Glassmorphic Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-dark: #080c14;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(31, 41, 55, 0.8);
  --bg-sidebar: rgba(12, 18, 30, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(139, 92, 246, 0.5);

  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.35);
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-purple);
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */

header {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: rgba(8, 12, 20, 0.8);
  backdrop-filter: blur(12px);
  z-index: 50;
  position: sticky;
  top: 0;
}

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

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 14px var(--accent-purple-glow);
}

.brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  transition: var(--transition-fast);
  outline: none;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), #7c3aed);
  border: none;
  color: white;
  box-shadow: 0 4px 14px var(--accent-purple-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #9d6efd, #6d28d9);
  box-shadow: 0 6px 20px var(--accent-purple-glow);
}

/* ==========================================================================
   App Layout
   ========================================================================== */

.app-container {
  display: flex;
  flex: 1;
  height: calc(100vh - 64px);
  overflow: hidden;
  width: 100%;
  max-width: 1700px;
  margin: 0 auto;
}

.app-container.player-active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  padding: 16px 24px;
  height: calc(100vh - 64px);
  max-height: calc(100vh - 64px);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 🎬 Cinema / Theater Mode Layout & Dim Backdrop Overlay */
.cinema-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.90);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

body.cinema-mode-active .cinema-overlay {
  opacity: 1;
  pointer-events: auto;
}

.app-container.player-active.cinema-mode {
  display: flex;
  flex-direction: column;
  height: auto;
  max-height: none;
  overflow-y: auto;
  padding: 16px 24px 40px 24px;
}

.app-container.player-active.cinema-mode .player-section {
  max-width: 100%;
}

.app-container.player-active.cinema-mode .video-wrapper {
  position: relative;
  z-index: 1410;
  max-height: 82vh;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.95), 0 0 60px rgba(139, 92, 246, 0.4);
  border-color: rgba(139, 92, 246, 0.6);
}

.app-container.player-active.cinema-mode .player-header-meta,
.app-container.player-active.cinema-mode .sidebar {
  width: 100%;
  max-width: 100%;
  height: auto;
  margin-top: 16px;
  position: relative;
  z-index: 1390;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 24px;
  gap: 20px;
}

.app-container.player-active .main-content {
  padding: 0;
}

/* ==========================================================================
   Empty Dropzone State
   ========================================================================== */

.dropzone-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  padding: 48px 24px;
  text-align: center;
  transition: var(--transition-normal);
  cursor: pointer;
  margin: auto 0;
  min-height: 400px;
}

.dropzone-container.drag-over {
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.1);
  transform: scale(1.005);
}

.dropzone-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  transition: var(--transition-normal);
}

.dropzone-container:hover .dropzone-icon {
  transform: scale(1.1) rotate(5deg);
  background: rgba(139, 92, 246, 0.25);
}

.dropzone-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.dropzone-desc {
  color: var(--text-muted);
  font-size: 0.925rem;
  max-width: 480px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.public-url-box {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 600px;
  margin-bottom: 16px;
  background: rgba(15, 23, 42, 0.7);
  padding: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Recent Links History */
.recent-links-container {
  width: 100%;
  max-width: 600px;
  margin-bottom: 24px;
  text-align: left;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.recent-links-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.btn-clear-history {
  background: transparent;
  border: none;
  color: var(--accent-rose, #f43f5e);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition-fast);
}

.btn-clear-history:hover {
  background: rgba(244, 63, 94, 0.15);
}

.recent-links-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.recent-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.recent-link-item:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
}

.recent-link-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.recent-link-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}

.recent-link-badge.gdrive {
  background: rgba(54, 179, 126, 0.2);
  color: #36b37e;
}

.recent-link-badge.dropbox {
  background: rgba(0, 97, 254, 0.2);
  color: #38bdf8;
}

.recent-link-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-remove-link {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 4px;
  transition: var(--transition-fast);
}

.btn-remove-link:hover {
  color: var(--accent-rose, #f43f5e);
  background: rgba(244, 63, 94, 0.2);
}

.public-url-box input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 16px;
  color: #ffffff;
  font-size: 0.875rem;
  outline: none;
  font-family: var(--font-sans);
}

.public-url-box input::placeholder {
  color: var(--text-muted);
}

.dropzone-buttons {
  display: flex;
  gap: 12px;
}

/* ==========================================================================
   Video Player Container
   ========================================================================== */

.player-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.video-wrapper {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Subtitle Overlay */
.subtitle-overlay {
  position: absolute;
  bottom: 60px;
  left: 5%;
  right: 5%;
  text-align: center;
  pointer-events: none;
  z-index: 20;
  transition: bottom 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.subtitle-text {
  display: inline-block;
  background: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  max-width: 90%;
  word-break: break-word;
}

.subtitle-text.secondary {
  color: #fde047; /* Bright yellow for secondary language */
  font-size: 1.05rem;
  background: rgba(0, 0, 0, 0.75);
}

/* Video Control Bar */
.player-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.4), transparent);
  padding: 16px 20px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 30;
}

.video-wrapper:hover .player-controls,
.video-wrapper.paused .player-controls {
  opacity: 1;
}

/* Seek Bar */
.seekbar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: height 0.15s ease;
}

.seekbar-container:hover {
  height: 10px;
}

.seekbar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan));
  border-radius: 3px;
  width: 0%;
  position: relative;
}

.seekbar-handle {
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  transition: transform 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.seekbar-container:hover .seekbar-handle {
  transform: translateY(-50%) scale(1);
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ctrl-btn {
  background: transparent;
  border: none;
  color: #e5e7eb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: var(--transition-fast);
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.ctrl-btn.active {
  color: var(--accent-cyan, #06b6d4);
  background: rgba(6, 182, 212, 0.2);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

/* Volume Control Wrapper & Expandable Slider */
.volume-control-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

.volume-slider-container {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 0;
  opacity: 0;
  overflow: hidden;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.volume-control-wrapper:hover .volume-slider-container,
.volume-control-wrapper:focus-within .volume-slider-container,
.volume-slider-container.active {
  width: 120px;
  opacity: 1;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 75px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
  background: var(--accent-cyan, #06b6d4);
}

.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.volume-value {
  font-size: 0.725rem;
  color: rgba(255, 255, 255, 0.85);
  min-width: 34px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.time-display {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #d1d5db;
}

/* Select dropdowns in player */
.select-pill {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 20px;
  outline: none;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: var(--transition-fast);
  max-width: 140px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.select-pill:hover {
  background: rgba(255, 255, 255, 0.2);
}

.select-pill option {
  background: #111827;
  color: white;
}

/* Audio Track Status Indicator Badge */
.audio-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.audio-badge.mp3-active {
  background: rgba(139, 92, 246, 0.2);
  color: #c084fc;
  border-color: rgba(139, 92, 246, 0.4);
}

/* ==========================================================================
   Lesson Info Header
   ========================================================================== */

.lesson-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 16px;
  flex-wrap: wrap;
}

.lesson-meta-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-gdrive {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.btn-gdrive:hover {
  background: rgba(6, 182, 212, 0.25);
  border-color: rgba(6, 182, 212, 0.5);
  color: #ffffff;
}

.btn-dropbox {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-dropbox:hover {
  background: rgba(59, 130, 246, 0.28);
  border-color: rgba(59, 130, 246, 0.6);
  color: #ffffff;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.modal-box {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  overflow: hidden;
}

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

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #ffffff;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
}

/* Folder List in Modal */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.crumb {
  cursor: pointer;
  color: var(--accent-cyan);
}

.crumb:hover {
  text-decoration: underline;
}

.crumb.active {
  color: var(--text-main);
  font-weight: 600;
  cursor: default;
}

.folder-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 0.9rem;
}

.folder-item:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #ffffff;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-group input {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.4);
  color: #ffffff;
  font-size: 0.875rem;
  outline: none;
  font-family: var(--font-sans);
}

.input-group input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.guide-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 0.825rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.guide-box h4 {
  color: var(--accent-amber);
  margin-bottom: 8px;
  font-size: 0.875rem;
}

.guide-box ol {
  padding-left: 18px;
}

.guide-box code {
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.lesson-badges {
  display: flex;
  gap: 8px;
}

.badge {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-video { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.badge-audio { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.badge-sub { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }

/* ==========================================================================
   Sidebar Tabs & Panel (Playlist + Transcript)
   ========================================================================== */

.sidebar {
  width: 380px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(16px);
  z-index: 40;
  height: calc(100vh - 96px);
  max-height: calc(100vh - 96px);
  overflow: hidden;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-fast);
  position: relative;
}

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

.tab-btn.active {
  color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.1);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-purple);
  box-shadow: 0 0 10px var(--accent-purple);
}

.sidebar-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tab-pane.active {
  display: flex;
}

#playlist-container,
#transcript-container {
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - 200px);
  overflow-y: auto !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

#playlist-container::-webkit-scrollbar,
#transcript-container::-webkit-scrollbar {
  width: 6px;
}

#playlist-container::-webkit-scrollbar-track,
#transcript-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

#playlist-container::-webkit-scrollbar-thumb,
#transcript-container::-webkit-scrollbar-thumb {
  background: var(--accent-purple);
  border-radius: 4px;
}

/* Search input */
.search-box {
  position: relative;
  margin-bottom: 6px;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-main);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

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

/* ============================================================
   Playlist Section Accordion (Grouped by folder/section)
   ============================================================ */

.playlist-section-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  border-radius: var(--radius-md);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  margin-top: 8px;
  margin-bottom: 6px;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.playlist-section-header:first-child {
  margin-top: 0;
}

.playlist-section-header:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.4);
}

.playlist-section-header.collapsed {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  margin-bottom: 4px;
}

.section-header-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.section-chevron {
  font-size: 0.65rem;
  color: var(--accent-purple);
  flex-shrink: 0;
  width: 12px;
  text-align: center;
}

.playlist-section-header.collapsed .section-chevron {
  color: var(--text-dim);
}

.section-title {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

.playlist-section-header.collapsed .section-title {
  color: var(--text-secondary);
}

.section-count {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-purple-light);
  background: rgba(139, 92, 246, 0.2);
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}

.playlist-section-header.collapsed .section-count {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
}

.playlist-section-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.playlist-section-body.collapsed {
  display: none;
}

/* Playlist item */

.playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}

.playlist-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.playlist-item.active {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.3);
}

.item-index {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  width: 24px;
  text-align: center;
}

.playlist-item.active .item-index {
  color: var(--accent-purple);
  font-weight: 700;
}

.item-details {
  flex: 1;
  overflow: hidden;
}

.item-title {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.playlist-item.active .item-title {
  color: #ffffff;
}

.item-tags {
  display: flex;
  gap: 6px;
  font-size: 0.7rem;
}

.tag {
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.tag.has-audio { color: var(--accent-purple); }
.tag.has-sub { color: var(--accent-amber); }

/* Interactive Transcript Items */
.transcript-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.transcript-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: var(--transition-fast);
  border-left: 3px solid transparent;
}

.transcript-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.transcript-item.active {
  background: rgba(139, 92, 246, 0.15);
  border-left-color: var(--accent-purple);
}

.transcript-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
  white-space: nowrap;
  margin-top: 2px;
}

.transcript-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.transcript-item.active .transcript-text {
  color: #ffffff;
  font-weight: 500;
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-dim);
  font-size: 0.875rem;
}

/* ==========================================================================
   Responsive (iPad & Mobile Optimization)
   ========================================================================== */

/* ==========================================================================
   Responsive (iPad & Mobile Optimization)
   ========================================================================== */

@media (max-width: 1024px) {
  header {
    height: auto;
    min-height: 58px;
    padding: 8px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .brand h1 {
    font-size: 1rem;
  }

  .header-actions {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .header-actions .btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
  }

  .app-container {
    flex-direction: column;
    height: auto;
    overflow: auto;
  }

  .app-container.player-active {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
    padding: 14px;
    gap: 16px;
  }

  .sidebar {
    width: 100%;
    height: 480px;
    border-radius: var(--radius-lg);
  }

  /* Player Controls iPad Responsive Fix */
  .player-controls {
    padding: 12px 14px 10px 14px;
    gap: 8px;
  }

  .controls-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  .controls-left {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
    justify-content: flex-start !important;
    width: auto !important;
  }

  .controls-right {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
    justify-content: flex-end !important;
    overflow: hidden !important;
    width: auto !important;
  }

  /* Hide bottom bar skip buttons on iPad/Mobile since Double-Tap gesture is active */
  .btn-skip-bar {
    display: none !important;
  }

  .select-pill {
    max-width: 95px !important;
    font-size: 0.725rem !important;
    padding: 4px 6px !important;
    border-radius: 12px !important;
  }

  .ctrl-btn {
    width: 32px !important;
    height: 32px !important;
    flex-shrink: 0 !important;
  }

  .time-display {
    font-size: 0.75rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
}

@media (max-width: 768px) {
  header {
    padding: 8px 12px;
  }

  .brand h1 {
    font-size: 0.9rem;
  }

  .dropzone-container {
    padding: 24px 16px;
  }

  .dropzone-title {
    font-size: 1.15rem;
  }

  .dropzone-desc {
    font-size: 0.85rem;
  }

  .dropzone-buttons {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .dropzone-buttons .btn {
    width: 100%;
    justify-content: center;
  }

  .select-pill {
    max-width: 80px !important;
    font-size: 0.7rem !important;
    padding: 3px 4px !important;
  }

  .lesson-meta {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 14px;
    gap: 12px;
  }

  .lesson-meta-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .lesson-meta-actions .btn-sm {
    flex: 1;
    justify-content: center;
    padding: 8px;
    font-size: 0.775rem;
  }

  .sidebar {
    height: 420px;
  }

  .sidebar-tabs {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .transcript-text {
    font-size: 0.825rem;
  }
}

/* ==========================================================================
   Modal Overlay & Dialog System
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  background: rgba(22, 27, 34, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 100000;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Advanced Subtitle Settings Side Drawer (Right Side Panel)
   ========================================================================== */

#modal-subtitle-settings {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  pointer-events: none;
  justify-content: flex-end;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
}

#modal-subtitle-settings .modal-sub-settings-box {
  pointer-events: auto;
  width: 360px;
  max-width: 90vw;
  height: 100vh;
  max-height: 100vh;
  border-radius: 16px 0 0 16px;
  border-top: none;
  border-right: none;
  border-bottom: none;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(18, 22, 28, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  animation: drawerSlideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drawerSlideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.modal-sub-settings-box .modal-header {
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.03);
}

@media (max-width: 768px) {
  #modal-subtitle-settings .modal-sub-settings-box {
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
  }
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-text-action {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.825rem;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.btn-text-action:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.sub-settings-body {
  padding: 16px 20px 24px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sub-setting-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-group-title {
  font-size: 0.825rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setting-row label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Stepper Control (- 50% +) */
.stepper-control {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.btn-step {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: #ffffff;
  width: 26px;
  height: 26px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-step:hover {
  background: rgba(255, 255, 255, 0.15);
}

.stepper-value {
  font-size: 0.775rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: #ffffff;
  padding: 0 8px;
  min-width: 44px;
  text-align: center;
}

/* Color Picker Input */
.color-picker-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 32px;
  height: 22px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

.color-picker-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker-input::-webkit-color-swatch { border: none; border-radius: 3px; }

/* Setting Select */
.setting-select {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.775rem;
  outline: none;
  cursor: pointer;
}

/* Switch Toggle (iOS style) */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 18px;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-toggle .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .2s;
  border-radius: 18px;
}

.switch-toggle .slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

.switch-toggle input:checked + .slider {
  background-color: var(--accent-purple);
}

.switch-toggle input:checked + .slider:before {
  transform: translateX(18px);
}

/* ==========================================================================
   Local Folder Pre-Load Confirmation Modal Styles
   ========================================================================== */
.modal-folder-box {
  max-width: 680px;
  width: 90vw;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(139, 92, 246, 0.15);
  backdrop-filter: blur(20px);
}

.folder-scan-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.folder-scan-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(139, 92, 246, 0.2);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.folder-scan-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.folder-scan-status {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f3e8ff;
}

.folder-scan-subtext {
  font-size: 0.75rem;
  color: #94a3b8;
}

.folder-confirm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
  font-size: 1.4rem;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.7rem;
  color: #94a3b8;
  white-space: nowrap;
}

.folder-confirm-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
  margin: 0;
}

.folder-confirm-list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.folder-confirm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  transition: background 0.15s ease;
}

.folder-confirm-item:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(139, 92, 246, 0.3);
}

.folder-item-title {
  font-weight: 500;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 340px;
}

.folder-item-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   Toast Notification & Video Loading Overlay Engine
   ========================================================================== */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
  width: calc(100vw - 40px);
}

.toast-card {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border-color);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
}

.toast-card.toast-fadeOut {
  opacity: 0;
  transform: translateX(30px);
}

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

.toast-card.toast-info { border-color: rgba(6, 182, 212, 0.4); }
.toast-card.toast-success { border-color: rgba(16, 185, 129, 0.4); }
.toast-card.toast-warning { border-color: rgba(245, 158, 11, 0.4); }
.toast-card.toast-error { border-color: rgba(244, 63, 94, 0.4); }
.toast-card.toast-loading { border-color: rgba(139, 92, 246, 0.4); }

.toast-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* Video Wrapper Loading Overlay */
.video-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 20, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 22;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #ffffff;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.video-loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-purple);
  border-right-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.video-loading-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f1f5f9;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* ============================================================
   VIP Course Library & Auth Modal Styling
   ============================================================ */

.btn-vip-course {
  background: linear-gradient(135deg, #8b5cf6 0%, #d946ef 50%, #ec4899 100%) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 15px rgba(217, 70, 239, 0.35) !important;
  border: none !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.btn-vip-course:hover {
  transform: translateY(-2px) scale(1.02) !important;
  box-shadow: 0 6px 20px rgba(217, 70, 239, 0.55) !important;
  filter: brightness(1.1) !important;
}

.btn-vip-course:active {
  transform: translateY(0) scale(0.98) !important;
}

.btn-sm {
  padding: 6px 12px !important;
  font-size: 0.8rem !important;
}

.btn-outline-danger {
  background: rgba(239, 68, 68, 0.1) !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
  color: #ef4444 !important;
}

.btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: #ef4444 !important;
}

/* Modal Auth Box */
.modal-auth-box {
  max-width: 440px !important;
  border: 1px solid rgba(217, 70, 239, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(217, 70, 239, 0.2);
}

.auth-desc {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

.auth-input-group {
  display: flex;
  gap: 10px;
}

.auth-input-group input {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.4);
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-fast);
}

.auth-input-group input:focus {
  border-color: #d946ef;
  box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.25);
}

.auth-error-msg {
  color: #f43f5e;
  font-size: 0.85rem;
  margin-top: 10px;
  font-weight: 500;
}

/* Modal Course Library */
.modal-course-library-box {
  max-width: 960px !important;
  width: 92% !important;
  max-height: 88vh !important;
  display: flex;
  flex-direction: column;
}

.modal-title-with-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-vip {
  background: linear-gradient(135deg, #d946ef, #8b5cf6);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(217, 70, 239, 0.4);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.course-search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.course-search-bar input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-fast);
}

.course-search-bar input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.course-grid-container {
  flex: 1;
  overflow-y: auto;
  min-height: 300px;
  padding-right: 4px;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}

.course-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.course-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, #8b5cf6, #d946ef);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.course-card:hover {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.35);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 15px rgba(139, 92, 246, 0.15);
}

.course-card:hover::before {
  opacity: 1;
}

.course-card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.course-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

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

.course-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.4;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-card-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.course-card-action {
  width: 100%;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #d8b4fe;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.course-card:hover .course-card-action {
  background: var(--accent-purple);
  color: #ffffff;
  border-color: var(--accent-purple);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.course-loading-state,
.course-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-dim);
  text-align: center;
  gap: 16px;
}

.course-empty-state {
  font-size: 0.95rem;
}

/* ============================================================
   YouTube-Style Touch & Bottom Controls Integration
   ============================================================ */

/* Skip Buttons on Bottom Control Bar */
.btn-skip-bar {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 2px !important;
  padding: 6px 8px !important;
  border-radius: var(--radius-md) !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  color: var(--text-dim) !important;
  transition: var(--transition-fast) !important;
}

.btn-skip-bar:hover,
.btn-skip-bar:active {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.12) !important;
  transform: scale(1.08) !important;
}

.skip-bar-text {
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

/* YouTube Style Double Tap Ripple Feedback Indicators (0.4s fast fade) */
.gesture-ripple {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 45%;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
}

.gesture-ripple-left {
  left: 0;
  background: radial-gradient(circle at left center, rgba(139, 92, 246, 0.4) 0%, transparent 75%);
  border-radius: 0 50% 50% 0;
}

.gesture-ripple-right {
  right: 0;
  background: radial-gradient(circle at right center, rgba(139, 92, 246, 0.4) 0%, transparent 75%);
  border-radius: 50% 0 0 50%;
}

.gesture-ripple.active {
  animation: rippleFadeFast 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes rippleFadeFast {
  0% { opacity: 1; transform: scale(0.92); }
  60% { opacity: 0.9; transform: scale(1.02); }
  100% { opacity: 0; transform: scale(1.08); }
}

.ripple-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  padding: 12px 20px;
  border-radius: 30px;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.ripple-arrow {
  font-size: 1.5rem;
  font-weight: 800;
  color: #d946ef;
}

.ripple-text {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Seekbar Touch Hit Area Enhancement */
.seekbar-container {
  padding: 12px 0 !important;
  cursor: pointer;
}

.time-display {
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums !important;
  flex-shrink: 0 !important;
}

/* ============================================================
   Fullscreen & iPad Landscape Optimization Rules
   ============================================================ */

:fullscreen,
:-webkit-full-screen,
.video-wrapper.is-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: -webkit-fill-available !important;
  background: #000000 !important;
  z-index: 999999 !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

:fullscreen video,
:-webkit-full-screen video,
.video-wrapper.is-fullscreen video {
  width: 100% !important;
  height: 100% !important;
  max-height: 100vh !important;
  object-fit: contain !important;
}

:fullscreen .player-controls,
:-webkit-full-screen .player-controls,
.video-wrapper.is-fullscreen .player-controls {
  bottom: 0 !important;
  padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
  z-index: 1000000 !important;
}

body.fullscreen-active {
  overflow: hidden !important;
}

/* 🎬 Cinema Mode Overrides Layout for 100% Full Width Expansion */
.app-container.player-active.cinema-mode {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 16px 20px 40px 20px !important;
  height: auto !important;
  max-height: none !important;
}

.app-container.player-active.cinema-mode .main-content,
.app-container.player-active.cinema-mode .player-section {
  width: 100% !important;
  max-width: 100% !important;
  flex: none !important;
}

.app-container.player-active.cinema-mode .video-wrapper {
  position: relative !important;
  z-index: 1410 !important;
  width: 100% !important;
  max-height: 82vh !important;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.95), 0 0 60px rgba(139, 92, 246, 0.4) !important;
  border-color: rgba(139, 92, 246, 0.6) !important;
}

.app-container.player-active.cinema-mode .sidebar {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  margin-top: 20px !important;
  position: relative !important;
  z-index: 1390 !important;
}

/* iPad Landscape Grid Layout Fix (Screens 768px to 1180px in Landscape when Cinema mode is OFF) */
@media (min-width: 768px) and (max-width: 1180px) and (orientation: landscape) {
  .app-container.player-active:not(.cinema-mode) {
    display: grid !important;
    grid-template-columns: 1fr 340px !important;
    gap: 16px !important;
    height: auto !important;
  }

  .app-container.player-active:not(.cinema-mode) .main-content {
    min-width: 0 !important;
  }

  .app-container.player-active:not(.cinema-mode) .sidebar {
    width: 340px !important;
    height: 100% !important;
    min-height: 450px !important;
  }
}





