/* ============================================================
   UNLIMITED: AI App Builder — Course App
   Design System + Component Styles
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Colors */
  --bg-primary: #060a14;
  --bg-secondary: #0f1525;
  --bg-tertiary: #161d30;
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-glass-hover: rgba(255, 255, 255, 0.07);
  --bg-glass-strong: rgba(255, 255, 255, 0.1);

  --accent-blue: #3b82f6;
  --accent-blue-dim: rgba(59, 130, 246, 0.15);
  --accent-blue-glow: rgba(59, 130, 246, 0.4);
  --accent-purple: #8b5cf6;
  --accent-purple-dim: rgba(139, 92, 246, 0.15);
  --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --accent-gradient-hover: linear-gradient(135deg, #60a5fa, #a78bfa);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-accent: #60a5fa;

  --success: #22c55e;
  --success-dim: rgba(34, 197, 94, 0.15);
  --warning: #f59e0b;
  --warning-dim: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.15);

  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-xs: 0.6875rem;
  --font-sm: 0.8125rem;
  --font-base: 0.9375rem;
  --font-lg: 1.0625rem;
  --font-xl: 1.25rem;
  --font-2xl: 1.5rem;
  --font-3xl: 1.875rem;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.25rem;
  --space-2xl: 1.5rem;
  --space-3xl: 2rem;
  --space-4xl: 2.5rem;

  /* Border Radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
  --shadow-glow-purple: 0 0 20px rgba(139, 92, 246, 0.3);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --nav-height: 64px;
  --header-height: 56px;
  --max-width: 480px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
img, video { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ---------- App Shell ---------- */
#app-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  background: var(--bg-primary);
}

#app {
  padding-bottom: calc(var(--nav-height) + 16px);
  min-height: 100dvh;
  position: relative;
}

/* Page transition */
.page-enter { animation: pageEnter 0.3s ease forwards; }
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-tertiary); border-radius: 4px; }

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: var(--nav-height);
  background: rgba(6, 10, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  padding: 0 var(--space-sm);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-item .nav-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  opacity: 0.5;
  color: var(--text-secondary);
}

.nav-item .nav-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-tertiary);
  transition: all var(--transition-base);
  opacity: 0.55;
  transform: translateY(0);
  letter-spacing: 0.02em;
}

.nav-item.active .nav-icon {
  opacity: 1;
  color: var(--accent-blue);
  filter: drop-shadow(0 0 8px var(--accent-blue-glow));
}

.nav-item.active .nav-label {
  color: var(--accent-blue);
  opacity: 1;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: 0 0 4px 4px;
}

/* Badge notif on nav */
.nav-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

/* Hide nav on login/onboarding */
body.auth-page .bottom-nav { display: none; }
body.auth-page #app { padding-bottom: 0; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ---------- Glass Card ---------- */
.glass-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--transition-base);
}

.glass-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
}

.glass-card-strong {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--font-base);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-glow-blue);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-glass-strong);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

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

.btn-google {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 100%;
  padding: 0.85rem;
}

.btn-google:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-hover);
}

.btn-google img {
  width: 20px;
  height: 20px;
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-full { width: 100%; }

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: var(--font-sm);
  border-radius: var(--radius-sm);
}

.btn-copy {
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.btn-copy.copied {
  background: var(--success-dim);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.2);
}

/* ---------- Form Inputs ---------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.form-label {
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--font-base);
  outline: none;
  transition: all var(--transition-base);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-dim);
  background: var(--bg-secondary);
}

.form-input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-dim);
}

.form-error {
  font-size: var(--font-xs);
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Password toggle */
.input-wrapper {
  position: relative;
}

.input-wrapper .form-input {
  padding-right: 48px;
}

.input-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 1.1rem;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

/* ---------- Search Bar ---------- */
.search-bar {
  position: relative;
}

.search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.search-bar .form-input {
  padding-left: 42px;
  background: var(--bg-secondary);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 600;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-dim);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-dim);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-dim);
  color: var(--danger);
}

.badge-blue {
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
}

.badge-purple {
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
}

.badge-new {
  background: var(--danger);
  color: white;
  font-size: 0.625rem;
  padding: 0.15rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- Progress Ring ---------- */
.progress-ring-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}

