/* ─── YouLearn Design System — YouXperience ─── */
:root {
  --purple: #9B4DCA;
  --purple-dark: #7B35A8;
  --purple-light: #B668E0;
  --gold: #F5A623;
  --gold-dark: #D4891A;
  --dark: #0A0A18;
  --dark-2: #12122A;
  --dark-3: #1A1A35;
  --dark-4: #22224A;
  --text: #E8E8F0;
  --text-muted: #8888AA;
  --text-dim: #5566AA;
  --border: rgba(155, 77, 202, 0.2);
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--dark);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── SIDEBAR ─── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--dark-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.25s ease, transform 0.25s ease;
}
.sidebar.closed { width: 60px; }
.sidebar.closed .logo-text,
.sidebar.closed .nav-item span,
.sidebar.closed .nav-label,
.sidebar.closed .user-details { display: none; }
.sidebar.closed .user-info { justify-content: center; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 16px 20px;
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo-y {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--purple), var(--gold));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700; font-size: 18px;
  color: white; flex-shrink: 0;
}
.logo-text { font-family: 'Cormorant Garamond', serif; font-size: 18px; font-weight: 600; color: var(--text); }
.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px; border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.sidebar-toggle:hover { color: var(--text); background: var(--dark-3); }

.sidebar-nav { flex: 1; padding: 16px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none;
  font-size: 14px; font-weight: 400;
  transition: all 0.2s; white-space: nowrap;
  margin-bottom: 2px;
}
.nav-item:hover { color: var(--text); background: var(--dark-3); }
.nav-item.active { color: var(--purple-light); background: rgba(155, 77, 202, 0.15); }
.nav-item svg { flex-shrink: 0; }
.nav-divider { height: 1px; background: var(--border); margin: 12px 4px; }
.nav-label { font-size: 11px; font-weight: 500; color: var(--text-dim); padding: 4px 12px; letter-spacing: 0.08em; text-transform: uppercase; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.user-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--gold));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: white; flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); }
.logout-btn { color: var(--text-muted); padding: 6px; border-radius: 6px; transition: all 0.2s; flex-shrink: 0; }
.logout-btn:hover { color: #EF4444; background: rgba(239,68,68,0.1); }

/* ─── MAIN CONTENT ─── */
.main-content {
  min-height: 100vh;
  transition: margin-left 0.25s ease;
  padding: 0;
}
.main-content.sidebar-open { margin-left: var(--sidebar-w); }

/* ─── PAGE HEADER ─── */
.page-header {
  padding: 40px 48px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--dark-2);
}
.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 32px; font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.page-subtitle { font-size: 14px; color: var(--text-muted); }
.page-body { padding: 40px 48px; }

/* ─── CARDS ─── */
.card {
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}
.card:hover { transform: translateY(-2px); border-color: var(--purple); }

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
.course-card {
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.2s, border-color 0.2s;
}
.course-card:hover { transform: translateY(-4px); border-color: var(--purple); }
.course-cover {
  width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--dark-3), var(--dark-4));
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.course-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-cover-placeholder {
  font-family: 'Cormorant Garamond', serif;
  font-size: 48px; font-weight: 300; color: var(--purple);
  opacity: 0.5;
}
.course-progress-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: rgba(255,255,255,0.1);
}
.course-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--gold));
  transition: width 0.5s ease;
}
.course-body { padding: 20px; }
.course-category {
  font-size: 11px; font-weight: 500; color: var(--purple-light);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.course-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px; font-weight: 600; color: var(--text);
  line-height: 1.3; margin-bottom: 8px;
}
.course-meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--text-muted);
}
.access-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 500;
}
.badge-lifetime { background: rgba(245,166,35,0.15); color: var(--gold); border: 1px solid rgba(245,166,35,0.3); }
.badge-3month { background: rgba(155,77,202,0.15); color: var(--purple-light); border: 1px solid var(--border); }
.badge-expired { background: rgba(239,68,68,0.1); color: #EF4444; border: 1px solid rgba(239,68,68,0.2); }

/* ─── PROGRESS RING ─── */
.progress-ring-container { position: relative; display: inline-flex; }
.progress-ring-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--purple-light);
}

/* ─── VIDEO PLAYER ─── */
.player-container {
  background: #000;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
}
.player-container video { width: 100%; height: 100%; display: block; }

