/* Curso CNH — Player Web */

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

:root {
  --bg:       #0f1117;
  --bg2:      #1a1d27;
  --bg3:      #252836;
  --border:   #2e3248;
  --accent:   #4f7cff;
  --accent-h: #6b92ff;
  --text:     #e8eaf0;
  --muted:    #7b82a0;
  --success:  #22c55e;
  --danger:   #ef4444;
  --warn:     #f97316;
  --sidebar:  280px;
  --radius:   12px;
  --font:     'Inter', system-ui, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#protect-overlay {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
}

/* ── Layout ── */
#app { display: flex; height: 100vh; }

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden; flex-shrink: 0;
}
.sidebar-header { padding: 20px 16px; border-bottom: 1px solid var(--border); }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon  { font-size: 32px; line-height: 1; }
.logo-title { font-size: 16px; font-weight: 700; }
.logo-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }

#module-list {
  flex: 1; overflow-y: auto; padding: 8px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
#module-list::-webkit-scrollbar { width: 4px; }
#module-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.module-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  cursor: pointer; transition: background .15s; margin-bottom: 2px;
}
.module-item:hover  { background: var(--bg3); }
.module-item.active { background: rgba(79,124,255,.15); color: var(--accent); }
.m-icon  { font-size: 18px; flex-shrink: 0; }
.m-info  { flex: 1; min-width: 0; }
.m-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-meta  { font-size: 11px; color: var(--muted); margin-top: 2px; }
.m-check { width: 18px; height: 18px; border-radius: 50%; background: var(--success);
           display: flex; align-items: center; justify-content: center;
           flex-shrink: 0; opacity: 0; transition: opacity .2s; }
.module-item.done .m-check { opacity: 1; }
.m-check svg { width: 10px; height: 10px; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.progress-global { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }

.progress-bar {
  flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden;
}
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s ease; }

/* ── Main ── */
#main { flex: 1; overflow: hidden; position: relative; }
.screen { position: absolute; inset: 0; display: none; overflow-y: auto; }
.screen.active { display: flex; flex-direction: column; }

/* ── Home ── */
#home-screen { padding: 48px; align-items: flex-start; }
.home-content { max-width: 900px; width: 100%; }
.home-content h1 { font-size: 26px; font-weight: 700; margin-bottom: 10px; }
.home-content p  { color: var(--muted); font-size: 14px; margin-bottom: 32px; }

#modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.module-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  cursor: pointer; transition: border-color .15s, transform .15s;
}
.module-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-icon  { font-size: 30px; margin-bottom: 10px; }
.card-title { font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.card-meta  { font-size: 11px; color: var(--muted); }
.card-progress { margin-top: 10px; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.card-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; }

/* ── Player header ── */
.player-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; background: var(--bg2);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.player-title {
  flex: 1; font-size: 13px;
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.player-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sep { color: var(--muted); flex-shrink: 0; }

.btn-icon {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 8px; cursor: pointer;
  display: flex; align-items: center; transition: color .15s, border-color .15s;
}
.btn-icon:hover { color: var(--text); border-color: var(--muted); }

/* audio button subtle highlight */
.btn-audio { border-color: rgba(79,124,255,.4); color: var(--accent); }
.btn-audio:hover { border-color: var(--accent); }

/* ── Tabs ── */
.pres-tabs {
  display: flex; background: var(--bg2); border-bottom: 1px solid var(--border);
  padding: 0 16px; overflow-x: auto; flex-shrink: 0; scrollbar-width: none;
}
.pres-tabs::-webkit-scrollbar { display: none; }
.pres-tab {
  padding: 10px 16px; font-size: 12px; font-weight: 500;
  color: var(--muted); border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap; transition: color .15s;
}
.pres-tab:hover { color: var(--text); }
.pres-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.pres-tab.type-lesson::before { content: "📖 "; }
.pres-tab.type-quiz::before   { content: "📝 "; }

/* ── Slide container ── */
.slide-container {
  flex: 1; position: relative; display: flex;
  align-items: center; justify-content: center;
  background: #080a10; overflow: hidden; min-height: 0;
}

#slide-canvas {
  max-width: 100%; max-height: 100%; display: block;
  pointer-events: none;
  /* Híbrido: sombra suave para parecer um slide flutuando */
  filter: drop-shadow(0 8px 32px rgba(0,0,0,.6));
  border-radius: 4px;
}

#slide-overlay { position: absolute; inset: 0; z-index: 10; cursor: default; }

.nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 20;
  background: rgba(255,255,255,.08); border: none; color: white;
  border-radius: 50%; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s; backdrop-filter: blur(4px);
}
.nav-btn:hover    { background: rgba(255,255,255,.18); }
.nav-btn:disabled { opacity: .2; cursor: not-allowed; }
.nav-prev { left: 16px; }
.nav-next { right: 16px; }