.progress-ring-fill {
  fill: none;
  stroke: url(#progressGradient);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

.progress-ring-text {
  position: absolute;
  text-align: center;
}

.progress-ring-text .progress-percent {
  font-size: var(--font-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.progress-ring-text .progress-label {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---------- Video Card ---------- */
.video-card {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.video-card:active {
  transform: scale(0.98);
}

.video-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
}

.video-card-thumb {
  position: relative;
  width: 128px;
  min-width: 128px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.video-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Lock overlay for unreleased */
.video-card.locked .video-card-thumb img {
  opacity: 0.35;
  filter: blur(1px);
}

.video-card-lock {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  z-index: 2;
  color: rgba(255, 255, 255, 0.7);
}

.video-card-progress-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--warning);
  font-size: 0.625rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 2;
}

.video-card-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.video-card-key {
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--accent-blue);
}

.video-card-title {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-card-meta {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Status check icon */
.video-card-status {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.status-completed {
  color: var(--success);
  font-size: 1.1rem;
}

.status-available {
  color: var(--accent-blue);
  font-size: 1.1rem;
}

/* ---------- Comment Bubble ---------- */
.comment-item {
  padding: var(--space-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-sm);
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.comment-name {
  font-size: var(--font-sm);
  font-weight: 600;
}

.comment-admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--font-xs);
  color: var(--accent-blue);
  background: var(--accent-blue-dim);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.comment-time {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-left: auto;
}

.comment-body {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

.comment-reply {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--accent-blue-dim);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent-blue);
}

.comment-reply .comment-header {
  margin-bottom: 4px;
}

.comment-pending-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-sm);
  font-size: var(--font-xs);
  color: var(--warning);
}

/* Comment input */
.comment-input-wrapper {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
}

.comment-input-wrapper .form-input {
  flex: 1;
}

.comment-send-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  color: white;
  font-size: 1.2rem;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.comment-send-btn:hover {
  box-shadow: var(--shadow-glow-blue);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: var(--font-sm);
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Section Headers ---------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.section-title {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.section-link {
  font-size: var(--font-sm);
  color: var(--accent-blue);
  font-weight: 500;
}

/* ---------- Filter Chips ---------- */
.filter-chips {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: var(--font-sm);
  font-weight: 500;
  white-space: nowrap;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition-base);
  -webkit-tap-highlight-color: transparent;
}

.filter-chip.active {
  background: var(--accent-blue-dim);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* ---------- Loading Shimmer ---------- */
.shimmer {
  background: linear-gradient(90deg, var(--bg-glass) 0%, var(--bg-glass-strong) 50%, var(--bg-glass) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ---------- Empty State ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-4xl) var(--space-xl);
  text-align: center;
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
  opacity: 0.45;
  color: var(--text-tertiary);
}

.empty-state-title {
  font-size: var(--font-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state-desc {
  font-size: var(--font-sm);
  color: var(--text-tertiary);
}

/* ---------- Divider ---------- */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  color: var(--text-tertiary);
  font-size: var(--font-sm);
  margin: var(--space-2xl) 0;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Horizontal Scroll ---------- */
.h-scroll {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  margin: 0 calc(var(--space-xl) * -1);
  padding-left: var(--space-xl);
  padding-right: var(--space-xl);
}

.h-scroll::-webkit-scrollbar { display: none; }

/* ---------- Menu List ---------- */
.menu-list {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.menu-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.menu-item:hover { background: var(--bg-glass-hover); }
.menu-item:active { background: var(--bg-glass-strong); }

.menu-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.menu-item-text {
  flex: 1;
  font-size: var(--font-base);
  font-weight: 500;
}

.menu-item-arrow {
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

.menu-item.danger .menu-item-text { color: var(--danger); }

/* ============================================================
   PAGE: LOGIN
   ============================================================ */
.login-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-3xl) var(--space-xl);
  position: relative;
  overflow: hidden;
}

/* Ambient background glow */
.login-page::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -20%;
  right: -20%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-4xl);
  position: relative;
  z-index: 1;
}

.login-logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.3)); }
  50% { filter: drop-shadow(0 0 25px rgba(139, 92, 246, 0.5)); }
}

.login-logo h1 {
  font-size: var(--font-3xl);
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.login-logo p {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  position: relative;
  z-index: 1;
}

.login-alert {
  padding: var(--space-md) var(--space-lg);
  background: var(--danger-dim);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  color: var(--danger);
  display: none;
}

.login-alert.show { display: block; }

.login-register {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.login-register a {
  color: var(--accent-blue);
  font-weight: 600;
}

/* ============================================================
   PAGE: ONBOARDING
   ============================================================ */
.onboarding-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-3xl) var(--space-xl);
}

.onboarding-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.onboarding-header .emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.onboarding-header h1 {
  font-size: var(--font-2xl);
  font-weight: 700;
}

.onboarding-header p {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-top: var(--space-sm);
}

.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

/* ============================================================
   PAGE: HOME
   ============================================================ */
.home-page {
  padding: var(--space-xl);
}

.home-greeting {
  margin-bottom: var(--space-2xl);
}

.home-greeting h1 {
  font-size: var(--font-xl);
  font-weight: 700;
}

.home-greeting p {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Progress card */
.progress-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  display: flex;
  align-items: center;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
  position: relative;
  overflow: hidden;
}

.progress-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.progress-details {
  flex: 1;
}

.progress-details h3 {
  font-size: var(--font-base);
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.progress-details .progress-count {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: var(--bg-glass-strong);
  border-radius: var(--radius-full);
  margin-top: var(--space-md);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 1s ease;
}

/* Continue watching */
.continue-card {
  display: flex;
  gap: var(--space-lg);
  padding: var(--space-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
}

.continue-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
}

.continue-thumb {
  width: 160px;
  min-width: 160px;
  height: 90px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-tertiary);
  position: relative;
}

.continue-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.continue-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: white;
  backdrop-filter: blur(4px);
}

