/* ============================================
   AUTH & COURSE PAGES — Premium Dark Navy Theme
   ============================================ */

:root {
  --navy-deep: #0b0e1a;
  --navy-card: #111627;
  --navy-surface: #161b2e;
  --navy-sidebar: #0d1120;
  --blue-glow: #3b82f6;
  --blue-accent: #60a5fa;
  --blue-soft: rgba(59, 130, 246, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(59, 130, 246, 0.25);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-sm: 10px;
}

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

.auth-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--navy-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

.auth-body::before {
  content: '';
  position: fixed;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Glass Card ---- */
.auth-card {
  background: var(--navy-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35), 0 0 80px rgba(59, 130, 246, 0.04);
  position: relative;
  z-index: 1;
}

/* ---- Google Button ---- */
.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--navy-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
}
.auth-google-btn:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
}
.auth-google-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---- Status ---- */
.auth-status {
  font-size: 13px;
  color: var(--blue-accent);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.auth-status.visible { opacity: 1; }
.auth-status.error { color: #f87171; }

/* ---- Divider / Link ---- */
.auth-divider { border-top: 1px solid var(--border-subtle); }
.auth-link { color: var(--text-muted); font-size: 13px; text-decoration: none; transition: color 0.2s; }
.auth-link:hover { color: var(--blue-accent); }

/* ---- Footer ---- */
.auth-footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
}

/* ---- Denied Card ---- */
.denied-card {
  background: var(--navy-card);
  border: 1px solid rgba(248, 113, 113, 0.15);
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}
.denied-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(248, 113, 113, 0.08);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.denied-icon svg { width: 28px; height: 28px; color: #f87171; }

.auth-cta-btn {
  display: inline-block; padding: 12px 28px; font-size: 14px; font-weight: 600;
  color: #fff; background: var(--blue-glow); border: none; border-radius: var(--radius-sm);
  text-decoration: none; cursor: pointer; transition: all 0.25s ease;
}
.auth-cta-btn:hover { box-shadow: 0 0 20px rgba(59, 130, 246, 0.3); transform: translateY(-1px); }

/* ---- Spinner ---- */
.auth-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--blue-accent);
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* ---- Animations ---- */
@keyframes authFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-animate { animation: authFadeUp 0.5s ease forwards; }
.auth-animate-delay-1 { opacity: 0; animation: authFadeUp 0.5s ease 0.1s forwards; }
.auth-animate-delay-2 { opacity: 0; animation: authFadeUp 0.5s ease 0.2s forwards; }
.auth-animate-delay-3 { opacity: 0; animation: authFadeUp 0.5s ease 0.3s forwards; }

/* ============================================
   COURSE PAGE — Layout
   ============================================ */

/* Topbar */
.course-topbar {
  background: var(--navy-card);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 40;
}
.course-topbar-inner {
  max-width: 100%; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-logo {
  font-size: 18px; font-weight: 700; color: var(--blue-accent);
  text-decoration: none; letter-spacing: -0.3px;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-email { font-size: 13px; color: var(--text-secondary); }
.topbar-email strong { color: var(--text-primary); font-weight: 600; }
.topbar-logout-btn {
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  background: transparent; border: 1px solid var(--border-subtle);
  border-radius: 8px; padding: 6px 16px; cursor: pointer; transition: all 0.2s;
}
.topbar-logout-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }

/* Sidebar + Main Layout */
.course-layout {
  display: flex;
  min-height: calc(100vh - 49px);
}

/* Sidebar */
.course-sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--navy-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 49px;
  height: calc(100vh - 49px);
  overflow: hidden;
  z-index: 30;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.sidebar-title {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.sidebar-title svg { color: var(--blue-accent); }

.sidebar-search-wrap {
  position: relative;
}
.sidebar-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.sidebar-search {
  width: 100%;
  padding: 9px 12px 9px 32px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--navy-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}
.sidebar-search::placeholder { color: var(--text-muted); }
.sidebar-search:focus { border-color: var(--border-hover); }

.sidebar-progress {
  margin-top: 12px;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.sidebar-progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--blue-glow), var(--blue-accent));
  border-radius: 3px;
  transition: width 0.4s ease;
}
.sidebar-progress-label {
  font-size: 11px; color: var(--text-muted); margin-top: 6px;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.sidebar-list::-webkit-scrollbar { width: 4px; }
.sidebar-list::-webkit-scrollbar-track { background: transparent; }
.sidebar-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.sidebar-item:hover {
  background: rgba(59, 130, 246, 0.05);
  color: var(--text-primary);
}
.sidebar-item.active {
  background: rgba(59, 130, 246, 0.08);
  color: var(--blue-accent);
  border-left-color: var(--blue-accent);
}
.sidebar-item-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 22px;
}
.sidebar-item.active .sidebar-item-num { color: var(--blue-accent); }
.sidebar-item.hidden { display: none; }

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 50;
  width: 44px; height: 44px;
  background: var(--blue-glow);
  border: none; border-radius: 50%;
  color: #fff; cursor: pointer;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
  align-items: center; justify-content: center;
}
.sidebar-toggle svg { width: 20px; height: 20px; }

/* Main Content */
.course-main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 0;
  overflow-y: auto;
}

