/* ===== Slide Interativo – interface do professor ===== */
:root {
  --bg: #f6f5fb;
  --surface: #ffffff;
  --surface-2: #f1effa;
  --line: #e4e1f0;
  --text: #1c1830;
  --muted: #6d6887;
  --primary: #5b3df5;
  --primary-2: #7a5cff;
  --primary-soft: #ece8ff;
  --danger: #d93a4a;
  --ok: #17a36b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 24, 48, .06), 0 8px 24px rgba(28, 24, 48, .06);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #110f1c;
    --surface: #1a1729;
    --surface-2: #231f36;
    --line: #2e2945;
    --text: #efedf8;
    --muted: #a09bb8;
    --primary: #8b72ff;
    --primary-2: #a591ff;
    --primary-soft: #2a2350;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.8rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
[hidden] { display: none !important; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  border: 1px solid transparent; border-radius: 10px;
  padding: .62em 1.1em; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--surface-2); color: var(--text);
  transition: background .15s, transform .08s, box-shadow .15s, border-color .15s;
  text-decoration: none !important; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-primary:hover { background: var(--primary-2); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-sm { padding: .42em .8em; font-size: .88rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { padding: .45em; width: 2.3em; height: 2.3em; }

/* Formulários */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span, .field-label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field-label { display: block; margin: 14px 0 8px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: .65em .8em; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.alert { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); padding: .7em 1em; border-radius: 10px; font-weight: 600; }
.notice { background: var(--primary-soft); color: var(--text); padding: .7em 1em; border-radius: 10px; }

/* Topo */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar-nav { display: flex; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); font-size: 1.05rem; text-decoration: none !important; }
.brand-mark {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #ff6fb1); font-size: 16px;
}
.brand-lg { font-size: 1.3rem; }
.container { max-width: 1180px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head p { margin: 0; }

/* Login */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
.auth-hero h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); margin: 24px 0 16px; }
.auth-hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--primary), #ff6fb1); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero p { font-size: 1.08rem; color: var(--muted); max-width: 34em; }
.auth-features { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; font-weight: 500; }
.auth-card { padding: 28px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin-bottom: 20px; }
.tab { flex: 1; text-align: center; padding: .55em; border-radius: 9px; font-weight: 600; color: var(--muted); text-decoration: none !important; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; gap: 24px; }
  .auth-features { display: none; }
}