.continue-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.continue-info h4 {
  font-size: var(--font-sm);
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.continue-info .continue-meta {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

/* Mini announcement card on home */
.home-announcement {
  padding: var(--space-lg);
  background: var(--accent-blue-dim);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-lg);
  cursor: pointer;
}

.home-announcement h4 {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 4px;
}

.home-announcement p {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   PAGE: MATERI
   ============================================================ */
.materi-page {
  padding: var(--space-xl);
}

.materi-page h1 {
  font-size: var(--font-xl);
  font-weight: 700;
  margin-bottom: var(--space-xl);
}

.video-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

/* ============================================================
   PAGE: VIDEO DETAIL
   ============================================================ */
.video-page {
  padding-bottom: var(--space-xl);
}

.video-back-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-base);
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  -webkit-tap-highlight-color: transparent;
}

.video-back-bar:hover { color: var(--text-primary); }

/* Video player container */
.video-player-wrapper {
  width: 100%;
  background: #000;
  position: relative;
  aspect-ratio: 16/9;
}

.video-player-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.video-info {
  padding: var(--space-xl);
}

.video-info h1 {
  font-size: var(--font-lg);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.video-info .video-subtitle {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.video-description {
  padding: 0 var(--space-xl);
  margin-bottom: var(--space-xl);
}

.video-description-content {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.video-description-content.collapsed {
  max-height: 60px;
}

.video-description-toggle {
  font-size: var(--font-sm);
  color: var(--accent-blue);
  font-weight: 500;
  margin-top: var(--space-sm);
  display: inline-block;
}

.video-mark-done {
  padding: 0 var(--space-xl);
  margin-bottom: var(--space-2xl);
}

/* Comments section */
.comments-section {
  padding: 0 var(--space-xl);
}

.comments-section h2 {
  font-size: var(--font-base);
  font-weight: 600;
  margin-bottom: var(--space-lg);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

/* ============================================================
   PAGE: TEMPLATE PROMPT
   ============================================================ */
.template-page {
  padding: var(--space-xl);
}

.template-page h1 {
  font-size: var(--font-xl);
  font-weight: 700;
  margin-bottom: var(--space-xl);
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.template-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.template-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
}

.template-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.template-card-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
  flex-shrink: 0;
}

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

.template-card-info h3 {
  font-size: var(--font-base);
  font-weight: 600;
}

.template-card-info p {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.template-card-expand-icon {
  color: var(--text-tertiary);
  font-size: 0.9rem;
  transition: transform var(--transition-base);
}

.template-card.expanded .template-card-expand-icon {
  transform: rotate(180deg);
}

.template-card-body {
  display: none;
  padding: 0 var(--space-lg) var(--space-lg);
}

.template-card.expanded .template-card-body {
  display: block;
}

.template-prompt-text {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  background: var(--bg-secondary);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: var(--space-md);
}

/* ============================================================
   PAGE: PENGUMUMAN
   ============================================================ */
.pengumuman-page {
  padding: var(--space-xl);
}

.pengumuman-page h1 {
  font-size: var(--font-xl);
  font-weight: 700;
  margin-bottom: var(--space-xl);
}

.pengumuman-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.pengumuman-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  cursor: pointer;
  transition: all var(--transition-base);
  -webkit-tap-highlight-color: transparent;
}

.pengumuman-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
}

.pengumuman-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.pengumuman-card h3 {
  font-size: var(--font-base);
  font-weight: 600;
  flex: 1;
}

.pengumuman-card .pengumuman-date {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}

.pengumuman-card .pengumuman-preview {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pengumuman-card.expanded .pengumuman-preview {
  -webkit-line-clamp: unset;
  display: block;
}

/* ============================================================
   PAGE: PROFIL
   ============================================================ */
.profil-page {
  padding: var(--space-xl);
}

.profil-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: var(--space-2xl);
  padding: var(--space-2xl) 0;
}

.profil-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-2xl);
  font-weight: 700;
  color: white;
  margin-bottom: var(--space-lg);
  box-shadow: 0 0 0 4px var(--bg-primary), 0 0 0 6px rgba(59, 130, 246, 0.3);
}