.course-main-header {
  margin-bottom: 28px;
}
.course-main-header-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  flex-wrap: wrap;
}
.course-main-header h1 {
  font-size: 24px; font-weight: 800; margin: 0 0 4px;
  background: linear-gradient(135deg, var(--text-primary), var(--blue-accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.course-main-header p {
  font-size: 14px; color: var(--text-muted); margin: 0;
}
.course-stats {
  display: flex; gap: 16px;
}
.course-stat {
  text-align: center;
  padding: 10px 18px;
  background: var(--navy-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.course-stat-num {
  display: block; font-size: 20px; font-weight: 800; color: var(--blue-accent);
}
.course-stat-label {
  display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px;
}

/* Video Episode Block */
.episode-block {
  margin-bottom: 44px;
  scroll-margin-top: 80px;
}
.episode-label {
  font-size: 15px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
}
.episode-badge {
  font-size: 11px; font-weight: 700; color: var(--blue-accent);
  background: var(--blue-soft);
  padding: 3px 10px; border-radius: 6px;
  white-space: nowrap;
}
.episode-title-text {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* playerShell — Video Container */
.playerShell {
  position: relative;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.playerShell-iframe {
  padding: 56.25% 0 0 0;
  position: relative;
  z-index: 1;
}
.playerShell-iframe.tall { padding: 62.5% 0 0 0; }
.playerShell-iframe iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;
}

/* Watermark — ABOVE iframe */
.wm {
  position: absolute; inset: 0;
  pointer-events: none; user-select: none;
  overflow: hidden;
  z-index: 9999;
}
.wm-layer {
  position: absolute; top: -80%; left: -80%; width: 260%; height: 260%;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 36px 48px;
  transform: rotate(-18deg);
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}
.wm-text {
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.18);
  letter-spacing: 0.5px;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Fullscreen Button */
.fs-btn {
  position: absolute;
  bottom: 10px; right: 10px;
  z-index: 10001;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0;
}
.playerShell:hover .fs-btn { opacity: 1; }
.fs-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  transform: scale(1.05);
}

/* Fullscreen styles */
.playerShell:fullscreen,
.playerShell:-webkit-full-screen {
  width: 100vw; height: 100vh;
  background: #000;
  border-radius: 0;
  border: none;
}
.playerShell:fullscreen .playerShell-iframe,
.playerShell:-webkit-full-screen .playerShell-iframe {
  padding: 0; width: 100%; height: 100%;
}
.playerShell:fullscreen .playerShell-iframe iframe,
.playerShell:-webkit-full-screen .playerShell-iframe iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.playerShell:fullscreen .wm,
.playerShell:-webkit-full-screen .wm {
  z-index: 9999;
}
.playerShell:fullscreen .licenseBadge,
.playerShell:-webkit-full-screen .licenseBadge {
  z-index: 10000;
  top: 14px; right: 14px;
  font-size: 11px; padding: 4px 12px;
}
.playerShell:fullscreen .fs-btn,
.playerShell:-webkit-full-screen .fs-btn {
  opacity: 1;
  bottom: 20px; right: 20px;
  width: 42px; height: 42px;
}

/* License Badge — top-right pill */
.licenseBadge {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 10000;
  pointer-events: none; user-select: none;
  padding: 3px 10px;
  font-size: 10px; font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  letter-spacing: 0.2px;
  -webkit-font-smoothing: antialiased;
}

/* Nav Buttons */
.episode-nav {
  display: flex; gap: 10px; margin-top: 14px;
}
.ep-nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 20px; font-size: 13px; font-weight: 600;
  color: var(--text-secondary); background: var(--navy-card);
  border: 1px solid var(--border-subtle); border-radius: 10px;
  cursor: pointer; transition: all 0.2s;
}
.ep-nav-btn svg { flex-shrink: 0; }
.ep-nav-btn:hover { border-color: var(--border-hover); color: var(--text-primary); background: var(--navy-surface); }
.ep-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.sidebar-item-title {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Copyright Notice */
.copyright-notice {
  background: var(--navy-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin: 20px 0 40px;
}
.copyright-notice h3 {
  font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.copyright-notice h3 svg { width: 18px; height: 18px; color: #f59e0b; }
.copyright-notice ul {
  list-style: none; padding: 0;
}
.copyright-notice li {
  font-size: 13px; color: var(--text-secondary); padding: 5px 0; padding-left: 20px;
  position: relative; line-height: 1.5;
}
.copyright-notice li::before {
  content: '•'; position: absolute; left: 6px; color: var(--text-muted);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .course-sidebar {
    position: fixed;
    left: -300px;
    top: 49px;
    height: calc(100vh - 49px);
    z-index: 45;
    transition: left 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }
  .course-sidebar.open { left: 0; }
  .sidebar-toggle { display: flex; }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0; top: 49px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 44;
  }
  .sidebar-overlay.open { display: block; }
  .course-main { padding: 20px 16px 0; }
}

@media (max-width: 600px) {
  .topbar-email { display: none; }
  .course-main-header h1 { font-size: 18px; }
  .wm-text { font-size: 10px; }
  .licenseBadge { font-size: 8px; padding: 2px 8px; top: 5px; right: 5px; }
  .course-stats { display: none; }
}

.lazy-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0d1120;
}
.lazy-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(59,130,246,0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: lazySpin 0.8s linear infinite;
}
@keyframes lazySpin {
  to { transform: rotate(360deg); }
}
