/* ================================================================
   RKoots Learning Platform — learn.css
   ================================================================ */

:root {
  --primary: #667eea;
  --primary-dark: #5a6fd8;
  --secondary: #764ba2;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --bg: #f8f9fc;
  --surface: #ffffff;
  --surface2: #f1f3f9;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --sidebar-w: 280px;
  --header-h: 60px;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(102,126,234,0.08);
  --shadow-hover: 0 8px 30px rgba(102,126,234,0.18);
  --transition: all 0.25s ease;
}

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

html { scroll-behavior: smooth; }

.learn-body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── HEADER ── */
.learn-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.learn-header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  padding: 0 20px;
  max-width: 100%;
}
.learn-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-link {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}
.brand-link i { font-size: 1.4rem; }
.brand-link span { color: var(--text); }
.brand-link strong { color: var(--primary); }

.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.1rem; padding: 6px;
  border-radius: 6px; transition: var(--transition);
  display: none;
}
.sidebar-toggle:hover { background: var(--surface2); color: var(--primary); }

/* Search */
.learn-search-wrap { flex: 1; max-width: 500px; position: relative; }
.learn-search {
  display: flex; align-items: center;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 0 16px;
  transition: var(--transition);
}
.learn-search:focus-within {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
}
.search-icon { color: var(--text-muted); margin-right: 8px; font-size: 0.9rem; }
.learn-search input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 0.9rem; color: var(--text); padding: 9px 0;
  font-family: inherit;
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-hover);
  max-height: 320px; overflow-y: auto; z-index: 200;
  display: none;
}
.search-results.open { display: block; }
.sr-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer; transition: var(--transition);
  text-decoration: none; color: inherit;
}
.sr-item:hover { background: var(--surface2); }
.sr-item-icon { color: var(--primary); font-size: 1rem; width: 20px; text-align: center; }
.sr-item-text strong { display: block; font-size: 0.9rem; }
.sr-item-text small { color: var(--text-muted); font-size: 0.8rem; }

/* Header Nav */
.learn-header-nav { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 24px; font-size: 0.85rem;
  font-weight: 600; cursor: pointer; border: none; text-decoration: none;
  transition: var(--transition); font-family: inherit;
}
.nav-btn-ghost {
  background: var(--surface2); color: var(--text);
  border: 1.5px solid var(--border);
}
.nav-btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.nav-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white; border: none;
}
.nav-btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.user-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 24px; padding: 4px 14px 4px 4px;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.85rem; overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.auth-name { font-size: 0.85rem; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-signout {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 0.85rem; padding: 2px 4px;
  border-radius: 4px; transition: var(--transition);
}
.btn-signout:hover { color: var(--danger); }

/* ── LAYOUT ── */
.learn-layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ── SIDEBAR ── */
.learn-sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}
.learn-sidebar::-webkit-scrollbar { width: 4px; }
.learn-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-muted); }
.sidebar-count { font-size: 0.75rem; color: var(--primary); font-weight: 600; }

.sidebar-nav { flex: 1; padding: 8px 0; }

/* Category in sidebar */
.sb-category { margin-bottom: 4px; }
.sb-cat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 20px; cursor: pointer;
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted);
  transition: var(--transition);
  user-select: none;
}
.sb-cat-header:hover { color: var(--primary); }
.sb-cat-arrow { transition: transform 0.25s; font-size: 0.7rem; }
.sb-category.open .sb-cat-arrow { transform: rotate(90deg); }
.sb-cat-courses { display: none; }
.sb-category.open .sb-cat-courses { display: block; }