/* Painel */
.pres-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.pres-card { overflow: visible; display: flex; flex-direction: column; }
.pres-thumb {
  position: relative; aspect-ratio: 16/9; border-radius: var(--radius) var(--radius) 0 0;
  display: grid; place-items: center; padding: 16px; text-align: center; overflow: hidden;
  background: var(--st-bg); color: var(--st-fg); text-decoration: none !important;
}
.pres-thumb-title { font-weight: 800; font-size: 1.05rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pres-thumb-type { position: absolute; top: 10px; right: 12px; font-size: 1.1rem; }
.pres-body { padding: 14px 16px 16px; }
.pres-body h3 a { color: var(--text); }
.pres-body p { margin-bottom: 12px; }
.pres-actions { display: flex; gap: 8px; align-items: center; }
.menu { position: relative; margin-left: auto; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 30; min-width: 240px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.menu-list a, .menu-list button {
  display: block; width: 100%; text-align: left; padding: .55em .8em; border-radius: 8px;
  font: inherit; color: var(--text); background: none; border: 0; cursor: pointer; text-decoration: none !important;
}
.menu-list a:hover, .menu-list button:hover { background: var(--surface-2); }
.menu-list .danger { color: var(--danger); }
.empty { text-align: center; padding: 56px 24px; }
.empty-icon { font-size: 48px; margin-bottom: 8px; }

/* Modal */
.modal { border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text); width: min(640px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.modal::backdrop { background: rgba(12, 10, 24, .55); backdrop-filter: blur(3px); }
.modal-body { padding: 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h2 { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.tpl-grid, .type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tpl input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-card, .type-card {
  display: grid; gap: 4px; padding: 14px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; height: 100%;
  background: var(--surface); color: var(--text); text-align: left; font: inherit; transition: border-color .15s, background .15s;
}
.tpl-card:hover, .type-card:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); }
.tpl input:checked + .tpl-card { border-color: var(--primary); background: var(--primary-soft); }
.tpl-icon { font-size: 1.6rem; }

/* ===== Editor ===== */
.editor-page { height: 100vh; overflow: hidden; }
.editor { display: grid; grid-template-rows: auto 1fr; height: 100vh; }
.ed-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.ed-title { font-size: 1.05rem; font-weight: 700; border: 1px solid transparent !important; background: transparent !important; max-width: 420px; }
.ed-title:hover { border-color: var(--line) !important; }
.ed-top .spacer { flex: 1; }
.save-state { font-size: .85rem; color: var(--muted); min-width: 90px; text-align: right; }
.save-state.err { color: var(--danger); font-weight: 600; }
.ed-main { display: grid; grid-template-columns: 230px 1fr 380px; min-height: 0; }
.ed-list { border-right: 1px solid var(--line); overflow-y: auto; padding: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.ed-list-add { position: sticky; bottom: 0; padding-top: 8px; background: var(--surface); }
.thumb {
  position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start;
  cursor: pointer; user-select: none; padding: 4px; border-radius: 12px; border: 2px solid transparent;
}
.thumb:hover { background: var(--surface-2); }
.thumb.active { border-color: var(--primary); background: var(--primary-soft); }
.thumb.dragging { opacity: .4; }
.thumb.drop-before { box-shadow: 0 -3px 0 var(--primary); }
.thumb.drop-after { box-shadow: 0 3px 0 var(--primary); }
.thumb-num { font-size: .78rem; font-weight: 700; color: var(--muted); text-align: center; padding-top: 4px; }
.thumb-box {
  aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--st-bg); color: var(--st-fg);
  display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 6px 8px; gap: 2px; text-align: center;
}
.thumb-icon { font-size: 1.1rem; }
.thumb-title { font-size: .68rem; font-weight: 700; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.ed-canvas { background: var(--bg); padding: 24px; display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }
.ed-canvas { justify-content: center; }
.ed-canvas .stage-wrap { width: min(100%, calc((100vh - 170px) * 16 / 9)); aspect-ratio: 16 / 9; margin: 0 auto; border-radius: 14px; box-shadow: var(--shadow); }
.ed-canvas-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; flex-wrap: wrap; }
.ed-panel { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 18px; }
.ed-panel h3 { display: flex; align-items: center; gap: 8px; }
.panel-section { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.opt-list { display: grid; gap: 8px; }
.opt-row { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; }
.opt-row .swatch { width: 12px; height: 34px; border-radius: 4px; }
.opt-row .correct-toggle { width: 34px; height: 34px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-size: 15px; color: transparent; }
.opt-row .correct-toggle.on { border-color: var(--ok); background: var(--ok); color: #fff; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-switch { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.type-switch select { flex: 1; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
@media (max-width: 1100px) {
  .ed-main { grid-template-columns: 180px 1fr 320px; }
}
@media (max-width: 860px) {
  .editor-page { height: auto; overflow: auto; }
  .editor { height: auto; }
  .ed-main { grid-template-columns: 1fr; }
  .ed-list { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .thumb { min-width: 150px; }
  .ed-list-add { position: static; padding: 0; align-self: center; }
  .ed-canvas .stage-wrap { width: 100%; }
  .ed-panel { border-left: 0; }
  .ed-title { max-width: 180px; }
  .hide-sm { display: none !important; }
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: #1c1830; color: #fff; padding: .7em 1.2em; border-radius: 12px; font-weight: 600; z-index: 1000;
  transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* ===== Controle remoto ===== */
.remote { max-width: 520px; margin: 0 auto; padding: 16px 16px 40px; display: grid; gap: 14px; }
.remote-now { padding: 16px; }
.remote-now .kicker { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.remote-now h2 { margin: 6px 0 0; }
.remote-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 12px; text-align: center; }
.stat b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .78rem; color: var(--muted); }
.remote-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.remote-nav .btn { padding: 1.2em; font-size: 1.1rem; }
.remote-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.remote-notes { padding: 16px; white-space: pre-wrap; }
.remote-list { display: grid; gap: 6px; }
.remote-list button { text-align: left; }
.remote-list .btn.on { border-color: var(--primary); background: var(--primary-soft); }