/* ─── MODULE TREE ─── */
.module-tree { display: flex; flex-direction: column; gap: 12px; }
.module-item {
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.module-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; cursor: pointer;
  transition: background 0.2s;
}
.module-header:hover { background: var(--dark-3); }
.module-title { font-weight: 500; color: var(--text); font-size: 15px; }
.module-count { font-size: 12px; color: var(--text-muted); }
.module-lessons { border-top: 1px solid var(--border); }
.lesson-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(155,77,202,0.08);
  text-decoration: none; color: var(--text-muted);
  transition: all 0.2s; font-size: 14px;
}
.lesson-item:last-child { border-bottom: none; }
.lesson-item:hover { background: var(--dark-3); color: var(--text); }
.lesson-item.completed { color: var(--purple-light); }
.lesson-item.active { background: rgba(155,77,202,0.1); color: var(--text); }
.lesson-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.2s;
}
.lesson-item.completed .lesson-check {
  background: var(--purple); border-color: var(--purple);
}
.lesson-duration { margin-left: auto; font-size: 12px; color: var(--text-dim); }

/* ─── QUIZ ─── */
.quiz-container { margin-top: 32px; }
.quiz-question { margin-bottom: 24px; }
.question-text { font-size: 16px; font-weight: 500; color: var(--text); margin-bottom: 12px; }
.option-list { display: flex; flex-direction: column; gap: 8px; }
.option-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.2s; color: var(--text-muted); font-size: 14px;
}
.option-item:hover { border-color: var(--purple); color: var(--text); background: rgba(155,77,202,0.05); }
.option-item.selected { border-color: var(--purple); background: rgba(155,77,202,0.15); color: var(--text); }
.option-item.correct { border-color: #22C55E; background: rgba(34,197,94,0.1); color: #22C55E; }
.option-item.wrong { border-color: #EF4444; background: rgba(239,68,68,0.1); color: #EF4444; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: none; text-decoration: none; transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: white;
}
.btn-primary:hover { background: linear-gradient(135deg, var(--purple-light), var(--purple)); transform: translateY(-1px); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: white;
}
.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--purple); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px;
  background: var(--dark-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 14px; font-family: inherit;
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--purple);
}
.form-textarea { min-height: 100px; resize: vertical; }

/* ─── UPLOAD ZONE ─── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 32px; text-align: center;
  cursor: pointer; transition: all 0.2s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--purple); background: rgba(155,77,202,0.05);
}
.upload-icon { color: var(--purple); margin-bottom: 16px; }
.upload-text { color: var(--text-muted); font-size: 14px; }
.upload-text strong { color: var(--text); }

/* ─── TABLE ─── */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { font-size: 11px; font-weight: 500; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table td { padding: 14px 16px; border-bottom: 1px solid rgba(155,77,202,0.08); color: var(--text-muted); }
.table tr:hover td { background: var(--dark-3); }

/* ─── FLASH MESSAGES ─── */
.flash-messages { position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 20px; border-radius: var(--radius-sm); font-size: 14px; max-width: 360px; border-left: 3px solid; }
.flash-success { background: rgba(34,197,94,0.1); border-color: #22C55E; color: #22C55E; }
.flash-error { background: rgba(239,68,68,0.1); border-color: #EF4444; color: #EF4444; }
.flash-info { background: rgba(155,77,202,0.1); border-color: var(--purple); color: var(--purple-light); }
.flash-warning { background: rgba(245,166,35,0.1); border-color: var(--gold); color: var(--gold); }

/* ─── STAT CARDS ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--dark-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-value { font-family: 'Cormorant Garamond', serif; font-size: 36px; font-weight: 600; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ─── LOGIN ─── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 50%, rgba(155,77,202,0.08) 0%, var(--dark) 70%); }
.login-card { width: 100%; max-width: 400px; background: var(--dark-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-title { font-family: 'Cormorant Garamond', serif; font-size: 28px; font-weight: 600; color: var(--text); text-align: center; margin-bottom: 8px; }
.login-sub { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 32px; }

/* ─── TRANSCRIPT ─── */
.transcript-section { margin-top: 24px; }
.transcript-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-muted); font-size: 14px; padding: 8px 0; }
.transcript-toggle:hover { color: var(--text); }
.transcript-content { margin-top: 12px; padding: 16px; background: var(--dark-3); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-muted); line-height: 1.8; max-height: 300px; overflow-y: auto; }

/* ─── EMPTY STATE ─── */
.empty-state { text-align: center; padding: 64px 32px; }
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-title { font-family: 'Cormorant Garamond', serif; font-size: 24px; color: var(--text); margin-bottom: 8px; }
.empty-text { color: var(--text-muted); font-size: 14px; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content.sidebar-open { margin-left: 0; }
  .page-header, .page-body { padding: 24px 20px; }
  .course-grid { grid-template-columns: 1fr; }
}
