@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,400&display=swap');

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

:root {
  --bg:        #0d0f14;
  --bg2:       #13161d;
  --bg3:       #1a1e28;
  --surface:   #1e2330;
  --border:    rgba(255,255,255,0.08);
  --border-hi: rgba(255,255,255,0.15);
  --text:      #f0f2f8;
  --muted:     #7a8099;
  --accent:    #f5a623;
  --accent2:   #e85d4a;
  --green:     #4ade80;
  --blue:      #60a5fa;
  --purple:    #a78bfa;
  --radius:    12px;
  --radius-lg: 20px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: 1.2;
}

a { color: inherit; text-decoration: none; }

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  outline: none;
}

input, textarea {
  font-family: var(--font-body);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  transition: border-color 0.2s;
  width: 100%;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

input::placeholder, textarea::placeholder { color: var(--muted); }


.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}


.sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-logo .logo-text {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 20px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo .logo-text span {
  color: var(--text);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.18s;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(245,166,35,0.12); color: var(--accent); }

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-bottom {
  padding: 16px 12px 0;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}


.xp-widget {
  padding: 14px;
  background: var(--bg3);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.xp-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.xp-bar-track {
  background: var(--bg);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  transition: width 0.6s ease;
}


.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(245,166,35,0.1);
  border: 1px solid rgba(245,166,35,0.25);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

.content-area {
  padding: 32px;
  flex: 1;
}


.page { display: none; }
.page.active { display: block; }


.setup-hero {
  max-width: 680px;
  margin: 60px auto;
  text-align: center;
}

.setup-hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text) 40%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.setup-hero p {
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 40px;
}

.setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: left;
}

.setup-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--bg3);
  padding: 4px;
  border-radius: var(--radius);
}

.setup-tab {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: all 0.18s;
}

.setup-tab.active {
  background: var(--surface);
  color: var(--text);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: all 0.18s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #0d0f14;
}
.btn-primary:hover { background: #fbb93a; transform: translateY(-1px); }

.btn-outline {
  background: none;
  border: 1px solid var(--border-hi);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }
.btn-danger { background: var(--accent2); color: #fff; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }


.manual-video-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  max-height: 240px;
  overflow-y: auto;
}

.manual-video-item {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  background: var(--bg3);
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
}

.manual-video-item input { font-size: 13px; padding: 6px 10px; }

.btn-icon {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
  transition: color 0.15s;
}

.btn-icon:hover { color: var(--accent2); }


.course-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.course-meta h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}

.course-meta .sub {
  color: var(--muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.course-meta .sub span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.progress-ring-wrap { flex-shrink: 0; text-align: center; }

.progress-ring-wrap .ring-label {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  fill: var(--text);
}

.progress-ring-wrap .ring-sub {
  font-size: 12px;
  fill: var(--muted);
}

.lessons-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  transition: border-color 0.2s, transform 0.15s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.lesson-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--border);
  transition: background 0.2s;
}

.lesson-card:hover { border-color: var(--border-hi); transform: translateX(2px); }
.lesson-card:hover::before { background: var(--accent); }
.lesson-card.completed::before { background: var(--green); }
.lesson-card.active-lesson::before { background: var(--accent); }
.lesson-card.locked { opacity: 0.5; cursor: not-allowed; }
.lesson-card.locked:hover { transform: none; }

.lesson-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  flex-shrink: 0;
}

.lesson-card.completed .lesson-num {
  background: rgba(74,222,128,0.15);
  color: var(--green);
}

.lesson-card.active-lesson .lesson-num {
  background: rgba(245,166,35,0.15);
  color: var(--accent);
}

.lesson-info .lesson-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.lesson-info .lesson-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.deadline-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 500;
}

.deadline-tag.ok { background: rgba(74,222,128,0.1); color: var(--green); }
.deadline-tag.soon { background: rgba(245,166,35,0.1); color: var(--accent); }
.deadline-tag.overdue { background: rgba(232,93,74,0.1); color: var(--accent2); }
.deadline-tag.done { background: rgba(74,222,128,0.1); color: var(--green); }

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


.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform 0.2s;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.modal-body { padding: 24px; }

.video-embed {
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}


.quiz-section { margin-top: 24px; }

.quiz-section h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.quiz-section .quiz-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}

.quiz-question-block {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.quiz-question-text {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  text-align: left;
  color: var(--text);
  font-family: var(--font-body);
  width: 100%;
}

.quiz-option:hover { border-color: var(--accent); }
.quiz-option.selected { border-color: var(--accent); background: rgba(245,166,35,0.08); }
.quiz-option.correct { border-color: var(--green); background: rgba(74,222,128,0.1); color: var(--green); }
.quiz-option.wrong { border-color: var(--accent2); background: rgba(232,93,74,0.1); color: var(--accent2); }
.quiz-option:disabled { cursor: default; }

.quiz-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

.quiz-result {
  text-align: center;
  padding: 24px;
  background: var(--bg3);
  border-radius: var(--radius);
  margin-top: 16px;
}

.quiz-result .score-big {
  font-family: var(--font-head);
  font-size: 48px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.quiz-result .score-label {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
}


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

.badge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-align: center;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.badge-card.earned {
  border-color: rgba(245,166,35,0.4);
  background: linear-gradient(145deg, var(--surface), rgba(245,166,35,0.05));
}

.badge-card.locked-badge { opacity: 0.4; filter: grayscale(1); }

.badge-icon {
  font-size: 40px;
  margin-bottom: 10px;
  display: block;
}

.badge-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}

.badge-desc {
  font-size: 11px;
  color: var(--muted);
}

.badge-earned-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent);
  color: #0d0f14;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
}


.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: all;
  max-width: 320px;
}

.toast.show { transform: translateX(0); }
.toast.success .toast-icon { color: var(--green); }
.toast.warning .toast-icon { color: var(--accent); }
.toast.error .toast-icon { color: var(--accent2); }


.badge-popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.badge-popup.show { opacity: 1; pointer-events: all; }

.badge-popup-inner {
  background: var(--bg2);
  border: 1px solid rgba(245,166,35,0.5);
  border-radius: var(--radius-lg);
  padding: 40px 48px;
  text-align: center;
  box-shadow: 0 0 80px rgba(245,166,35,0.15), var(--shadow);
  animation: popIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.badge-popup-icon { font-size: 64px; display: block; margin-bottom: 12px; }

.badge-popup h3 {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 6px;
}

.badge-popup p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 20px;
}


.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.stat-card .stat-val {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 2px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--muted);
}

.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 360px; margin: 0 auto 24px; }


::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }


@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content-area { padding: 20px 16px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .course-header { flex-direction: column; }
  .badges-grid { grid-template-columns: repeat(2, 1fr); }
}
