/* ==========================================================================
   Leica Geosystems - Treinamentos | Design System
   Identidade: precisao suica, tipografia limpa, vermelho Leica como acento.
   ========================================================================== */

:root {
  --leica-red: #E2000F;
  --leica-red-dark: #B8000C;
  --ink: #0f0f0f;
  --ink-soft: #1a1a1a;
  --graphite: #2b2f36;
  --muted: #6b7280;
  --muted-2: #9aa1ab;
  --line: #e5e7eb;
  --line-strong: #d5d9df;
  --bg: #f4f5f7;
  --bg-2: #eceef1;
  --white: #ffffff;
  --navy: #1B3A5B;
  --ok: #128a4b;
  --ok-bg: #e6f5ec;
  --warn: #9a6b00;
  --warn-bg: #fdf3df;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow: 0 4px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --font: "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink-soft);
  background: var(--bg);
  line-height: 1.55;
  font-size: 15.5px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--leica-red); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--ink); font-weight: 700; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
small { color: var(--muted); }
hr { border: none; border-top: 1px solid var(--line); margin: 1.5rem 0; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.container-narrow { max-width: 560px; margin: 0 auto; padding: 0 22px; }

/* --- Top bar / brand ---------------------------------------------------- */
.topbar {
  background: var(--ink);
  color: #fff;
  border-bottom: 3px solid var(--leica-red);
  position: sticky; top: 0; z-index: 40;
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 22px;
  height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; letter-spacing: .3px; }
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 5px; background: var(--leica-red);
  display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 14px;
}
.brand .name { font-size: 1.02rem; }
.brand .sub { color: var(--leica-red); font-weight: 700; }

.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topnav a, .topnav form button.linklike {
  color: #d7dade; padding: 8px 12px; border-radius: 6px; font-size: .92rem; font-weight: 600;
  background: none; border: none; cursor: pointer; font-family: inherit;
}
.topnav a:hover, .topnav form button.linklike:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.topnav a.active { color: #fff; background: rgba(226,0,15,.22); }
.topnav .who { color: var(--muted-2); font-size: .84rem; padding: 8px 6px; }

/* --- Layout with sidebar (root) ----------------------------------------- */
.shell { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
  width: 240px; flex: none; background: var(--white); border-right: 1px solid var(--line);
  padding: 18px 12px; position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto;
}
.sidebar .group { text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; color: var(--muted-2); margin: 14px 10px 6px; font-weight: 700; }
.sidebar a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--graphite); font-weight: 600; font-size: .93rem; margin-bottom: 2px;
}
.sidebar a:hover { background: var(--bg); text-decoration: none; }
.sidebar a.active { background: rgba(226,0,15,.08); color: var(--leica-red); }
.sidebar a .ic { width: 18px; text-align: center; opacity: .8; }
.content { flex: 1; padding: 26px; min-width: 0; }

/* --- Page header -------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; color: var(--leica-red); font-weight: 800; margin-bottom: 4px; }
.page-head p.lead { color: var(--muted); margin: 4px 0 0; max-width: 640px; }

/* --- Cards -------------------------------------------------------------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px 22px; }
.card + .card { margin-top: 16px; }
.card-title { font-size: 1.02rem; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* --- Stat tiles --------------------------------------------------------- */
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.9rem; font-weight: 800; color: var(--ink); line-height: 1.1; margin-top: 4px; }
.stat .value.accent { color: var(--leica-red); }
.stat .foot { color: var(--muted-2); font-size: .8rem; margin-top: 2px; }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; font-weight: 700; font-size: .93rem;
  border: 1px solid transparent; cursor: pointer; font-family: inherit; transition: .15s ease;
  text-decoration: none; line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--leica-red); color: #fff; }
