/* BeautyProfi visual identity (Stage 2.6): white ground, #222222 text, #5F98F1 accent with dark text,
   light cards, soft status tints. Only the look changes — every selector used by app.js stays. */
:root {
  --bg: #f7f9fc;
  --card: #ffffff;
  --text: #222222;
  --muted: #5e6470;
  --accent: #5f98f1;
  --accent-hover: #4f8be9;
  --accent-text: #222222;
  --link: #2f6fd0; /* #5F98F1 darkened for text on white (WCAG AA) */
  --track: #e3ecfb;
  --border: #e6ebf2;
  --done: #1e6b45;
  --done-bg: #e7f5ee;
  --ready: #2f5fb3;
  --ready-bg: #eaf2fe;
  --progress: #234e99;
  --progress-bg: #dce8fc;
  --pending: #7a5a12;
  --pending-bg: #fdf4db;
  --locked: #6b7078;
  --locked-bg: #f0f1f3;
  --failed: #b4453f;
  --failed-bg: #fdecea;
  --focus: #2f6fd0;
  --radius: 12px;
  --radius-button: 10px;
  --shadow: 0 1px 2px rgba(34, 34, 34, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181d;
    --card: #1f242c;
    --text: #eef1f5;
    --muted: #a7b0bd;
    --accent: #5f98f1;
    --accent-hover: #74a6f3;
    --accent-text: #111418;
    --link: #8ab6f7;
    --track: #2a3340;
    --border: #2c333d;
    --done: #7fd6a8;
    --done-bg: #173226;
    --ready: #9cc1fa;
    --ready-bg: #1b2a42;
    --progress: #b8d2fb;
    --progress-bg: #213555;
    --pending: #f0c96e;
    --pending-bg: #3a3018;
    --locked: #a3a9b2;
    --locked-bg: #272c34;
    --failed: #f19a94;
    --failed-bg: #3a2020;
    --focus: #8ab6f7;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  font-size: 15px;
}

/* the official BeautyProfi ŠKOLA logo, shown as shipped (round mark on white) */
.brand-logo {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  object-fit: cover;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 96px;
}

h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; margin: 8px 0 4px; overflow-wrap: break-word; }
h2 { font-size: 19px; font-weight: 700; margin: 28px 0 12px; }

