/* public/css/app.css — Learn@OctaWeb LMS */

:root {
  --navy-900: #0a0a1a;
  --navy-800: #1a1a2e;
  --navy-700: #16213e;
  --navy-600: #0f3460;
  --accent:   #1a1aff;
  --accent-h: #0a0aee;
  --teal:     #00b4d8;
  --gold:     #f5a623;
  --sidebar-w: 260px;
  --topbar-h:  64px;
}

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

html, body { height: 100%; font-family: 'Outfit', sans-serif; font-size: 15px; color: #0f172a; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed; left: 0; top: 0; height: 100vh; width: var(--sidebar-w);
  background: linear-gradient(180deg, #1a1a2e 0%, #0f0f23 100%);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column; z-index: 40;
  overflow-y: auto;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.05); flex-shrink: 0;
}
.logo-icon {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 900; font-size: 16px; flex-shrink: 0;
}
.logo-text { color: #fff; font-weight: 700; font-size: 14px; letter-spacing: -.3px; }
.logo-at   { color: #7dd3fc; }

.sidebar-nav { flex: 1; padding: 16px 8px; }
.nav-section {
  padding: 6px 12px 4px; font-size: 11px; font-weight: 600;
  color: #475569; text-transform: uppercase; letter-spacing: .08em;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; font-size: 13px;
  font-weight: 500; color: #94a3b8; text-decoration: none;
  transition: all .15s; cursor: pointer; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; }
.nav-item.active::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: #7dd3fc; margin-left: auto;
}
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-top: 1px solid rgba(255,255,255,.05); flex-shrink: 0;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #4d4dff);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.user-name  { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.user-email { font-size: 11px; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.logout-btn {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: #475569; transition: color .15s; padding: 4px; border-radius: 6px;
}
.logout-btn:hover { color: #7dd3fc; }

/* ── Main layout ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; width: calc(100% - var(--sidebar-w));
}
.topbar {
  position: sticky; top: 0; height: var(--topbar-h); z-index: 30;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; padding: 0 24px; gap: 16px;
}
.topbar-search { position: relative; flex: 1; max-width: 380px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #94a3b8; }
.search-input {
  width: 100%; padding: 8px 16px 8px 36px; font-family: inherit; font-size: 13px;
  border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc;
  outline: none; transition: all .15s;
}
.search-input:focus { border-color: #1a1aff; box-shadow: 0 0 0 3px rgba(26,26,255,.1); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.role-badge {
  display: inline-flex; align-items: center; padding: 4px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 700; border: 1px solid;
}
.role-admin         { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.role-training_team { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.role-staff         { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }

.page-main { flex: 1; padding: 28px; }

/* ── Flash messages ────────────────────────────────────────── */
.flash {
  display: flex; align-items: center; gap: 8px;
  margin: 0 28px; padding: 12px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  animation: slideDown .3s ease-out;
}
.flash-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }

/* ── Cards ─────────────────────────────────────────────────── */
.card { background: #fff; border-radius: 16px; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.card-hover { transition: all .2s; }
.card-hover:hover { box-shadow: 0 6px 24px rgba(0,0,0,.08); transform: translateY(-2px); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  background: #1a1aff; color: #fff; font-family: inherit;
  font-size: 13px; font-weight: 600; padding: 10px 18px;
  border-radius: 10px; border: none; cursor: pointer; text-decoration: none;
  transition: all .15s; box-shadow: 0 1px 3px rgba(26,26,255,.3);
}
.btn-primary:hover { background: #0a0aee; box-shadow: 0 4px 12px rgba(26,26,255,.35); transform: translateY(-1px); }
.btn-primary:active { transform: scale(.98); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: #374151; font-family: inherit;
  font-size: 13px; font-weight: 600; padding: 10px 18px;
  border-radius: 10px; border: 1px solid #e2e8f0; cursor: pointer; text-decoration: none;
  transition: all .15s;
}
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; color: #64748b; font-family: inherit;
  font-size: 13px; font-weight: 500; padding: 8px 12px;
  border-radius: 8px; border: none; cursor: pointer; text-decoration: none;
  transition: all .15s;
}
.btn-ghost:hover { background: #f1f5f9; color: #1e293b; }
.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fef2f2; color: #dc2626; font-family: inherit;
  font-size: 13px; font-weight: 600; padding: 10px 18px;
  border-radius: 10px; border: 1px solid #fecaca; cursor: pointer; text-decoration: none;
  transition: all .15s;
}
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: 6px; }