.sb-course {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px 9px 32px;
  cursor: pointer; transition: var(--transition);
  font-size: 0.875rem; color: var(--text-muted);
  border-left: 3px solid transparent;
  text-decoration: none;
}
.sb-course:hover { background: var(--surface2); color: var(--text); }
.sb-course.active {
  background: rgba(102,126,234,0.08);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.sb-course-icon { font-size: 0.9rem; width: 18px; text-align: center; }
.sb-course-tag {
  margin-left: auto; font-size: 0.65rem; background: rgba(102,126,234,0.12);
  color: var(--primary); padding: 2px 6px; border-radius: 8px; font-weight: 600;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.sidebar-dash-link {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
}
.sidebar-dash-link:hover { background: rgba(102,126,234,0.2); }

/* ── MAIN CONTENT ── */
.learn-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding: 32px;
}

.learn-view { max-width: 900px; margin: 0 auto; }
.learn-view.hidden { display: none; }

/* ── HOME ── */
.home-hero {
  text-align: center;
  padding: 60px 20px 50px;
  background: linear-gradient(135deg, rgba(102,126,234,0.05) 0%, rgba(118,75,162,0.05) 100%);
  border-radius: 24px;
  margin-bottom: 48px;
  border: 1px solid rgba(102,126,234,0.1);
}
.home-hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white; padding: 6px 16px; border-radius: 24px;
  font-size: 0.8rem; font-weight: 700; margin-bottom: 20px;
}
.home-hero h1 {
  font-size: 3rem; font-weight: 800; line-height: 1.2;
  color: var(--text); margin-bottom: 16px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.home-hero p {
  color: var(--text-muted); font-size: 1.1rem; max-width: 540px;
  margin: 0 auto 28px;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 36px; }
.hero-stats {
  display: flex; justify-content: center; gap: 40px; flex-wrap: wrap;
}
.hstat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hstat strong { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.hstat span { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.section-heading {
  font-size: 1.4rem; font-weight: 700; color: var(--text);
  margin-bottom: 24px; display: flex; align-items: center; gap: 10px;
}
.section-heading i { color: var(--primary); }

/* Course Grid */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.course-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.course-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.3s ease;
}
.course-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); border-color: rgba(102,126,234,0.3); }
.course-card:hover::before { transform: scaleX(1); }
.cc-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: white; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}
.cc-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.cc-desc { font-size: 0.83rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px; }
.cc-meta { display: flex; justify-content: space-between; align-items: center; }
.cc-difficulty {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  padding: 3px 8px; border-radius: 12px;
}
.cc-difficulty.beginner { background: #e8f5e9; color: #2e7d32; }
.cc-difficulty.intermediate { background: #fff3e0; color: #e65100; }
.cc-difficulty.advanced { background: #fce4ec; color: #c62828; }
.cc-questions { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

/* ── TOPIC VIEW ── */
.topic-breadcrumb {
  font-size: 0.82rem; color: var(--text-muted); margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.topic-breadcrumb a { color: var(--primary); text-decoration: none; }
.topic-breadcrumb a:hover { text-decoration: underline; }
.topic-breadcrumb .sep { color: var(--border); }

.topic-header {
  display: flex; gap: 20px; align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.topic-icon-wrap {
  width: 64px; height: 64px; border-radius: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; color: white;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}
.topic-meta { flex: 1; min-width: 0; }
.topic-meta h1 { font-size: 1.7rem; font-weight: 800; margin-bottom: 10px; }
.topic-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.topic-tag {
  background: rgba(102,126,234,0.1); color: var(--primary);
  padding: 3px 10px; border-radius: 10px; font-size: 0.76rem; font-weight: 600;
}
.topic-info { display: flex; gap: 16px; flex-wrap: wrap; }
.topic-info span {
  font-size: 0.82rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 5px;
}
.topic-info span i { color: var(--primary); }
.topic-actions { flex-shrink: 0; }

.btn-cert {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white; border: none; padding: 12px 22px;
  border-radius: 12px; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; transition: var(--transition); font-family: inherit;
}
.btn-cert:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(245,158,11,0.4); }

/* Progress bar */
.topic-progress-bar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 20px;
  display: flex; align-items: center; gap: 14px; margin-bottom: 24px;
}
.progress-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.progress-track { flex: 1; height: 8px; background: var(--surface2); border-radius: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 8px; transition: width 0.6s ease; }
.progress-value { font-size: 0.85rem; font-weight: 700; color: var(--primary); white-space: nowrap; }

/* Topic Body */
.topic-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
  line-height: 1.8;
}
.topic-body h2 { font-size: 1.3rem; font-weight: 700; color: var(--text); margin: 28px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--surface2); }
.topic-body h2:first-child { margin-top: 0; }
.topic-body h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin: 20px 0 10px; }
.topic-body h4 { font-size: 0.95rem; font-weight: 700; color: var(--primary); margin: 16px 0 8px; }
.topic-body p { color: var(--text-muted); margin-bottom: 14px; }
.topic-body ul, .topic-body ol { margin: 10px 0 16px 20px; color: var(--text-muted); }
.topic-body li { margin-bottom: 6px; }
.topic-body code {
  background: var(--surface2); color: var(--primary);
  padding: 2px 6px; border-radius: 4px; font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}
.topic-body pre {
  background: #1e293b; color: #e2e8f0; padding: 20px;
  border-radius: var(--radius); overflow-x: auto; margin: 16px 0;
  font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; line-height: 1.6;
}
.topic-body pre code { background: none; color: inherit; padding: 0; }
.topic-body strong { color: var(--text); font-weight: 700; }
.topic-body a { color: var(--primary); }
.topic-body blockquote {
  border-left: 4px solid var(--primary); padding: 12px 16px;
  background: rgba(102,126,234,0.06); border-radius: 0 8px 8px 0;
  margin: 16px 0; color: var(--text-muted); font-style: italic;
}
.phase-box {
  background: linear-gradient(135deg, rgba(102,126,234,0.05), rgba(118,75,162,0.05));
  border: 1px solid rgba(102,126,234,0.15);
  border-radius: 12px; padding: 20px; margin: 16px 0;
}
.phase-box h4 { color: var(--primary); margin: 0 0 10px; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; }

.cert-callout {
  display: flex; align-items: center; gap: 20px;
  background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(217,119,6,0.1));
  border: 1.5px solid rgba(245,158,11,0.3);
  border-radius: 16px; padding: 24px 28px;
}
.cert-callout-icon { font-size: 2.5rem; color: #d97706; flex-shrink: 0; }
.cert-callout-text { flex: 1; }
.cert-callout-text strong { display: block; font-size: 1rem; color: var(--text); margin-bottom: 4px; }
.cert-callout-text p { color: var(--text-muted); font-size: 0.875rem; margin: 0; }

/* ── BUTTONS ── */
.btn-primary, .btn-primary-lg {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white; border: none; border-radius: 24px;
  font-weight: 600; cursor: pointer; transition: var(--transition);
  font-family: inherit;
}
.btn-primary { padding: 9px 20px; font-size: 0.875rem; }
.btn-primary-lg { padding: 13px 28px; font-size: 1rem; }
.btn-primary:hover, .btn-primary-lg:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(102,126,234,0.4); opacity: 0.95; }