.muted { color: var(--muted); }
.center { text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.progress-card { margin-top: 16px; }
.progress-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.progress-count { font-size: 20px; font-weight: 700; }

.progress {
  height: 10px;
  margin: 12px 0 4px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* primary CTA: Spustit test / Pokračovat v testu / Opakovat test / Materiály */
.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  margin-top: 16px;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius-button);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
a.button:hover, button.button:hover:not(:disabled) { background: var(--accent-hover); }

.button[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

.modules { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.module {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  text-decoration: none;
}
a.module:hover { border-color: var(--accent); }

.module-order {
  flex: 0 0 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--progress);
  background: var(--track);
}

.module-body { flex: 1; min-width: 0; }
.module-title { font-weight: 600; overflow-wrap: anywhere; }
.module-status { font-size: 14px; }
.module.locked { opacity: 0.8; }
.status-completed { color: var(--done); }
.status-available { color: var(--ready); }
.status-locked { color: var(--locked); }
.status-pending { color: var(--pending); }
.status-progress { color: var(--progress); }
.status-failed { color: var(--failed); }
.chevron { color: var(--muted); font-size: 22px; }

.small { font-size: 14px; }
.module-meta { font-size: 13px; }
.current { margin-top: 12px; display: grid; gap: 4px; }
.card + .card { margin-top: 12px; }
.card-title { margin: 0 0 8px; font-size: 17px; font-weight: 700; }

.attempts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.attempts li { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; }
.attempts li.voided span:first-child { text-decoration: line-through; color: var(--muted); }

/* quiz player */
button.button { font: inherit; font-size: 17px; font-weight: 600; cursor: pointer; }
button.button:disabled { opacity: 0.4; cursor: default; }
/* secondary: Zpět / Zpět na přehled — white ground, blue outline, blue text */
.button.secondary { background: var(--card); color: var(--link); border: 1.5px solid var(--accent); }
a.button.secondary:hover, button.button.secondary:hover:not(:disabled) { background: var(--ready-bg); }
.quiz-nav { display: flex; gap: 12px; }
.quiz-nav .button { flex: 1; }
.question { margin-top: 16px; }
.question-text { margin: 0 0 12px; font-weight: 600; overflow-wrap: anywhere; }
.options { display: grid; gap: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-button);
  background: var(--card);
  cursor: pointer;
  overflow-wrap: anywhere;
}
.option input { flex: 0 0 auto; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.option-letter { flex: 0 0 auto; font-weight: 700; color: var(--muted); }
.option.selected { border-color: var(--accent); background: var(--ready-bg); }
.answer-text {
  display: block;
  width: 100%;
  min-height: 140px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-button);
  background: var(--card);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.answer-text:focus { outline: none; border-color: var(--accent); }
.counter { text-align: right; margin-top: 4px; }

/* module navigation: 📚 Materiály + 📝 Test (Stage 2.4B) */
.module-nav { display: grid; gap: 6px; margin: 16px 0; }
.module-nav .button { margin-top: 0; }
.module-nav .button.test { margin-top: 10px; }
.module-nav p { margin: 0; }
.button.materials { background: var(--accent); color: var(--accent-text); border: 0; }

/* test taking (Stage 2.3B) */
.pre { white-space: pre-line; }
.alert { border-color: var(--accent); background: var(--ready-bg); }
.result.passed { border-left: 4px solid var(--done); }
.result.failed { border-left: 4px solid var(--failed); }
.result p { margin: 8px 0 0; }
.option input:disabled + .option-letter { opacity: 0.6; }

.facts { margin: 0; display: grid; gap: 12px; }
.facts div { display: grid; gap: 2px; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.back { display: inline-block; min-height: 44px; padding: 10px 0; text-decoration: none; color: var(--link); font-weight: 600; }

.notice { margin-top: 16px; }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar a {
  flex: 1;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

.tabbar a[aria-current="page"] { color: var(--link); box-shadow: inset 0 3px 0 var(--accent); }
.tabbar[hidden] { display: none; } /* display:flex above would otherwise override the hidden attribute */

@media (min-width: 720px) {
  .page { padding-top: 32px; }
  h1 { font-size: 32px; }
}

/* student UX polish (Stage 2.5) */
html, body { overflow-x: hidden; }
.eyebrow { margin: 4px 0 0; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--link); }
.progress-card .card-title { margin: 0; }

/* status badges: the five server display statuses (text + icon + soft tint, never colour alone) */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.badge.status-completed { background: var(--done-bg); }
.badge.status-available { background: var(--ready-bg); }
.badge.status-progress { background: var(--progress-bg); }
.badge.status-pending { background: var(--pending-bg); border-color: var(--pending); } /* distinct, not an error */
.badge.status-locked { background: var(--locked-bg); }
.module-line { display: block; margin-top: 4px; }
.module-meta { display: block; margin-top: 2px; }

/* module screen: Informace / Materiály / Test / Historie pokusů */
.module-section { margin-top: 12px; display: grid; gap: 10px; }
.module-section .card-title { margin: 0; }
.module-section .button { margin-top: 4px; }
.module-section p { margin: 0; }
.description { overflow-wrap: break-word; }
.facts dd .badge { font-weight: 600; }

/* keyboard focus stays visible and does not move the layout */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.option:focus-within { border-color: var(--focus); }

/* Stage 3: registration, progress, manual review, admin panel (same BeautyProfi palette) */
.tabbar a[hidden] { display: none; }
.tabbar a { font-size: 14px; padding: 0 4px; }
.status-revision { color: var(--failed); }
.badge.status-revision { background: var(--failed-bg); border-color: var(--failed); }
.status-failed-badge { color: var(--failed); }
.badge.status-failed-badge { background: var(--failed-bg); }
.badge.status-current { color: var(--progress); background: var(--progress-bg); margin-left: 6px; }
.module.is-current { border-color: var(--accent); }
.review-box { display: grid; gap: 6px; }
.review-box p { margin: 0; }
.notice.success { border-color: var(--done); background: var(--done-bg); color: var(--done); }

.form { display: grid; gap: 14px; margin-top: 16px; }
.form .button { margin-top: 4px; }
.field { display: grid; gap: 6px; font-weight: 600; }
.text-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-button);
  background: var(--card);
  color: var(--text);
  font: inherit;
}
.text-input:focus { outline: none; border-color: var(--accent); }

.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
}
.chip.active { border-color: var(--accent); background: var(--ready-bg); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { display: grid; gap: 4px; text-decoration: none; }
.stat.highlight { border-color: var(--accent); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--link); }
.stat-label { color: var(--muted); font-size: 14px; }
.stack { display: grid; gap: 10px; margin-top: 12px; }
.stack .button { margin-top: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.facts.compact { gap: 8px; margin-top: 10px; }
.filters { display: grid; gap: 10px; margin-bottom: 12px; }
.filters .button { margin-top: 0; }
.answer-box {
  padding: 12px;
  border-radius: var(--radius-button);
  background: var(--bg);
  border: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.audit li { flex-direction: column; }
.module-section .quiz-nav .button, .quiz-nav a.button { margin-top: 0; }
@media (min-width: 720px) {
  .filters { grid-template-columns: 1fr 2fr auto; align-items: center; }
}
.round summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.round-answer { display: grid; gap: 4px; margin-top: 8px; }
.round-answer p { margin: 0; }
