/* Akademia Bezpieczeństwa CISS — panel kursanta.
   Kierunek: czarne tło jak akademiabezpieczenstwa.pl, petrolowe (niebiesko-zielone) pasy i akcenty,
   Open Sans: kontrast pogrubionej i lekkiej odmiany w nagłówkach, białe obrysowane przyciski-pigułki.
   Kontrast sprawdzony obliczeniowo (WCAG): tekst ≥ 14:1, muted/akcent ≥ 5.5:1 na tłach poza --petrol-2. */

@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/opensans/open-sans-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/opensans/open-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --bg: #000000;          /* strona — czarna jak nagłówek akademiabezpieczenstwa.pl */
  --surface: #0c1519;     /* panele */
  --surface-2: #11222a;   /* hover / wyróżnienie */
  --line: #1f3a45;        /* jedno obramowanie */
  --petrol: #1b3a4b;      /* pas informacyjny (jak na stronie) */
  --petrol-2: #2a5a73;    /* wypełnienia z białym tekstem */
  --text: #eef3f5;
  --muted: #9fb3ba;
  --accent: #5cc6d4;      /* akcent na tekst/linki/postęp */
  --ok: #4fd1a5;
  --warn: #f0b450;
  --err: #f2766b;
  --font: "Open Sans", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --pill: 999px;
  --r: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--text); background: var(--bg); font-weight: 400; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* --- Nagłówek jak na stronie Akademii: logo + nawigacja wersalikami --- */
