/* ============================================================ TgPlayer Web
   Design system: moderno, glassmorphism sutil, gradientes roxos.
   Identidade herdada do app desktop (#7c5cff).
   ============================================================ */

:root {
  --brand: #7c5cff;
  --brand-2: #9d7bff;
  --brand-glow: rgba(124, 92, 255, 0.35);
  --accent: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.22);
  --trans: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --font: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #0b0d17;
  --bg-2: #11142099;
  --surface: #161a2b;
  --surface-2: #1d2236;
  --surface-3: #252b42;
  --border: #2a3050;
  --text: #eef1fb;
  --text-dim: #9aa3c4;
  --text-faint: #6b7396;
  --grad-bg: radial-gradient(1200px 700px at 80% -10%, #1a1d3a 0%, transparent 60%),
             radial-gradient(900px 600px at -10% 110%, #1b2240 0%, transparent 55%),
             #0b0d17;
}

[data-theme="light"] {
  --bg: #f3f4fb;
  --bg-2: #ffffffcc;
  --surface: #ffffff;
  --surface-2: #f7f8fd;
  --surface-3: #eef0fa;
  --border: #e2e5f3;
  --text: #1a1d2e;
  --text-dim: #5b6280;
  --text-faint: #8a90ac;
  --grad-bg: radial-gradient(1100px 650px at 85% -10%, #e9e6ff 0%, transparent 60%),
             radial-gradient(800px 550px at -8% 110%, #e4ebff 0%, transparent 55%),
             #f3f4fb;
  --shadow: 0 10px 40px rgba(80, 70, 160, 0.12);
  --shadow-sm: 0 4px 16px rgba(80, 70, 160, 0.08);
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--grad-bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

::selection { background: var(--brand-glow); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }
::-webkit-scrollbar-track { background: transparent; }

button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ============================================================ LOGIN */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 34px;
  box-shadow: var(--shadow);
  animation: pop 0.5s var(--trans);
}
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.login-logo {
  width: 64px; height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 26px var(--brand-glow);
  font-size: 30px;
}
.login-card h1 { text-align: center; font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.login-card .sub { text-align: center; color: var(--text-dim); margin: 6px 0 28px; font-size: 14px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 15px;
  transition: var(--trans);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-glow);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface-2);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 14px; font-weight: 600;
  transition: var(--trans);
  white-space: nowrap;
}
.btn:hover { border-color: var(--brand); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; color: white;
  box-shadow: 0 6px 20px var(--brand-glow);
}
.btn-primary:hover { box-shadow: 0 8px 26px var(--brand-glow); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 22px; font-size: 15px; }
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

.login-hint { margin-top: 18px; font-size: 12.5px; color: var(--text-faint); text-align: center; }
.login-hint a { color: var(--brand); font-weight: 600; text-decoration: none; }
.login-hint a:hover { text-decoration: underline; }
.login-err {
  background: rgba(248,113,113,0.12);
  border: 1px solid rgba(248,113,113,0.3);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 11px 14px; font-size: 13.5px; margin-bottom: 16px;
}

/* ---- Tela de criar conta ---- */
.login-card-wide { max-width: 460px; }
.setup-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 14px;
  color: var(--text-faint); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.setup-divider::before, .setup-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.setup-note { font-size: 12.5px; color: var(--text-dim); margin: 0 0 16px; line-height: 1.5; }
.setup-note a { color: var(--brand); text-decoration: none; }
.setup-note a:hover { text-decoration: underline; }

/* ============================================================ SHELL */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--bg-2);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 24px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; font-size: 20px;
  box-shadow: 0 6px 18px var(--brand-glow);
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -0.4px; }
.brand-name small { display: block; font-size: 11px; color: var(--text-faint); font-weight: 500; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  color: var(--text-dim); font-weight: 600; font-size: 14.5px;
  transition: var(--trans); cursor: pointer; border: none; background: transparent;
  text-align: left;
}
.nav-item .ic { font-size: 18px; width: 22px; text-align: center; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, var(--brand-glow), transparent);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--brand);
}

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 16px; }
.tg-status {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 12px; background: var(--surface-2);
  font-size: 13px; margin-bottom: 10px; cursor: pointer; transition: var(--trans);
}
.tg-status:hover { background: var(--surface-3); }
.tg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.tg-dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.tg-dot.off { background: var(--danger); }
.tg-status .name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 32px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
  background: var(--bg-2); backdrop-filter: blur(14px);
}
.topbar h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.topbar .spacer { flex: 1; }
.search-box {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: 999px; padding: 9px 16px; min-width: 220px;
  transition: var(--trans);
}
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-glow); }
.search-box input { background: transparent; border: none; color: var(--text); flex: 1; font-size: 14px; }
.search-box input:focus { outline: none; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--surface-2); border: 1.5px solid var(--border);
  display: grid; place-items: center; font-size: 18px; transition: var(--trans);
}
.icon-btn:hover { border-color: var(--brand); transform: translateY(-1px); }

