/* McNaughts Training: learner side. Mobile first, no build step. */
:root {
  /* Old McNaughts portal palette (its mcn.css): dark #1d6d38, mid #48904d, primary #4fb258 */
  --brand: #1d6d38;
  --brand-dark: #154f28;
  --brand-light: #eaf5eb;
  --ink: #1d2623;
  --muted: #5f6b67;
  --line: #dfe5e3;
  --bg: #f5f7f6;
  --card: #fff;
  --warn: #9a5b00;
  --warn-bg: #fff4e0;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --ok: #067647;
  --ok-bg: #e7f6ee;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 20, .06), 0 1px 3px rgba(16, 24, 20, .08);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--brand); }
img, video, iframe, object { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 48px; }

/* Cards and lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 12px; }
.stack > * + * { margin-top: 12px; }
.course-card { display: block; color: inherit; text-decoration: none; }
.course-card:hover { border-color: var(--brand); }
.course-card.has-pic { display: flex; gap: 16px; align-items: flex-start; }
.course-pic { flex: none; width: 72px; height: 72px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; padding: 3px; background: #fff; }
.course-info { flex: 1; min-width: 0; }
.course-card h2 { font-size: 1.05rem; }
@media (min-width: 600px) { .course-card h2 { font-size: 1.2rem; } }
@media (min-width: 600px) { .course-pic { width: 110px; height: 74px; } }
.course-card h2 { margin-bottom: 4px; }
.meta { color: var(--muted); font-size: .9rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Badges */
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--ink); white-space: nowrap; }
.badge.complete { background: var(--ok-bg); color: var(--ok); }
.badge.in_progress { background: var(--brand-light); color: var(--brand-dark); }
.badge.expiring { background: var(--warn-bg); color: var(--warn); }
.badge.overdue, .badge.expired { background: var(--bad-bg); color: var(--bad); }

/* Progress */
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 10px 0 4px; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }

/* Buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #fff; color: var(--brand); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--brand); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=email], input[type=password], input[type=text], input[type=tel] {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #c4cdca; border-radius: 10px; font: inherit; background: #fff;
}
input:focus-visible, .btn:focus-visible, .choice:focus-within { outline: 3px solid rgba(29,109,56,.35); outline-offset: 2px; }
.field { margin-bottom: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.error { color: var(--bad); font-size: .9rem; margin-top: 4px; }
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; background: var(--brand-light); color: var(--brand-dark); }
.flash.bad { background: var(--bad-bg); color: var(--bad); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 24px 0; font-size: .9rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* Auth pages: styled like the old Chamilo portal (palette from its mcn.css) */
body.portal { display: flex; flex-direction: column; min-height: 100vh; background: #fff; }
.portal-wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.portal-head { padding: 12px 0; }
.portal-head .logo { display: block; height: 36px; width: auto; }
.portal-bar { background: #1d6d38; }
.portal-bar .portal-wrap { display: flex; }
.portal-bar a { color: #fff; text-decoration: none; padding: 14px 15px; font-size: .95rem; }
.portal-bar a.active, .portal-bar a:hover { background: #48904d; }
.portal-main { flex: 1; padding-top: 20px; padding-bottom: 40px; width: 100%; }
main.portal-main.wrap { max-width: 1140px; }
.content { max-width: 820px; }
.content figure { margin: 16px 0; }
.content figure iframe { display: none; width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 4px; margin-bottom: 8px; }
.content figure a { display: inline-block; padding: 10px 16px; border: 1px solid var(--brand); border-radius: 8px; font-weight: 600; text-decoration: none; }
@media (min-width: 768px) { .content figure iframe { display: block; } }
.portal-head .row { flex-wrap: nowrap; }
.portal-head .who { display: none; }
@media (min-width: 600px) { .portal-head .who { display: inline; } }
.linkish { background: none; border: 0; padding: 6px 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }
.portal-bar .portal-wrap { overflow-x: auto; scrollbar-width: none; }
.portal-bar a { white-space: nowrap; }
.portal-cols { display: flex; flex-direction: column-reverse; gap: 24px; }
.portal-side, .portal-body { min-width: 0; }
.welcome { font-size: 1.2rem; margin: 0 0 16px; }
.video { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.panel { border: 1px solid #ddd; border-radius: 4px; padding: 16px; box-shadow: 0 1px 1px rgba(0,0,0,.05); background: #fff; }
.input-icon { display: flex; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 4px; overflow: hidden; }
.input-icon svg { flex: none; width: 44px; padding: 0 14px; background: #eee; border-right: 1px solid #ccc; fill: #555; }
.input-icon input { border: 0; border-radius: 0; min-width: 0; flex: 1; padding: 8px 12px; font: inherit; }
.input-icon:focus-within { border-color: #4fb258; box-shadow: 0 0 0 3px rgba(79,178,88,.25); }
.input-icon input:focus { outline: none; }
.panel .error { margin: -4px 0 10px; }
.panel .check { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; font-size: .9rem; color: #555; }
.btn-login { display: block; width: 100%; padding: 9px 12px; border: 1px solid #48904d; border-radius: 4px; background: #4fb258; color: #fff; font: inherit; cursor: pointer; }
.btn-login:hover { background: #48904d; }
.lost { display: inline-block; margin: 14px 15px 4px; color: #1d6d38; text-decoration: none; }
.lost:hover { color: #4fb258; }
.auth { max-width: 420px; margin: 0 auto; }
.portal-foot { background: #1d6d38; color: #fff; font-size: .85rem; }
.portal-foot .portal-wrap { display: flex; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 28px; }
.portal-foot a { color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (min-width: 768px) {
  .portal-cols { flex-direction: row; align-items: flex-start; gap: 30px; }
  .portal-side { flex: 0 0 262px; }
  .portal-body { flex: 1; padding-top: 30px; }
}

/* Module player */
.player-head { margin-bottom: 16px; }
.player-head .meta a { color: var(--muted); }
.content { overflow-wrap: anywhere; }
.content img { height: auto; border-radius: 8px; }
.content table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.content td, .content th { border: 1px solid var(--line); padding: 6px 8px; }
.content blockquote { border-left: 4px solid var(--brand); margin: 0 0 1em; padding: 4px 12px; background: var(--brand-light); border-radius: 0 8px 8px 0; }
.player-nav { display: flex; gap: 12px; margin-top: 20px; }
.player-nav > * { flex: 1; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; flex: none; border: 2px solid var(--line); color: var(--muted); }
.steps .done .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.steps .current .dot { border-color: var(--brand); color: var(--brand); }
.steps a { color: inherit; text-decoration: none; }
.steps .locked { color: var(--muted); }

/* Quiz */
.question { padding: 16px 0; border-top: 1px solid var(--line); }
.question:first-of-type { border-top: 0; }
.question legend { font-weight: 600; margin-bottom: 10px; padding: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; font-weight: 400; background: #fff; }
.choice input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-light); }
.choice.correct { border-color: var(--ok); background: var(--ok-bg); }
.choice.wrong { border-color: var(--bad); background: var(--bad-bg); }
.result { text-align: center; padding: 24px 16px; }
.result .score { font-size: 3rem; font-weight: 800; line-height: 1; margin: 8px 0; }
.result.pass .score { color: var(--ok); }
.result.fail .score { color: var(--bad); }
.explain { font-size: .92rem; color: var(--muted); margin-top: 6px; }

/* Acknowledgement */
.ack-box { border: 2px solid var(--brand); border-radius: var(--radius); padding: 16px; background: #fff; }

/* Certificates list */
.cert-row { display: flex; gap: 12px; align-items: center; }
.cert-row .icon { width: 44px; height: 44px; border-radius: 10px; background: var(--brand-light); color: var(--brand); display: grid; place-items: center; flex: none; }

.empty { text-align: center; color: var(--muted); padding: 32px 16px; }

@media (min-width: 640px) {
  h1 { font-size: 1.8rem; }
  .card { padding: 20px 24px; }
  .player-nav > * { flex: 0 0 auto; }
  .player-nav .next { margin-left: auto; }
}