.topbar { background: #000; position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; align-items: center; gap: 48px; min-height: 84px; border-bottom: 1px solid #2b2f31; }
.logo { display: block; height: 36px; width: auto; max-width: 100%; }
.topnav { display: flex; gap: 36px; flex: 1; }
.topnav a { color: #fff; text-decoration: none; font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; padding: 6px 0; border-bottom: 2px solid transparent; }
.topnav a.on, .topnav a:hover { border-bottom-color: var(--accent); }
.topbar-user { display: flex; align-items: center; gap: 16px; margin: 0; }
.who { color: var(--muted); font-size: .88rem; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-link { background: none; border: 0; padding: 4px 0; color: #fff; font: inherit; font-size: .88rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.btn-link:hover { text-decoration-color: var(--accent); }

.main { padding-bottom: 72px; min-height: 60vh; }
.foot { color: var(--muted); font-size: .82rem; padding: 28px 20px; border-top: 1px solid #1a1d1f; }

/* --- Przyciski: obrysowane pigułki (wzór „Dowiedz się więcej”) --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 30px;
  border-radius: var(--pill); border: 2px solid #fff; background: transparent; color: #fff; font: inherit; font-size: .8rem;
  font-weight: 700; letter-spacing: .12em; text-transform: uppercase; text-decoration: none; cursor: pointer; transition: background .15s, color .15s; }
.btn:hover { background: #fff; color: #000; }
.btn-primary { background: #fff; color: #000; }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #000; }
.btn-ghost { border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { background: transparent; border-color: #fff; color: #fff; }
.btn-block { width: 100%; }

.flash { padding: 14px 18px; border-radius: var(--r); margin: 24px 0 0; border: 1px solid; }
.flash.ok { border-color: var(--ok); color: var(--ok); } .flash.err { border-color: var(--err); color: var(--err); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .9rem; }
.badge svg { width: 16px; height: 16px; flex: none; }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); }

/* --- Formularze --- */
.form { display: grid; gap: 10px; margin: 28px 0 18px; }
.form label { font-weight: 600; font-size: .92rem; }
.form input { width: 100%; min-height: 52px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--text); font: inherit; }
.form input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(92,198,212,.18); }
.form input[aria-invalid="true"] { border-color: var(--err); }
.form .btn { margin-top: 10px; }
.field-err { color: var(--err); margin: 0; font-size: .9rem; }
.code-input { font-size: 1.8rem !important; letter-spacing: .45em; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }

/* --- Logowanie --- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); background: #000; }
.auth-side { padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(700px 500px at 0% 100%, rgba(42,90,115,.45), transparent 70%), #000; border-right: 1px solid #1a1d1f; }
.auth-side .logo { height: 44px; align-self: flex-start; }
.auth-side .auth-claim { color: var(--text); margin: 0; }
.auth-claim { font-size: clamp(2rem, 1.2rem + 2.6vw, 3.4rem); line-height: 1.18; font-weight: 300; max-width: 15ch; }
.auth-claim strong { display: block; font-weight: 700; }
.auth-side p { color: var(--muted); max-width: 46ch; margin: 18px 0 0; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 56px 64px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.9rem; font-weight: 700; }
.auth-card .lead { color: var(--muted); margin: 12px 0 0; }
.auth-card .small { margin: 14px 0 0; }

/* --- Strona szkolenia: czarne „hero” + petrolowy pas jak na stronie --- */
.hero { padding: 72px 0 56px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: end; }
.hero h1 { font-size: clamp(2.1rem, 1.3rem + 2.8vw, 3.6rem); font-weight: 300; line-height: 1.15; }
.hero h1 strong { display: block; font-weight: 700; }
.hero-progress { margin-top: 32px; max-width: 560px; }
.bar { height: 4px; background: #1a2a31; border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.hero-progress p { color: var(--muted); margin: 10px 0 0; font-size: .92rem; }
.hero-next { text-align: right; }
.hero-next p { color: var(--muted); margin: 12px 0 0; font-size: .9rem; max-width: 34ch; margin-left: auto; }

.band { background: var(--petrol); }
.band-in { padding: 44px 20px; display: flex; gap: 32px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.band-text { font-size: clamp(1.15rem, 1rem + .6vw, 1.5rem); line-height: 1.45; font-weight: 300; max-width: 44ch; margin: 0; }
.band-text strong { display: block; font-weight: 700; }

.section-title { font-size: 1.4rem; font-weight: 300; margin: 64px 0 22px; }
.section-title strong { font-weight: 700; }

/* Moduły: lista z liniami podziału (nie karty); numer modułu = sekwencja kursu */
.modules { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.module details { border-bottom: 1px solid var(--line); }
.module summary { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto 20px; gap: 18px; align-items: center; padding: 20px 4px; cursor: pointer; list-style: none; }
.module summary::-webkit-details-marker { display: none; }
.module summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); justify-self: center; transition: transform .2s; }
.module details[open] summary::after { transform: rotate(-135deg); }
.module summary:hover .module-title { color: #fff; }
.module-num { font-size: 2.1rem; font-weight: 300; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.module-num.word { font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.module-title { font-size: 1.08rem; font-weight: 600; color: #dfe8eb; }
.module-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.module-meta .bar { width: 72px; }
.module-meta.all { color: var(--ok); }
.module-meta.all .bar span { background: var(--ok); }
.lessons { list-style: none; margin: 0; padding: 0 0 16px 90px; }
.lesson-link { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 14px; border-radius: 8px; text-decoration: none; color: var(--text); }
.lesson-link:hover { background: var(--surface-2); }
.lesson-link.is-current { background: var(--petrol); }
.lesson-ico { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid #3a5560; display: grid; place-items: center; color: var(--muted); }
.lesson-ico svg { width: 11px; height: 11px; }
.lesson-link.is-done .lesson-ico { background: var(--ok); border-color: var(--ok); color: #00140d; }
.lesson-name { font-size: .97rem; }
.lesson-nr { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 10px; }
.lesson-dur { color: var(--muted); font-size: .82rem; white-space: nowrap; }

/* --- Lekcja: spis z lewej (sticky), odtwarzacz dopasowany do wysokości okna --- */
.lesson-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 40px; align-items: start; padding-top: 32px; }
.toc { position: sticky; top: 104px; max-height: calc(100vh - 124px); overflow-y: auto; padding-right: 6px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.toc-back { display: inline-block; color: var(--muted); text-decoration: none; font-size: .88rem; margin-bottom: 16px; }
.toc-back:hover { color: #fff; }
.toc .modules { border-top-color: #1a2a31; }
.toc .module details { border-bottom-color: #1a2a31; }
.toc .module summary { grid-template-columns: 34px minmax(0, 1fr) auto 14px; gap: 10px; padding: 13px 2px; }
.toc .module-num { font-size: 1.1rem; }
.toc .module-num.word { font-size: .62rem; }
.toc .module-title { font-size: .9rem; }
.toc .module-meta .bar { display: none; }
.toc .lessons { padding: 0 0 10px 0; }
.toc .lesson-link { grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; padding: 8px 10px; }
.toc .lesson-ico { width: 22px; height: 22px; }
.toc .lesson-name { font-size: .88rem; }
.lesson-crumb { color: var(--muted); font-size: .88rem; margin: 0 0 8px; }
.lesson h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.3rem); font-weight: 300; }
.lesson h1 .lesson-nr { font-weight: 700; color: var(--accent); margin-right: 14px; }
.video { position: relative; aspect-ratio: 16 / 9; width: 100%; max-width: max(560px, calc((100dvh - 300px) * 16 / 9)); background: #000; border: 1px solid #1a2a31; border-radius: var(--r); overflow: hidden; margin: 24px 0; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-missing { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; background: radial-gradient(circle at 50% 40%, var(--petrol), #000 75%); }
.video-missing p { margin: 4px; } .video-missing .small { color: var(--muted); }
.prose { max-width: 70ch; color: #d9e3e6; margin-top: 22px; }
.prose p { margin: 0 0 1.1em; }
.lesson-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.lesson-actions form { margin: 0; }
.spacer { flex: 1; }

/* --- Egzamin --- */
.narrow { max-width: 780px; }
.page-head { padding: 64px 0 8px; }
.page-head h1 { font-size: clamp(2rem, 1.3rem + 2.2vw, 3rem); font-weight: 300; }
.page-head h1 strong { display: block; font-weight: 700; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 36px 0; padding: 0; list-style: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts li { padding: 20px 18px 20px 0; color: var(--muted); font-size: .9rem; }
.facts li + li { padding-left: 18px; border-left: 1px solid var(--line); }
.facts strong { display: block; font-size: 1.9rem; font-weight: 300; color: #fff; line-height: 1.2; }
.callout { background: var(--petrol); border-radius: var(--r); padding: 22px 24px; margin: 0 0 24px; line-height: 1.55; }
.result { display: flex; gap: 28px; align-items: center; padding: 26px 0; margin: 0 0 24px; border-bottom: 1px solid var(--line); }
.result-score { font-size: 3.6rem; font-weight: 300; line-height: 1; margin: 0; }
.result.ok .result-score { color: var(--ok); } .result.fail .result-score { color: var(--err); }
.result p { margin: 0; } .result .muted { display: block; font-size: .9rem; margin-top: 4px; }

.exam-bar { position: sticky; top: 84px; z-index: 10; background: rgba(0,0,0,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.exam-bar-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.exam-meta { display: flex; align-items: center; gap: 22px; }
.timer { font-size: 1.7rem; font-weight: 300; font-variant-numeric: tabular-nums; color: #fff; }
.timer.low { color: var(--err); font-weight: 600; }
.question { border: 0; border-bottom: 1px solid var(--line); padding: 32px 0 22px; margin: 0; min-width: 0; }
.question legend { float: left; width: 100%; padding: 0; margin-bottom: 18px; font-size: 1.06rem; font-weight: 600; line-height: 1.5; }
.q-num { color: var(--accent); font-weight: 300; font-size: 1.3rem; margin-right: 10px; font-variant-numeric: tabular-nums; }
.option { clear: both; display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; cursor: pointer; background: var(--surface); }
.option:hover { border-color: #3a5560; }
.option input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.option:has(input:checked) { border-color: var(--accent); background: var(--petrol); }
.save-state { clear: both; min-height: 1.3em; margin: 4px 0 0; }
.finish { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 36px; }
.finish p { flex-basis: 100%; margin: 0; }

/* --- Certyfikat --- */
.cert { border: 1px solid var(--line); border-radius: var(--r); padding: 32px; background: radial-gradient(600px 300px at 100% 0%, rgba(42,90,115,.35), transparent 70%), var(--surface); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 10px 28px; margin: 22px 0 28px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; font-weight: 600; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media (max-width: 980px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; order: 2; }
  .hero { grid-template-columns: 1fr; align-items: start; }
  .hero-next { text-align: left; } .hero-next p { margin-left: 0; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 32px 20px; gap: 40px; border-right: 0; border-bottom: 1px solid #1a1d1f; }
  .auth-panel { padding: 40px 20px 56px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts li:nth-child(3) { padding-left: 0; border-left: 0; }
  .facts li:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .topbar-in { gap: 14px; min-height: 64px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 10px; }
  .logo { height: 28px; }
  .topbar-user { margin-left: auto; }
  .topnav { order: 3; flex-basis: 100%; gap: 24px; }
  .who { display: none; }
  .hero { padding: 40px 0 36px; }
  .module summary { grid-template-columns: 44px minmax(0, 1fr) 16px; }
  .module summary .module-meta { display: none; }
  .module-num { font-size: 1.5rem; }
  .lessons { padding-left: 0; }
  .exam-bar { top: 0; }
  .btn { padding: 12px 22px; }
}