.btn-primary:hover { background: var(--leica-red-dark); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; color: #fff; }
.btn-outline { background: #fff; color: var(--graphite); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--muted); background: var(--bg); }
.btn-ghost { background: transparent; color: var(--graphite); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: #fff; color: var(--danger); border-color: #f1c9c6; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: 6px 12px; font-size: .84rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* --- Forms -------------------------------------------------------------- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--graphite); }
.field { margin-bottom: 16px; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px;
  font-family: inherit; font-size: .95rem; background: #fff; color: var(--ink-soft); transition: .15s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--leica-red); box-shadow: 0 0 0 3px rgba(226,0,15,.12); }
.check { display: flex; align-items: flex-start; gap: 10px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--leica-red); flex: none; }
.check label { margin: 0; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 0 0 16px; }
legend { font-weight: 700; font-size: .85rem; padding: 0 6px; color: var(--graphite); }

/* --- Tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { background: #fafbfc; color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fcfcfd; }
table.data td.wrap { white-space: normal; }

/* --- Badges / status ---------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .01em; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.muted { background: var(--bg-2); color: var(--muted); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 5px; background: var(--bg-2); color: var(--graphite); font-size: .74rem; font-weight: 700; }

/* --- Alerts / flash ----------------------------------------------------- */
.alert { padding: 12px 15px; border-radius: 8px; margin-bottom: 14px; font-size: .92rem; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.alert.success { background: var(--ok-bg); border-color: #bfe6cd; color: #0d6b3a; }
.alert.error { background: var(--danger-bg); border-color: #f3c7c3; color: var(--danger); }
.alert.info { background: #eaf2fb; border-color: #cfe0f4; color: #1b4e8a; }
.alert.warn { background: var(--warn-bg); border-color: #f0dca6; color: var(--warn); }

/* --- Auth pages --------------------------------------------------------- */
.auth-wrap { min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center; padding: 40px 18px; }
.auth-card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-card .head { padding: 24px 28px 8px; }
.auth-card .body { padding: 8px 28px 26px; }
.auth-card h1 { font-size: 1.4rem; }
.auth-tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 9px; margin: 4px 0 18px; }
.auth-tabs a { flex: 1; text-align: center; padding: 9px; border-radius: 7px; font-weight: 700; font-size: .88rem; color: var(--muted); }
.auth-tabs a.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.auth-tabs a:hover { text-decoration: none; }
.auth-alt { text-align: center; margin-top: 16px; font-size: .88rem; color: var(--muted); }

/* --- Module / lesson cards --------------------------------------------- */
.section-head { display: flex; align-items: center; gap: 12px; margin: 26px 0 14px; }
.section-head .prod-mark { width: 8px; height: 26px; border-radius: 3px; background: var(--leica-red); }
.section-head h2 { margin: 0; }
.section-head .fam { color: var(--muted); font-size: .85rem; margin-left: auto; }

.mod-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; transition: .15s; }
.mod-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.mod-card .band { height: 6px; background: var(--leica-red); }
.mod-card .mc-body { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; }
.mod-card h3 { margin-bottom: 6px; color: var(--ink); }
.mod-card .summary { color: var(--muted); font-size: .88rem; flex: 1; margin-bottom: 12px; }
.mod-card .meta { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--muted); }
.progress { height: 7px; background: var(--bg-2); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress > span { display: block; height: 100%; background: var(--leica-red); border-radius: 999px; }

/* --- Barra de progresso de upload de video ------------------------------ */
.upload-progress { margin-top: 10px; }
.upload-progress-track { height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.upload-progress-fill { display: block; height: 100%; width: 0%; background: var(--leica-red); border-radius: 999px; transition: width .15s linear; }
.upload-progress-fill.upload-progress-error { background: var(--danger); }
.upload-progress-label { margin-top: 6px; }

/* --- Lesson viewer ------------------------------------------------------ */
.lesson-layout { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }
@media (max-width: 900px) { .lesson-layout { grid-template-columns: 1fr; } }
.video-frame { position: relative; padding-top: 56.25%; background: #000; border-radius: var(--radius); overflow: hidden; }
.video-frame iframe, .video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.video-empty { position: relative; background: linear-gradient(135deg, #17324d, #0f0f0f); border-radius: var(--radius); aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; color: #9db4c9; }
.lesson-list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lesson-list a { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--graphite); font-size: .9rem; }
.lesson-list a:last-child { border-bottom: none; }
.lesson-list a:hover { background: var(--bg); text-decoration: none; }
.lesson-list a.active { background: rgba(226,0,15,.06); color: var(--leica-red); font-weight: 700; }
.lesson-list .num { width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--bg-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; }
.lesson-list a.done .num { background: var(--ok-bg); color: var(--ok); }
.prose { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-top: 18px; }
.prose h1, .prose h2, .prose h3 { margin-top: 1.2em; }
.prose img { max-width: 100%; border-radius: 8px; }
.prose pre { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px; overflow-x: auto; }
.prose code { background: var(--bg-2); padding: 1px 6px; border-radius: 4px; font-size: .88em; }
.prose pre code { background: none; color: inherit; padding: 0; }
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; }

/* --- Invite code display ------------------------------------------------ */
.code-display { font-family: "Consolas", monospace; font-size: 1.5rem; font-weight: 800; letter-spacing: 4px; background: var(--bg); border: 1px dashed var(--line-strong); border-radius: 8px; padding: 14px 18px; text-align: center; color: var(--ink); }

/* --- Misc --------------------------------------------------------------- */
.muted { color: var(--muted); }
.text-sm { font-size: .86rem; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; gap: 12px; align-items: center; }
.flex-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.right { margin-left: auto; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: .92rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 2rem; margin-bottom: 8px; }

/* --- Footer ------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); background: #fff; margin-top: 40px; }
.site-footer .inner { max-width: var(--maxw); margin: 0 auto; padding: 22px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .84rem; }
.site-footer a { color: var(--graphite); }

/* --- Reprodutor de video local ----------------------------------------- */
.vplayer { background: #000; border-radius: var(--radius); overflow: hidden; outline: none; box-shadow: var(--shadow-sm); }
.vplayer video { width: 100%; display: block; max-height: 72vh; background: #000; cursor: pointer; }
.vp-bar { display: flex; align-items: center; gap: 8px; padding: 9px 10px; background: #101317; color: #fff; flex-wrap: wrap; }
.vp-btn { background: rgba(255,255,255,.12); color: #fff; border: none; border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: .9rem; font-weight: 700; min-width: 40px; line-height: 1; }
.vp-btn:hover { background: rgba(255,255,255,.24); }
.vp-play { background: var(--leica-red); }
.vp-play:hover { background: var(--leica-red-dark); }
.vp-seek { flex: 1 1 140px; min-width: 120px; accent-color: var(--leica-red); height: 5px; cursor: pointer; }
.vp-time { font-size: .82rem; color: #cbd2da; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vp-speed-wrap { font-size: .76rem; color: #9aa1ab; display: flex; align-items: center; gap: 5px; }
.vp-speed { background: #1c2127; color: #fff; border: 1px solid #333a44; border-radius: 6px; padding: 5px 6px; font-size: .82rem; font-family: inherit; }
.vplayer:focus-visible { box-shadow: 0 0 0 3px rgba(226,0,15,.4); }

/* --- Avaliacao (quiz) --------------------------------------------------- */
.quiz-q { padding: 16px 0; border-bottom: 1px solid var(--line); }
.quiz-q:last-of-type { border-bottom: none; }
.quiz-q .qnum { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--bg-2); color: var(--muted); font-size: .76rem; font-weight: 700; margin-right: 8px; }
.quiz-q .qtext { font-weight: 700; margin-bottom: 12px; }
.quiz-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: .12s; }
.quiz-opt:hover { border-color: var(--muted); background: var(--bg); }
.quiz-opt input { margin-top: 3px; accent-color: var(--leica-red); flex: none; }
.quiz-opt.correct { border-color: #bfe6cd; background: var(--ok-bg); }
.quiz-opt.wrong { border-color: #f3c7c3; background: var(--danger-bg); }
.quiz-score { display: flex; align-items: center; gap: 16px; }
.quiz-score .ring { width: 92px; height: 92px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 800; color: #fff; flex: none; }
.quiz-score .ring.ok { background: var(--ok); }
.quiz-score .ring.fail { background: var(--danger); }

/* --- Editor de avaliacao (root) ---------------------------------------- */
.qedit-q { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; background: #fff; }
.qedit-q .qhead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.qedit-q .qhead strong { flex: 1; }
.qedit-opt { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.qedit-opt input[type=radio] { accent-color: var(--leica-red); flex: none; }
.qedit-opt input[type=text] { flex: 1; }

/* --- Public hero (login side) ------------------------------------------ */
.legal-doc { max-width: 760px; margin: 0 auto; }
.legal-doc h2 { margin-top: 1.6em; }
.legal-doc ul { padding-left: 20px; }
.legal-doc li { margin-bottom: 6px; }