.btn-ghost, .btn-ghost-lg {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface2); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 24px;
  font-weight: 600; cursor: pointer; transition: var(--transition);
  font-family: inherit;
}
.btn-ghost { padding: 9px 20px; font-size: 0.875rem; }
.btn-ghost-lg { padding: 13px 28px; font-size: 1rem; }
.btn-ghost:hover, .btn-ghost-lg:hover { border-color: var(--primary); color: var(--primary); }

.btn-warning {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white; border: none; border-radius: 10px;
  padding: 11px 28px; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; transition: var(--transition); font-family: inherit;
}
.btn-warning:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(102,126,234,0.4); }

/* ── MODALS ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,20,40,0.7); backdrop-filter: blur(4px);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--surface); border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
  max-height: 92vh; overflow-y: auto; position: relative;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--surface2); border: none; border-radius: 50%;
  width: 36px; height: 36px; cursor: pointer; font-size: 1rem;
  color: var(--text-muted); transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--danger); color: white; }

/* ── EXAM MODAL ── */
.exam-modal-box { width: 100%; max-width: 680px; }
.exam-screen { padding: 40px; }
.exam-screen.hidden { display: none; }

.exam-start-icon { font-size: 3rem; color: var(--primary); text-align: center; margin-bottom: 16px; }
.exam-modal-box h2 { text-align: center; font-size: 1.6rem; font-weight: 800; margin-bottom: 28px; }