.content { padding: 28px 32px 60px; flex: 1; }

/* ============================================================ CARDS / GRID */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 26px; }
.metric {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
  transition: var(--trans); position: relative; overflow: hidden;
}
.metric:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.metric::after {
  content: ""; position: absolute; top: 0; right: 0; width: 80px; height: 80px;
  background: radial-gradient(circle, var(--brand-glow), transparent 70%);
  opacity: 0.5;
}
.metric .label { color: var(--text-dim); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.metric .value { font-size: 30px; font-weight: 800; margin-top: 8px; letter-spacing: -1px; }
.metric .value small { font-size: 15px; font-weight: 600; color: var(--text-dim); }

.section-title { font-size: 16px; font-weight: 700; margin: 26px 0 14px; display: flex; align-items: center; gap: 10px; }
.section-title .pill { font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-dim); padding: 3px 10px; border-radius: 999px; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm);
}
.panels-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
@media (max-width: 980px) { .panels-2 { grid-template-columns: 1fr; } }

/* ============================================================ COURSES */
.courses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.course-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: var(--trans); cursor: pointer;
}
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--brand); }
.course-cover {
  height: 96px; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  position: relative; display: flex; align-items: flex-end; padding: 14px 18px;
}
.course-cover .kind { font-size: 12px; font-weight: 600; background: rgba(0,0,0,0.25); color: white; padding: 4px 11px; border-radius: 999px; backdrop-filter: blur(4px); }
.course-card .body { padding: 16px 18px 18px; }
.course-card .title { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.course-card .meta { font-size: 13px; color: var(--text-dim); }
.progress-bar { height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress-bar .fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 999px; transition: width 0.5s var(--trans); }
.course-card .actions { display: flex; gap: 8px; margin-top: 14px; }

/* ============================================================ LESSONS layout */
.lessons-layout { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
@media (max-width: 880px) { .lessons-layout { grid-template-columns: 1fr; } }
.subject-list { display: flex; flex-direction: column; gap: 4px; }
.subject-item {
  padding: 11px 14px; border-radius: 10px; cursor: pointer; transition: var(--trans);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: var(--text-dim); font-weight: 600; font-size: 14px; background: transparent; border: none; text-align: left; width: 100%;
}
.subject-item:hover { background: var(--surface-2); color: var(--text); }
.subject-item.active { background: var(--brand-glow); color: var(--text); }
.subject-item .count { font-size: 12px; background: var(--surface-3); padding: 2px 9px; border-radius: 999px; }

.lesson-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 10px;
  transition: var(--trans);
}
.lesson-row:hover { border-color: var(--brand); transform: translateX(3px); }
.lesson-thumb {
  width: 52px; height: 52px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  display: grid; place-items: center; font-size: 20px; position: relative;
}
.lesson-thumb.watched { background: linear-gradient(135deg, var(--ok), #10b981); color: white; }
.lesson-info { flex: 1; min-width: 0; }
.lesson-info .t { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-info .m { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; }
.lesson-actions { display: flex; gap: 7px; flex-shrink: 0; }
.lesson-progress { height: 3px; background: var(--surface-3); border-radius: 999px; margin-top: 7px; overflow: hidden; }
.lesson-progress .fill { height: 100%; background: var(--brand); }

/* ============================================================ MODAL / PLAYER */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5, 7, 15, 0.7);
  backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 100;
  padding: 24px; animation: fade 0.2s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 520px;
  box-shadow: var(--shadow); animation: pop 0.3s var(--trans); max-height: 90vh; overflow: auto;
}
.modal.wide { max-width: 920px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 18px; font-weight: 700; flex: 1; }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.close-x { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; font-size: 17px; transition: var(--trans); }
.close-x:hover { background: var(--danger); color: white; }

.player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; position: relative; }
.player-wrap video { width: 100%; display: block; max-height: 64vh; background: #000; }
/* Camada de "carregando" sobreposta ao vídeo (o vídeo nunca é removido). */
.player-loading-ov {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(2px);
  color: #e9edff; text-align: center; padding: 24px; pointer-events: none;
  z-index: 2;
}
.player-loading-ov .spinner { margin: 0; }
.player-loading-ov .muted { color: #cbd3f0; max-width: 360px; line-height: 1.45; margin: 0; }
.player-meta { padding: 16px 4px 0; }
.player-meta h3 { font-size: 18px; font-weight: 700; }
.player-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ============================================================ DIALOG SELECT */
.dialog-list { max-height: 50vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.dialog-opt {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: 10px; background: var(--surface-2); cursor: pointer; transition: var(--trans);
}
.dialog-opt:hover { background: var(--surface-3); }
.dialog-opt.sel { background: var(--brand-glow); box-shadow: inset 0 0 0 1.5px var(--brand); }
.dialog-opt .ck { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border); display: grid; place-items: center; flex-shrink: 0; }
.dialog-opt.sel .ck { background: var(--brand); border-color: var(--brand); color: white; }
.dialog-opt .t { flex: 1; font-weight: 600; font-size: 14px; }
.dialog-opt .badge { font-size: 11px; color: var(--text-dim); background: var(--surface); padding: 2px 8px; border-radius: 999px; }

/* ============================================================ CHARTS */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 40px; background: linear-gradient(180deg, var(--brand), var(--brand-2)); border-radius: 8px 8px 4px 4px; min-height: 4px; transition: height 0.6s var(--trans); position: relative; }
.bar:hover { filter: brightness(1.15); }
.bar-label { font-size: 11px; color: var(--text-faint); font-weight: 600; }
.bar-val { font-size: 11px; color: var(--text-dim); font-weight: 700; }

.course-stat { margin-bottom: 14px; }
.course-stat .top { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 6px; }
.course-stat .top .pct { color: var(--text-dim); font-weight: 700; }

/* ============================================================ TASKS / POMODORO */
.task-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: none; }
.task-ck { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--border); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: var(--trans); }
.task-ck.done { background: var(--ok); border-color: var(--ok); color: white; }
.task-row .txt { flex: 1; font-size: 14.5px; }
.task-row.done .txt { color: var(--text-faint); text-decoration: line-through; }
.task-del { opacity: 0; transition: var(--trans); color: var(--text-faint); }
.task-row:hover .task-del { opacity: 1; }
.task-del:hover { color: var(--danger); }