.profil-header h1 {
  font-size: var(--font-xl);
  font-weight: 700;
}

.profil-header p {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Stats row */
.profil-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
}

.profil-stat {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
}

.profil-stat-value {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--accent-blue);
}

.profil-stat-label {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.profil-version {
  text-align: center;
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-2xl);
}

/* ============================================================
   UTILITY
   ============================================================ */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mt-3xl { margin-top: var(--space-3xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.hidden { display: none !important; }

/* Loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ============================================================
   RESPONSIVE - Tablet / Desktop
   ============================================================ */
@media (min-width: 481px) {
  #app-wrapper {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
  }
}

/* ============================================================
   EDIT PROFIL PAGE
   ============================================================ */
.edit-profil-page {
  padding: var(--space-xl) var(--space-lg);
  padding-bottom: calc(var(--nav-height) + var(--space-2xl));
  animation: fadeInUp 0.3s ease-out;
}

.edit-profil-back {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  margin-bottom: var(--space-xl);
  cursor: pointer;
  width: fit-content;
  transition: color var(--transition-base);
}
.edit-profil-back:hover { color: var(--text-primary); }

.edit-avatar-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
}

.edit-avatar-preview {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: white;
  overflow: hidden;
  border: 3px solid var(--bg-glass-strong);
  flex-shrink: 0;
}

.edit-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.edit-section-title {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
  margin-top: var(--space-xl);
}

.edit-section-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-xl) 0;
}

/* WA Bantuan Button */
.btn-wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-md);
  background: rgba(37, 211, 102, 0.1);
  border: 1px solid rgba(37, 211, 102, 0.3);
  border-radius: var(--radius-md);
  color: #25d366;
  font-size: var(--font-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  margin-top: var(--space-xl);
}
.btn-wa:hover {
  background: rgba(37, 211, 102, 0.18);
  border-color: rgba(37, 211, 102, 0.5);
}

/* Profil avatar with photo */
.profil-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ─── Watch Progress Bar ──────────────────────────────────── */
.watch-progress-bar-wrap {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.watch-progress-bar-track {
  height: 6px;
  background: var(--bg-glass-strong);
  border-radius: 99px;
  position: relative;
  overflow: visible;
  margin-bottom: 8px;
}

.watch-progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 99px;
  transition: width 0.5s ease;
  position: relative;
  min-width: 0;
}

/* Milestone marker di 50% */
.watch-progress-milestone {
  position: absolute;
  top: -3px;
  transform: translateX(-50%);
  width: 2px;
  height: 12px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 1px;
}

.watch-progress-label {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.5;
}

.watch-progress-label span {
  display: flex;
  align-items: center;
  gap: 5px;
}


/* ============================================================
   HOME: Watch Time Stats Row
   ============================================================ */
.home-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
}

.home-stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-base);
}

.home-stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle, rgba(59,130,246,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.home-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-blue-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
  margin-bottom: 2px;
}

.home-stat-value {
  font-size: var(--font-xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-stat-label {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================================================
   FULLSCREEN TOAST (injected inside .video-player-wrapper)
   ============================================================ */
.video-player-wrapper {
  position: relative;
}

.video-fs-toast {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #f8fafc;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 99999;
  opacity: 0;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(59,130,246,0.2);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.video-fs-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