.exam-rules { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
.rule-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface2); border-radius: 10px; padding: 12px 16px;
  font-size: 0.9rem;
}
.rule-item i { color: var(--primary); width: 18px; text-align: center; }

.auth-gate {
  text-align: center; background: rgba(102,126,234,0.06);
  border: 1px solid rgba(102,126,234,0.2);
  border-radius: 12px; padding: 20px; margin-bottom: 20px;
}
.auth-gate p { color: var(--text-muted); margin-bottom: 14px; font-size: 0.9rem; }
.exam-start-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Exam Active */
.exam-header-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 28px; gap: 20px;
}
.exam-progress-info { flex: 1; }
.exam-question-counter { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; display: block; }
.exam-progress-mini { height: 6px; background: var(--surface2); border-radius: 6px; overflow: hidden; }
.exam-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 6px; transition: width 0.4s ease; }
.exam-timer {
  display: flex; align-items: center; gap: 6px;
  font-size: 1rem; font-weight: 700; color: var(--primary);
  background: rgba(102,126,234,0.1); padding: 8px 16px; border-radius: 20px;
  flex-shrink: 0;
}
.exam-timer.urgent { color: var(--danger); background: rgba(220,53,69,0.1); animation: timerPulse 1s infinite; }
@keyframes timerPulse { 0%,100%{opacity:1} 50%{opacity:0.6} }

.question-area { margin-bottom: 28px; }
.question-text {
  font-size: 1rem; font-weight: 600; color: var(--text);
  margin-bottom: 20px; line-height: 1.6;
}
.question-options { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface2); border: 2px solid var(--border);
  border-radius: 10px; padding: 13px 16px; cursor: pointer;
  transition: var(--transition); font-size: 0.9rem; text-align: left;
  font-family: inherit; color: var(--text);
}
.option-btn:hover { border-color: var(--primary); background: rgba(102,126,234,0.06); }
.option-btn.selected { border-color: var(--primary); background: rgba(102,126,234,0.1); color: var(--primary); font-weight: 600; }
.option-label {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--border); font-weight: 700; font-size: 0.8rem;
}
.option-btn.selected .option-label { background: var(--primary); color: white; }

.exam-nav-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.question-dots { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; flex: 1; }
.qdot {
  width: 8px; height: 8px; border-radius: 50%; cursor: pointer;
  background: var(--border); transition: var(--transition);
}
.qdot.answered { background: var(--primary); }
.qdot.current { background: var(--secondary); transform: scale(1.4); }

.exam-submit-row { text-align: center; margin-top: 8px; }