.pomodoro { text-align: center; }
.pomo-time { font-size: 56px; font-weight: 800; letter-spacing: -2px; font-variant-numeric: tabular-nums; margin: 8px 0; }
.pomo-controls { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }

/* ============================================================ EMPTY / MISC */
.empty { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty .big { font-size: 52px; margin-bottom: 14px; }
.empty h3 { font-size: 19px; color: var(--text); margin-bottom: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--text-dim); }
.mt { margin-top: 16px; }

.spinner { width: 38px; height: 38px; border: 3px solid var(--surface-3); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand);
  border-radius: 12px; padding: 14px 18px; box-shadow: var(--shadow); font-size: 14px; font-weight: 500;
  min-width: 260px; animation: slideIn 0.3s var(--trans);
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } }

/* mobile */
.menu-toggle { display: none; }
@media (max-width: 760px) {
  .sidebar { position: fixed; left: -260px; z-index: 60; transition: left var(--trans); }
  .sidebar.open { left: 0; }
  .menu-toggle { display: grid; }
  .content { padding: 20px 16px 50px; }
  .topbar { padding: 16px 18px; }
  .search-box { min-width: 0; }
}

/* ===================================================== Lessons header */
.lessons-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.lessons-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.course-progress-mini { display: flex; align-items: center; gap: 9px; }
.cpm-bar { width: 120px; height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.cpm-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 999px; transition: width 0.5s var(--trans); }
.cpm-label { font-size: 12.5px; font-weight: 700; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ===================================================== Explorer (pastas) */
.explorer {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 8px; box-shadow: var(--shadow-sm);
}
.tree-folder { position: relative; }
.folder-head {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 10px 12px; border-radius: 10px; background: transparent; border: none;
  text-align: left; cursor: pointer; transition: background var(--trans);
  color: var(--text); font-weight: 700; font-size: 14.5px;
  padding-left: calc(12px + var(--depth, 0) * 20px);
}
.folder-head:hover { background: var(--surface-2); }
.folder-head.open { color: var(--brand); }
.folder-head .caret { font-size: 11px; width: 12px; color: var(--text-faint); transition: var(--trans); flex-shrink: 0; }
.folder-head .folder-icon { font-size: 17px; flex-shrink: 0; }
.folder-head .folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-head .folder-count {
  font-size: 11.5px; font-weight: 700; color: var(--text-dim);
  background: var(--surface-3); padding: 2px 9px; border-radius: 999px; flex-shrink: 0;
}
.folder-head.open .folder-count { background: var(--brand-glow); color: var(--brand); }
.folder-body { animation: folderOpen 0.18s ease; }
@keyframes folderOpen { from { opacity: 0; transform: translateY(-4px); } }

/* a lesson-row dentro do explorer recebe recuo conforme a profundidade */
.explorer .lesson-row {
  margin: 4px 8px 4px calc(12px + var(--depth, 0) * 20px);
  cursor: pointer;
}
.explorer .lesson-row:hover { transform: none; background: var(--surface-2); }
.lesson-row.done .lesson-info .t { color: var(--text-dim); }

/* ===================================================== Sync overlay */
.sync-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(5, 7, 15, 0.6); backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 24px; animation: fade 0.2s;
}
.sync-overlay.closing { animation: fade 0.2s reverse; }
.sync-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px 36px; max-width: 420px; width: 100%;
  text-align: center; box-shadow: var(--shadow); animation: pop 0.3s var(--trans);
}
.sync-anim { position: relative; width: 92px; height: 92px; margin: 0 auto 22px; display: grid; place-items: center; }
.sync-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 4px solid var(--surface-3); border-top-color: var(--brand);
  animation: spin 1s linear infinite;
}
.sync-ring.r2 {
  inset: 12px; border-width: 3px; border-top-color: var(--accent);
  animation: spin 1.4s linear infinite reverse;
}
.sync-ico { font-size: 30px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.12); opacity: 0.7; } }
.sync-title { font-size: 19px; font-weight: 800; margin-bottom: 6px; }
.sync-sub { font-size: 13.5px; color: var(--text-dim); margin-bottom: 20px; line-height: 1.5; }
.sync-bar { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.sync-bar-fill {
  height: 100%; width: 40%; border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--brand), var(--accent), transparent);
  animation: indeterminate 1.4s ease-in-out infinite;
}
@keyframes indeterminate { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.sync-steps { font-size: 13px; color: var(--text-faint); font-weight: 600; min-height: 18px; }

/* ===================================================== Player controls */
.player-loading { padding: 60px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.player-loading .spinner { margin: 0 0 8px; }
.player-loading .muted { color: #cbd3f0; }
.player-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.speed-control {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 12px;
}
.speed-control .speed-ico { font-size: 15px; }
.speed-control select {
  background: transparent; border: none; color: var(--text);
  font-weight: 700; font-size: 14px; cursor: pointer; outline: none;
}
.speed-control select option { background: var(--surface); color: var(--text); }

.player-error { padding: 48px 24px; text-align: center; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.player-error p { margin: 0; font-size: 15px; max-width: 420px; line-height: 1.5; }
.player-error-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ===================================================== Admin panel */
.admin-list { display: flex; flex-direction: column; gap: 16px; }
.admin-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: var(--shadow-sm, none); }
.admin-user-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.admin-card .badge { font-size: 11px; color: var(--text-dim); background: var(--surface); padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.admin-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.admin-toggle input { width: 16px; height: 16px; cursor: pointer; }
.admin-accs { display: flex; flex-direction: column; gap: 10px; }
.admin-acc { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.admin-acc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.admin-acc-head .badge { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); }
.admin-acc-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; }
.admin-note { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