/* ── Player footer ── */
.player-footer {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: var(--bg2);
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.slide-counter { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 55px; }
.slide-progress-bar { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.audio-controls { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.audio-bar { width: 100px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; cursor: pointer; }
#audio-time { font-size: 11px; color: var(--muted); min-width: 32px; }

/* ── Quiz ── */
#quiz-screen { overflow-y: auto; }

.quiz-header {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px; background: var(--bg2);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.quiz-counter { font-size: 13px; font-weight: 600; white-space: nowrap; }
.quiz-progress-bar {
  flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
}

.quiz-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; padding: 40px 24px;
  max-width: 760px; margin: 0 auto; width: 100%; gap: 20px;
}

.question-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 32px;
  width: 100%;
}
.question-text {
  font-size: 20px; font-weight: 600; line-height: 1.5; color: var(--text); text-align: center;
}

.quiz-options { display: flex; flex-direction: column; gap: 10px; width: 100%; }

.quiz-option {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg2); border: 2px solid var(--border);
  border-radius: 10px; padding: 14px 20px;
  cursor: pointer; transition: border-color .15s, background .15s;
  text-align: left; color: var(--text); font-size: 15px; font-family: var(--font);
}
.quiz-option:hover:not(:disabled) { border-color: var(--accent); background: rgba(79,124,255,.08); }
.quiz-option.selected   { border-color: var(--accent); background: rgba(79,124,255,.12); }
.quiz-option.correct    { border-color: var(--success); background: rgba(34,197,94,.12); }
.quiz-option.wrong      { border-color: var(--danger);  background: rgba(239,68,68,.12); }
.quiz-option.dimmed     { opacity: .4; }
.quiz-option:disabled   { cursor: default; }

.opt-letter {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.quiz-option.selected .opt-letter  { background: var(--accent); border-color: var(--accent); color: white; }
.quiz-option.correct  .opt-letter  { background: var(--success); border-color: var(--success); color: white; }
.quiz-option.wrong    .opt-letter  { background: var(--danger);  border-color: var(--danger);  color: white; }

.opt-text { flex: 1; }

.quiz-feedback {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: 8px; width: 100%;
  font-size: 14px; font-weight: 500;
}
.quiz-feedback.correct { background: rgba(34,197,94,.15); color: var(--success); }
.quiz-feedback.wrong   { background: rgba(239,68,68,.15);  color: var(--danger); }

.quiz-actions { display: flex; gap: 12px; width: 100%; justify-content: flex-end; }
.btn-primary {
  background: var(--accent); color: white; border: none;
  border-radius: 8px; padding: 12px 28px;
  font-size: 14px; font-weight: 600; font-family: var(--font);
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s;
}
.btn-primary:hover    { background: var(--accent-h); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

/* ── Quiz resultado ── */
.quiz-result {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px; gap: 16px;
}
.result-icon    { font-size: 56px; }
.result-score   { font-size: 42px; font-weight: 700; }
.result-percent { font-size: 20px; color: var(--muted); }
.result-bar     { width: 240px; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.result-breakdown {
  display: flex; gap: 24px; font-size: 15px; font-weight: 600;
}
.result-correct { color: var(--success); }
.result-wrong   { color: var(--danger); }
.result-message { font-size: 15px; color: var(--muted); text-align: center; }
.result-actions { display: flex; gap: 12px; margin-top: 8px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Responsivo ── */
@media (max-width: 768px) {
  :root { --sidebar: 240px; }
  #home-screen { padding: 24px 16px; }
  .quiz-body { padding: 24px 16px; }
}
@media (max-width: 560px) {
  #sidebar { display: none; }
  #modules-grid { grid-template-columns: 1fr 1fr; }
}