/* Result */
.result-icon { font-size: 4rem; text-align: center; margin-bottom: 12px; }
.result-icon.pass { color: var(--success); }
.result-icon.fail { color: var(--danger); }
.result-score-display { display: flex; align-items: center; gap: 32px; justify-content: center; margin: 24px 0; flex-wrap: wrap; }
.score-ring { position: relative; width: 120px; height: 120px; }
.score-ring svg { width: 100%; height: 100%; }
.score-number {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 800; color: var(--primary);
}
.score-breakdown { display: flex; flex-direction: column; gap: 10px; }
.sb-item { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 600; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.result-message { text-align: center; color: var(--text-muted); margin-bottom: 24px; }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── CERTIFICATE MODAL ── */
.cert-modal-box { width: 100%; max-width: 800px; padding: 24px; }
.cert-actions-top { display: flex; gap: 10px; justify-content: flex-end; margin-bottom: 16px; }

/* Certificate Paper */
.certificate-paper {
  background: #fff;
  border: 8px solid transparent;
  border-image: linear-gradient(135deg, #c8a96e, #f0d080, #c8a96e, #a0784a) 1;
  padding: 48px 52px;
  font-family: 'Georgia', serif;
  text-align: center;
  position: relative;
  box-shadow: inset 0 0 40px rgba(200,169,110,0.12);
}
.cert-watermark {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 8rem; color: rgba(102,126,234,0.05);
  pointer-events: none; user-select: none;
}
.cert-header-line {
  font-size: 0.75rem; letter-spacing: 4px; text-transform: uppercase;
  color: #8b6914; margin-bottom: 12px; font-family: 'Inter', sans-serif;
}
.cert-logo-area { margin-bottom: 16px; }
.cert-logo-icon { font-size: 2.4rem; color: #c8a96e; }
.cert-org { font-size: 0.9rem; font-weight: 700; color: #667eea; letter-spacing: 2px; text-transform: uppercase; font-family: 'Inter', sans-serif; }

.cert-title-block { margin: 20px 0; }
.cert-main-title { font-size: 2.2rem; color: #1e293b; font-weight: 700; margin-bottom: 4px; }
.cert-subtitle { font-size: 0.75rem; letter-spacing: 3px; text-transform: uppercase; color: #8b6914; font-family: 'Inter', sans-serif; }

.cert-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, #c8a96e, #f0d080, #c8a96e, transparent);
  margin: 20px auto; width: 80%;
}

.cert-presented-to { font-size: 0.85rem; color: #64748b; font-family: 'Inter', sans-serif; margin-bottom: 4px; }
.cert-name { font-size: 2rem; font-weight: 700; color: #1e293b; font-style: italic; margin-bottom: 16px; }

.cert-body-text {
  font-size: 0.9rem; color: #475569; line-height: 1.7;
  max-width: 560px; margin: 0 auto 20px; font-family: 'Inter', sans-serif;
}
.cert-course-name { font-size: 1.15rem; font-weight: 700; color: #667eea; display: block; margin: 4px 0 10px; font-family: 'Inter', sans-serif; font-style: normal; }
.cert-seal {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white; padding: 6px 16px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  font-family: 'Inter', sans-serif; margin-bottom: 20px;
}

.cert-meta-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 12px;
  font-family: 'Inter', sans-serif; font-size: 0.78rem;
  border-top: 1px solid rgba(200,169,110,0.3);
  border-bottom: 1px solid rgba(200,169,110,0.3);
  padding: 14px 0; margin: 16px 0; color: #64748b;
}
.cert-meta-item strong { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: #8b6914; margin-bottom: 2px; }

.cert-signatures {
  display: flex; justify-content: space-around; margin-top: 28px;
  font-family: 'Inter', sans-serif;
}
.cert-sig-block { text-align: center; }
.cert-sig-line { width: 140px; height: 1px; background: #1e293b; margin: 0 auto 6px; }
.cert-sig-name { font-size: 0.8rem; font-weight: 700; color: #1e293b; }
.cert-sig-title { font-size: 0.7rem; color: #64748b; }

.cert-license-bar {
  margin-top: 16px; font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; color: #94a3b8; letter-spacing: 0.5px;
}

/* ── DASHBOARD ── */
.dash-body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); }
.dash-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 32px; height: var(--header-h); display: flex; align-items: center; justify-content: space-between; position: sticky; top:0; z-index:100; }
.dash-brand { font-size: 1.1rem; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; text-decoration: none; }
.dash-container { max-width: 1100px; margin: 0 auto; padding: 40px 24px; }
.dash-welcome { margin-bottom: 36px; }
.dash-welcome h1 { font-size: 1.8rem; font-weight: 800; }
.dash-welcome p { color: var(--text-muted); }

.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 36px; }
.dash-stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 24px; display: flex; align-items: center; gap: 16px;
}
.dash-stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: white;
}
.dash-stat-icon.blue { background: linear-gradient(135deg, #667eea, #764ba2); }
.dash-stat-icon.green { background: linear-gradient(135deg, #28a745, #20c997); }
.dash-stat-icon.gold { background: linear-gradient(135deg, #f59e0b, #d97706); }
.dash-stat-num { font-size: 1.8rem; font-weight: 800; }
.dash-stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.dash-section-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.dash-section-title i { color: var(--primary); }

.dash-cert-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 36px; }
.dash-cert-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; gap: 16px; align-items: flex-start;
  transition: var(--transition);
}
.dash-cert-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.dash-cert-badge {
  width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: white;
}
.dash-cert-info { flex: 1; min-width: 0; }
.dash-cert-course { font-size: 0.95rem; font-weight: 700; margin-bottom: 4px; }
.dash-cert-score { font-size: 0.82rem; color: var(--success); font-weight: 600; margin-bottom: 4px; }
.dash-cert-date { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 10px; }
.dash-cert-actions { display: flex; gap: 8px; }
.dash-btn {
  padding: 5px 12px; border-radius: 8px; font-size: 0.75rem;
  font-weight: 600; cursor: pointer; border: 1.5px solid var(--border);
  background: var(--surface2); color: var(--text); transition: var(--transition);
  font-family: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
}
.dash-btn:hover { border-color: var(--primary); color: var(--primary); }
.dash-btn.primary { background: var(--primary); color: white; border-color: var(--primary); }
.dash-btn.primary:hover { opacity: 0.9; }

.dash-leaderboard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.lb-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.lb-row:last-child { border-bottom: none; }
.lb-rank { width: 28px; font-weight: 700; color: var(--text-muted); text-align: center; }
.lb-rank.top { color: #f59e0b; }
.lb-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.85rem; overflow: hidden;
}
.lb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lb-name { flex: 1; font-weight: 600; }
.lb-course { font-size: 0.78rem; color: var(--text-muted); }
.lb-score { font-weight: 700; color: var(--primary); }

.dash-empty {
  text-align: center; padding: 48px 20px; color: var(--text-muted);
}
.dash-empty i { font-size: 2.5rem; color: var(--border); margin-bottom: 12px; display: block; }

/* ── TOAST ── */
.learn-toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #1e293b; color: white;
  padding: 12px 20px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 600;
  z-index: 9999; opacity: 0; transform: translateY(12px);
  transition: all 0.3s ease; pointer-events: none;
}
.learn-toast.show { opacity: 1; transform: translateY(0); }
.learn-toast.success { background: var(--success); }
.learn-toast.error { background: var(--danger); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .learn-sidebar {
    transform: translateX(-100%);
    z-index: 500;
  }
  .learn-sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.15); }
  .learn-main { margin-left: 0; padding: 20px; }
  .sidebar-toggle { display: flex; }
  .home-hero h1 { font-size: 2.2rem; }
  .topic-header { flex-direction: column; }
  .topic-actions { width: 100%; }
  .btn-cert { width: 100%; justify-content: center; }
}
@media (max-width: 600px) {
  .learn-header-inner { gap: 10px; }
  .learn-search-wrap { max-width: none; }
  .learn-header-nav .auth-name { display: none; }
  .cert-meta-grid { grid-template-columns: 1fr 1fr; }
  .certificate-paper { padding: 28px 20px; }
  .cert-main-title { font-size: 1.5rem; }
  .cert-name { font-size: 1.4rem; }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 499;
}
.sidebar-overlay.show { display: block; }