/* ── Forms ─────────────────────────────────────────────────── */
.label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 14px; font-family: inherit; font-size: 13px;
  border: 1px solid #e2e8f0; border-radius: 10px; background: #fff;
  color: #0f172a; outline: none; transition: all .15s;
}
.input::placeholder, .textarea::placeholder { color: #94a3b8; }
.input:focus, .select:focus, .textarea:focus {
  border-color: #1a1aff; box-shadow: 0 0 0 3px rgba(26,26,255,.1);
}
.textarea { resize: vertical; }
.select { appearance: none; cursor: pointer; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid;
}
.badge-green  { background:#f0fdf4; color:#166534; border-color:#bbf7d0; }
.badge-amber  { background:#fffbeb; color:#92400e; border-color:#fde68a; }
.badge-red    { background:#fef2f2; color:#991b1b; border-color:#fecaca; }
.badge-blue   { background:#eff6ff; color:#1e40af; border-color:#bfdbfe; }
.badge-slate  { background:#f8fafc; color:#475569; border-color:#e2e8f0; }
.badge-purple { background:#faf5ff; color:#6b21a8; border-color:#e9d5ff; }

/* ── Stats card ────────────────────────────────────────────── */
.stat-card { display:flex; align-items:flex-start; gap:16px; padding:20px; }
.stat-icon { width:48px; height:48px; border-radius:14px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.stat-icon svg { width:20px; height:20px; }
.stat-value { font-size:26px; font-weight:800; color:#0f172a; line-height:1; margin:4px 0 2px; }
.stat-label { font-size:12px; font-weight:500; color:#64748b; }
.stat-sub   { font-size:11px; color:#94a3b8; margin-top:2px; }

/* ── Page header ───────────────────────────────────────────── */
.page-title    { font-size:22px; font-weight:800; color:#0f172a; letter-spacing:-.3px; }
.page-subtitle { font-size:13px; color:#64748b; margin-top:4px; }

/* ── Progress bar ──────────────────────────────────────────── */
.progress-track { height:8px; border-radius:999px; background:#f1f5f9; overflow:hidden; }
.progress-fill  { height:100%; border-radius:999px; background:linear-gradient(90deg,#1a1aff,#4d4dff); transition:width .4s ease; }

/* ── Table ─────────────────────────────────────────────────── */
.table-wrapper { overflow:hidden; }
.table { width:100%; border-collapse:collapse; font-size:13px; }
.table th { padding:12px 16px; text-align:left; font-size:11px; font-weight:600; color:#64748b; text-transform:uppercase; letter-spacing:.06em; background:#f8fafc; border-bottom:1px solid #e2e8f0; }
.table td { padding:14px 16px; border-bottom:1px solid #f1f5f9; color:#374151; vertical-align:middle; }
.table tr:last-child td { border-bottom:none; }
.table tbody tr:hover td { background:#fafafa; }

/* ── Course card ───────────────────────────────────────────── */
.course-card { overflow:hidden; display:flex; flex-direction:column; text-decoration:none; color:inherit; }
.course-band { height:6px; width:100%; }
.course-body { padding:20px; flex:1; display:flex; flex-direction:column; }
.course-title { font-weight:700; font-size:14px; color:#0f172a; line-height:1.4; margin-bottom:6px; }
.course-desc  { font-size:12px; color:#64748b; line-height:1.5; margin-bottom:12px; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.course-meta  { display:flex; align-items:center; gap:12px; font-size:11px; color:#94a3b8; margin-bottom:12px; }
.course-meta svg { width:11px; height:11px; }
.course-footer { display:flex; align-items:center; justify-content:space-between; margin-top:auto; padding-top:12px; border-top:1px solid #f1f5f9; }

/* ── Module accordion ──────────────────────────────────────── */
.module-item { overflow:hidden; }
.module-header { display:flex; align-items:center; gap:12px; padding:14px 16px; cursor:pointer; background:#fff; transition:background .15s; user-select:none; }
.module-header:hover { background:#fafafa; }
.module-icon  { width:32px; height:32px; border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:14px; flex-shrink:0; }
.module-body  { padding:0 16px 16px; border-top:1px solid #f1f5f9; background:#fafafa; }
.module-body-inner { padding-top:16px; }

/* ── Quiz question ─────────────────────────────────────────── */
.quiz-card    { background:#fffbeb; border:1px solid #fde68a; border-radius:12px; padding:16px; }
.quiz-q-label { display:inline-flex; align-items:center; padding:2px 8px; background:#fde68a; color:#92400e; font-size:11px; font-weight:700; border-radius:999px; margin-bottom:10px; }
.answer-option { display:flex; align-items:center; gap:10px; padding:10px 14px; border-radius:10px; border:2px solid #e2e8f0; background:#fff; cursor:pointer; transition:all .15s; margin-bottom:6px; }
.answer-option:hover  { border-color:#cbd5e1; }
.answer-option.correct { border-color:#10b981; background:#f0fdf4; }
.answer-option.wrong   { border-color:#ef4444; background:#fef2f2; }
.answer-option.selected { border-color:#1a1aff; background:#f0f0ff; }

/* ── Certificate ───────────────────────────────────────────── */
.cert-wrapper {
  background: linear-gradient(145deg,#0a0a1a 0%,#1a1a2e 40%,#0f3460 100%);
  border-radius: 20px; position:relative; overflow:hidden;
  font-family: 'Outfit', sans-serif;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
  aspect-ratio: 1.414/1;
  max-width: 860px; margin: 0 auto;
}
.cert-border-outer { position:absolute; inset:12px; border:1px solid rgba(255,255,255,.08); border-radius:12px; pointer-events:none; }
.cert-border-inner  { position:absolute; inset:16px; border:1px solid rgba(255,255,255,.04); border-radius:8px; pointer-events:none; }
.cert-gold-top    { position:absolute; top:0; left:0; right:0; height:5px; background:linear-gradient(90deg,transparent 0%,var(--gold) 20%,#ffd700 50%,var(--gold) 80%,transparent 100%); }
.cert-gold-bottom { position:absolute; bottom:0; left:0; right:0; height:5px; background:linear-gradient(90deg,transparent 0%,var(--gold) 20%,#ffd700 50%,var(--gold) 80%,transparent 100%); }
.cert-content  { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:40px; }
.cert-logo     { font-size:24px; font-weight:900; color:#fff; margin-bottom:12px; }
.cert-logo-at  { color:var(--accent); }
.cert-type     { font-size:10px; font-weight:700; letter-spacing:.3em; text-transform:uppercase; color:var(--gold); margin-bottom:16px; }
.cert-divider  { display:flex; align-items:center; gap:12px; width:100%; max-width:480px; margin-bottom:16px; }
.cert-divider-line { flex:1; height:1px; opacity:.25; }
.cert-divider-dot  { width:6px; height:6px; border-radius:50%; background:var(--gold); }
.cert-issued-to    { font-size:13px; color:#94a3b8; margin-bottom:8px; }
.cert-name         { font-family:'DM Serif Display',serif; font-size:40px; color:#fff; margin-bottom:12px; line-height:1.1; }
.cert-completed    { font-size:13px; color:#94a3b8; margin-bottom:10px; }
.cert-course       { padding:12px 24px; border-radius:10px; background:rgba(233,69,96,.15); border:1px solid rgba(233,69,96,.3); margin-bottom:16px; }
.cert-course-name  { font-size:17px; font-weight:700; color:#fff; }
.cert-meta         { display:flex; align-items:center; gap:32px; margin-bottom:16px; }
.cert-score        { font-size:36px; font-weight:800; color:var(--gold); text-align:center; }
.cert-score-label  { font-size:12px; color:#94a3b8; }
.cert-date         { font-size:16px; font-weight:700; color:#fff; text-align:center; }
.cert-date-label   { font-size:12px; color:#94a3b8; }
.cert-verify       { font-family:monospace; font-size:10px; color:rgba(255,255,255,.2); margin-top:8px; }

/* ── Grid helpers ──────────────────────────────────────────── */
.grid-2 { display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
.grid-3 { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.grid-4 { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
@media (max-width:768px) { .grid-4,.grid-3 { grid-template-columns:repeat(2,1fr); } .grid-2 { grid-template-columns:1fr; } }

/* ── Utility ───────────────────────────────────────────────── */
.flex      { display:flex; }
.flex-col  { display:flex; flex-direction:column; }
.items-center { align-items:center; }
.items-start  { align-items:flex-start; }
.justify-between { justify-content:space-between; }
.gap-2  { gap:8px; }
.gap-3  { gap:12px; }
.gap-4  { gap:16px; }
.gap-6  { gap:24px; }
.mt-1   { margin-top:4px; }
.mt-2   { margin-top:8px; }
.mt-3   { margin-top:12px; }
.mt-4   { margin-top:16px; }
.mt-6   { margin-top:24px; }
.mb-1   { margin-bottom:4px; }
.mb-2   { margin-bottom:8px; }
.mb-3   { margin-bottom:12px; }
.mb-4   { margin-bottom:16px; }
.mb-6   { margin-bottom:24px; }
.ml-auto{ margin-left:auto; }
.p-4    { padding:16px; }
.p-5    { padding:20px; }
.p-6    { padding:24px; }
.p-8    { padding:32px; }
.px-4   { padding-left:16px; padding-right:16px; }
.py-2   { padding-top:8px; padding-bottom:8px; }
.text-xs  { font-size:11px; }
.text-sm  { font-size:13px; }
.text-base{ font-size:15px; }
.text-lg  { font-size:17px; }
.text-xl  { font-size:20px; }
.text-2xl { font-size:24px; }
.font-medium{ font-weight:500; }
.font-semibold{ font-weight:600; }
.font-bold{ font-weight:700; }
.font-black{font-weight:900; }
.text-slate-400{ color:#94a3b8; }
.text-slate-500{ color:#64748b; }
.text-slate-600{ color:#475569; }
.text-slate-700{ color:#334155; }
.text-slate-900{ color:#0f172a; }
.text-accent  { color: #1a1aff; }
.text-center  { text-align:center; }
.truncate  { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.line-clamp-2 { overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.w-full   { width:100%; }
.rounded-xl  { border-radius:12px; }
.rounded-2xl { border-radius:16px; }
.opacity-0   { opacity:0; }
.space-y-3 > * + * { margin-top:12px; }
.space-y-4 > * + * { margin-top:16px; }
.space-y-5 > * + * { margin-top:20px; }
.max-w-xl  { max-width:576px; }
.max-w-2xl { max-width:672px; }
.max-w-5xl { max-width:1024px; }
.max-w-7xl { max-width:1280px; }
.border-t  { border-top:1px solid #f1f5f9; }
.hidden    { display:none !important; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.5); display:flex; align-items:center; justify-content:center; z-index:100; padding:16px; }
.modal { background:#fff; border-radius:20px; padding:24px; max-width:480px; width:100%; box-shadow:0 24px 80px rgba(0,0,0,.2); animation:slideUp .25s ease-out; }
@keyframes slideUp { from{opacity:0;transform:translateY(16px);} to{opacity:1;transform:translateY(0);} }

/* ── Login page ────────────────────────────────────────────── */
.login-page {
  min-height:100vh; background: linear-gradient(135deg, #1a1aff 0%, #0505cc 50%, #0a0aee 100%); display:flex; align-items:center; justify-content:center; padding:16px;
  position:relative; overflow:hidden;
}
.login-glow-1 { position:absolute; top:-20%; right:-10%; width:500px; height:500px; border-radius:50%; background:radial-gradient(circle,rgba(255,255,255,.12) 0%,transparent 70%); pointer-events:none; }
.login-glow-2 { position:absolute; bottom:-20%; left:-10%; width:400px; height:400px; border-radius:50%; background:radial-gradient(circle,rgba(0,180,216,.15) 0%,transparent 70%); pointer-events:none; }
.login-grid   { position:absolute; inset:0; opacity:.06; background-image:linear-gradient(rgba(255,255,255,.15) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.15) 1px,transparent 1px); background-size:60px 60px; pointer-events:none; }
.login-card   { position:relative; width:100%; max-width:420px; background:rgba(10,10,30,.7); border:1px solid rgba(255,255,255,.15); border-radius:24px; padding:32px; backdrop-filter:blur(20px); }
.login-logo   { text-align:center; margin-bottom:28px; }
.login-logo-text { font-size:36px; font-weight:900; color:#fff; line-height:1; }
.login-logo-at   { color:#7dd3fc; }
.login-tagline   { font-size:13px; color:rgba(255,255,255,.55); margin-top:6px; }
.login-divider   { display:flex; align-items:center; gap:12px; margin-bottom:24px; }
.login-divider-line { flex:1; height:1px; background:rgba(255,255,255,.15); }
.login-divider-text { font-size:11px; color:rgba(255,255,255,.4); font-weight:500; }
.ms-btn {
  width:100%; display:flex; align-items:center; justify-content:center; gap:12px;
  background:#fff; color:#1a1a2e; font-family:inherit; font-size:14px; font-weight:600;
  padding:16px; border-radius:14px; border:none; cursor:pointer; transition:all .2s;
  box-shadow:0 2px 8px rgba(0,0,0,.2);
}
.ms-btn:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(0,0,0,.25); }
.login-info { margin-top:20px; padding:14px; background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.15); border-radius:10px; font-size:12px; color:rgba(255,255,255,.7); text-align:center; line-height:1.6; }
.login-footer { position:fixed; bottom:16px; left:0; right:0; text-align:center; font-size:11px; color:rgba(255,255,255,.4); }

/* ── Player layout ─────────────────────────────────────────── */
.player-layout { display:flex; height:calc(100vh - var(--topbar-h)); margin:-28px; overflow:hidden; }
.player-sidebar { width:280px; flex-shrink:0; border-right:1px solid #e2e8f0; background:#fff; display:flex; flex-direction:column; overflow:hidden; }
.player-sidebar-header { padding:16px; border-bottom:1px solid #f1f5f9; flex-shrink:0; }
.player-content { flex:1; overflow-y:auto; background:#f8fafc; }
.player-inner   { max-width:760px; margin:0 auto; padding:32px; }
.module-nav-item { display:flex; align-items:flex-start; gap:10px; padding:10px 12px; border-radius:10px; cursor:pointer; transition:all .15s; margin-bottom:2px; text-align:left; border:none; background:none; width:100%; }
.module-nav-item:hover { background:#f8fafc; }
.module-nav-item.active { background:rgba(26,26,255,.06); border:1px solid rgba(26,26,255,.15); }
.module-nav-item.active .mnav-title { color:#1a1aff; }
.mnav-title { font-size:12px; font-weight:600; color:#374151; line-height:1.3; }
.mnav-type  { font-size:11px; color:#94a3b8; margin-top:2px; }

/* ── Empty states ──────────────────────────────────────────── */
.empty-state { padding:64px 32px; text-align:center; }
.empty-icon  { font-size:48px; margin-bottom:16px; opacity:.4; }
.empty-title { font-size:16px; font-weight:700; color:#374151; margin-bottom:6px; }
.empty-desc  { font-size:13px; color:#94a3b8; }

/* ── Spinner ───────────────────────────────────────────────── */
.spinner { display:inline-block; width:16px; height:16px; border:2px solid rgba(255,255,255,.3); border-top-color:#fff; border-radius:50%; animation:spin .6s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* ── Animations ────────────────────────────────────────────── */
.fade-in { animation:fadeIn .3s ease-out; }
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }

/* ── Print ─────────────────────────────────────────────────── */
@media print {
  .sidebar,.topbar,.no-print { display:none !important; }
  .main-content { margin-left:0 !important; }
  .cert-wrapper { box-shadow:none; border-radius:0; max-width:100%; width:100%; aspect-ratio:auto; }
  body { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — Learn@OctaWeb
   Breakpoints: sm=640px, md=768px
   ═══════════════════════════════════════════════════════════ */

/* ── Mobile nav overlay ──────────────────────────────────── */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 39;
  backdrop-filter: blur(2px);
}
#sidebar-overlay.open { display: block; }

.mobile-menu-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 38px; height: 38px;
  background: none; border: none;
  color: #64748b; cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
}
.mobile-menu-btn:hover { background: #f1f5f9; color: #0f172a; }
.mobile-menu-btn svg  { width: 20px; height: 20px; }

@media (max-width: 768px) {
  /* ── Variables ── */
  :root { --topbar-h: 56px; }

  /* ── Sidebar: off-canvas on mobile ── */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    z-index: 40;
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }

  /* ── Main content: full width ── */
  .main-content { margin-left: 0 !important; width: 100% !important; }

  /* ── Topbar ── */
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar-search { max-width: none; flex: 1; }
  .search-input { font-size: 14px; }

  /* Show hamburger on mobile */
  .mobile-menu-btn { display: flex; }

  /* ── Page content ── */
  .page-main { padding: 16px; }
  .flash     { margin: 0 16px; }

  /* ── Grids ── */
  .grid-4,
  .grid-3  { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid-2  { grid-template-columns: 1fr; gap: 12px; }

  /* ── Page titles ── */
  .page-title    { font-size: 18px; }
  .page-subtitle { font-size: 12px; }

  /* ── Stat cards: 2-col ── */
  .stat-card { padding: 14px; gap: 12px; }
  .stat-value { font-size: 22px; }

  /* ── Tables: scroll horizontally ── */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 480px; }
  .table th, .table td { padding: 10px 12px; }

  /* ── Cards ── */
  .card { border-radius: 12px; }
  .course-body { padding: 14px; }

  /* ── Buttons ── */
  .btn-primary, .btn-secondary, .btn-ghost { font-size: 13px; padding: 9px 14px; }

  /* ── Modals: bottom-sheet on mobile ── */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    width: 100%;
    padding: 20px;
    animation: slideUp .25s ease-out;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* ── Empty states ── */
  .empty-state { padding: 40px 20px; }

  /* ── Flex row → col on small screens ── */
  .mob-col { flex-direction: column !important; align-items: stretch !important; }
  .mob-col > * { width: 100% !important; }
  .mob-full { width: 100% !important; }
  .mob-hide { display: none !important; }
  .mob-show { display: block !important; }
}

@media (max-width: 480px) {
  /* Extra small: single column everything */
  .grid-4,
  .grid-3,
  .grid-2 { grid-template-columns: 1fr; gap: 10px; }

  .page-main { padding: 12px; }
  .stat-card { padding: 12px; }
  .stat-icon { width: 40px; height: 40px; border-radius: 10px; }
  .stat-value { font-size: 20px; }

  /* Stack page headers */
  .flex.items-center.justify-between.mb-6 { flex-direction: column; align-items: flex-start; gap: 12px; }
  .flex.items-center.justify-between.mb-6 > .flex,
  .flex.items-center.justify-between.mb-6 > .ml-auto { margin-left: 0 !important; }
}

/* ── Player mobile ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .player-wrap {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - var(--topbar-h));
  }

  .player-sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
  }
  .player-sidebar.mob-open { max-height: 400px; }

  .player-sidebar-toggle {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .player-content { overflow: visible; }

  .player-scroll-view { padding: 16px; }
  .player-scroll-footer { padding: 12px 16px; }
  .player-slide-view { padding: 16px; }
  .player-slide-footer { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }

  .nav-btn { padding: 8px 14px; font-size: 12px; }

  /* Scroll page inner */
  .player-scroll-inner,
  .player-slide-inner { padding: 0; }
  .player-page-title,
  .player-slide-title { font-size: 17px; }
}

/* ── Course builder mobile warning ──────────────────────────── */
@media (max-width: 768px) {
  .cb-mobile-notice {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    font-size: 13px;
    color: #92400e;
    font-weight: 500;
  }
  /* Hide full builder UI on mobile — show notice instead */
  #cb-root { display: none; }
  .cb-topbar { padding: 0 12px; gap: 8px; overflow-x: auto; }
  .cb-topbar-title { font-size: 13px; }
  .cb-topbar-right { gap: 6px; flex-shrink: 0; }
}

/* ── My Courses card mobile ──────────────────────────────────── */
@media (max-width: 480px) {
  .course-card .course-body { padding: 12px; }
  .course-title { font-size: 13px; }
  .course-meta  { flex-wrap: wrap; gap: 8px; }
}

/* ── Certificate mobile ──────────────────────────────────────── */
@media (max-width: 640px) {
  .cert-wrapper {
    aspect-ratio: auto;
    min-height: 320px;
  }
  .cert-content { padding: 20px; }
  .cert-name    { font-size: 26px; }
  .cert-logo    { font-size: 18px; }
  .cert-score   { font-size: 26px; }
}