/* Catalog AdinaMatematica — brand palette from logo:
   deep blue #004d94, azure #018fc6, ink #343333, white */

@font-face { font-family: 'Poppins'; src: url('/static/fonts/Poppins-Light.woff2') format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('/static/fonts/Poppins-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('/static/fonts/Poppins-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('/static/fonts/Poppins-SemiBold.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('/static/fonts/Poppins-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --blue: #004d94;
  --azure: #018fc6;
  --azure-soft: #e6f4fb;
  --ink: #343333;
  --muted: #6b7280;
  --bg: #f4f7fa;
  --card: #ffffff;
  --line: #e3eaf2;
  --danger: #c0392b;
  --warn-bg: #fff4e0;
  --ok: #1e7e4e;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}
a { color: var(--azure); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; font-weight: 600; margin: 0.4rem 0 1rem; color: var(--blue); }
h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 0.75rem; color: var(--blue); }
h3 { font-size: 1rem; font-weight: 600; margin: 1rem 0 0.5rem; }
code { background: var(--azure-soft); padding: 0.1rem 0.35rem; border-radius: 5px; }
code.code { font-size: 1.05rem; font-weight: 600; letter-spacing: 0.06em; color: var(--blue); }

/* ---------- header ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--blue); color: #fff; padding: 0.55rem 1.2rem;
  position: sticky; top: 0; z-index: 10; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; background: #fff; border-radius: 6px; padding: 2px 4px; }
.brand-text { font-weight: 600; font-size: 1.05rem; display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-weight: 400; font-size: 0.72rem; opacity: 0.85; }
.nav { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.nav a { color: #dcebf7; font-size: 0.9rem; font-weight: 500; }
.nav a:hover { color: #fff; text-decoration: none; }
.nav-user { color: #9fc6e4; font-size: 0.85rem; }
.inline { display: inline; }
.linklike {
  background: none; border: none; color: #dcebf7; font: inherit; font-size: 0.9rem;
  cursor: pointer; padding: 0;
}
.linklike:hover { color: #fff; text-decoration: underline; }

/* ---------- layout ---------- */
.container { max-width: 1080px; margin: 1.4rem auto 3rem; padding: 0 1rem; }
.footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 1.2rem 0 2rem; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; margin-bottom: 1.1rem;
  box-shadow: 0 1px 3px rgba(0, 30, 60, 0.05);
}
.auth { max-width: 460px; margin: 2.5rem auto; text-align: left; }
.auth .logo-lg { display: block; height: 52px; margin: 0 auto 0.8rem; }
.auth h1 { text-align: center; }
.auth p.muted { text-align: center; }
.auth form .btn { margin-top: 1rem; }

/* ---------- forms ---------- */
label { display: block; font-size: 0.85rem; font-weight: 500; margin: 0.7rem 0 0.25rem; }
label.check, label.radio { font-weight: 400; display: flex; gap: 0.45rem; align-items: flex-start; font-size: 0.85rem; }
label.check span, label.radio span { flex: 1; min-width: 0; }
.hint { margin: 0.3rem 0 0; font-size: 0.78rem; color: var(--muted); }
/* live password checklist (password_check.js) */
.pw-rules { list-style: none; margin: 0.45rem 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem 1.25rem; font-size: 0.78rem; }
.pw-rule, .pw-match { color: var(--muted); display: flex; align-items: center; gap: 0.4rem; }
.pw-rule::before, .pw-match::before {
  content: ""; flex: 0 0 auto; width: 0.55em; height: 0.55em; border-radius: 50%;
  border: 2px solid var(--muted);
}
.pw-rule.ok, .pw-match.ok { color: var(--ok); }
.pw-rule.ok::before, .pw-match.ok::before { background: var(--ok); border-color: var(--ok); }
.pw-rule.fail, .pw-match.fail { color: var(--danger); }
.pw-rule.fail::before, .pw-match.fail::before { border-color: var(--danger); }
@media (max-width: 600px) { .pw-rules { grid-template-columns: 1fr; } }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], input[type="file"], select {
  width: 100%; padding: 0.55rem 0.7rem; border: 1px solid #cdd8e3; border-radius: 8px;
  font: inherit; font-size: 0.92rem; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--azure); outline-offset: 0; border-color: var(--azure); }
.row > input, .row > select, .row > label { width: auto; }
/* form rows: file input keeps its full "No file chosen" label, dates/select
   stay at natural width, only text inputs grow, labels never wrap or shrink */
.row > input[type="file"] { flex: 0 0 auto; min-width: 245px; }
.row > input[type="date"], .row > input[type="number"] { flex: 0 0 auto; }
.row > input[type="text"] { flex: 1 1 240px; min-width: 200px; }
.row > select { flex: 0 0 auto; min-width: 170px; max-width: 280px; }
.row > label.radio { flex: 0 0 auto; white-space: nowrap; }
.row + .row { margin-top: 0.7rem; }
.pct-input { width: 86px; }
.note-input { width: 160px; }
@media (max-width: 600px) { .note-input { width: 110px; } }
.grade-cell { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }

.btn {
  display: inline-block; padding: 0.5rem 1.05rem; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer; text-align: center;
  background: #e8eef5; color: var(--ink);
}
.btn:hover { background: #dde7f1; text-decoration: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: #003d78; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-danger-outline { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background: #fdecea; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { background: #f0f4f8; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th {
  text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); border-bottom: 2px solid var(--line); padding: 0.45rem 0.5rem;
}
.table td { padding: 0.5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table form td { padding-left: 0; padding-right: 0.3rem; }
.scroll { overflow-x: auto; }

/* ---------- badges / alerts ---------- */
.badge {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 500; background: #eef2f7; color: var(--muted);
}
.badge-ok { background: #e2f4ea; color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: #9a6b00; }
.badge-lipsa { background: #fdecea; color: var(--danger); }
.badge-note { background: var(--azure-soft); color: var(--blue); }
.badge-new { background: #e9e2f7; color: #5b3fa8; }
.alert {
  background: var(--azure-soft); border: 1px solid #bcdcf0; color: #14456b;
  border-radius: 8px; padding: 0.6rem 0.9rem; font-size: 0.88rem; margin: 0.7rem 0;
}

/* ---------- stats ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.9rem; margin-bottom: 1.1rem; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem 1rem; text-align: center;
}
.stat-num { font-size: 1.7rem; font-weight: 700; color: var(--blue); }
.stat-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- month groups (Teste page) ---------- */
.month-group {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 0.9rem; box-shadow: 0 1px 3px rgba(0, 30, 60, 0.05); overflow: hidden;
}
.month-group summary {
  display: flex; align-items: center; gap: 0.55rem; cursor: pointer;
  padding: 0.7rem 1.1rem; font-weight: 600; font-size: 1rem; color: var(--blue);
  list-style: none; user-select: none;
}
.month-group summary::-webkit-details-marker { display: none; }
.month-group summary::before {
  content: ""; width: 0.5em; height: 0.5em; flex: 0 0 auto;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform 0.15s ease; margin-right: 0.25rem;
}
.month-group[open] summary::before { transform: rotate(45deg); }
.month-group summary .badge { margin-left: auto; }
.month-body { padding: 0.1rem 1.1rem 0.9rem; }
.month-body .table { margin-bottom: 0.2rem; }

/* per-question results row (embedded under a student/evaluation row) */
.qa-cell { background: #f7fafc; padding: 0.35rem 0.9rem 0.6rem !important; }
.qa-cell .month-group { margin-bottom: 0; box-shadow: none; }
.qa-q { max-width: 34rem; }

/* checkbox grid (manual code form) */
.check-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.25rem 1rem; width: 100%; margin: 0.4rem 0;
}
.check-grid label.check { margin: 0; }
.check-grid label.check input { margin-top: 0.28em; }

/* ---------- misc ---------- */
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.audit-list { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; }
.audit-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
.audit-list li:last-child { border-bottom: none; }
.kid-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.4rem; }
.kid h2 { margin: 0; }

/* ---------- chart ---------- */
.chart { width: 100%; height: auto; margin: 0.6rem 0 0.2rem; }
.chart-label { font-size: 11px; fill: var(--muted); font-family: 'Poppins', sans-serif; }
.chart-value { font-size: 11.5px; font-weight: 600; fill: var(--blue); font-family: 'Poppins', sans-serif; }

/* ---------- KaTeX math (FlexiQuiz exports ship LaTeX) ---------- */
.katex { font-size: 1.02em; }
.katex-display { margin: 0.35rem 0; }
/* unparseable math: keep it quiet, show the raw source as normal text */
.katex-error { color: inherit; font-size: inherit; font-family: inherit; }
.qa-q { line-height: 1.5; }

/* ---------- test image (FlexiQuiz screenshot with figures) ---------- */
.test-img { max-width: 380px; width: auto; height: auto; display: block;
  border: 1px solid var(--line); border-radius: var(--radius); margin-top: 0.4rem;
  background: var(--card); }
.test-img-link { display: inline-block; }
.test-img-link:hover .test-img { opacity: 0.88; }

/* ---------- upcoming tests (calendar) ---------- */
.upcoming-dates { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.upcoming-date {
  background: var(--azure-soft);
  color: var(--blue);
  border: 1px solid #c9e5f5;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.95rem;
}

/* ---------- panou parinte: tiles (paleta indigo, varianta aprobata) ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin: 0.9rem 0 0.2rem; }
.tile {
  border-radius: var(--radius); padding: 1rem 1.1rem; color: #fff;
  box-shadow: 0 1px 3px rgba(0, 30, 60, 0.08);
}
.tile-deep { background: #565B9F; }
.tile-mid { background: #999AE8; color: #000; }
.tile-light { background: #BBCEF4; color: #000; }
.tile-kpi { position: relative; display: flex; flex-direction: column; gap: 0.15rem; min-height: 120px; }
.tile-ic { position: absolute; top: 1rem; right: 1.1rem; }
.tile-ic svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.95; }
.tile .big { font-size: 2rem; font-weight: 700; line-height: 1.15; }
.tile .big small { font-size: 1.05rem; font-weight: 500; opacity: 0.8; }
.tile .lbl { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; opacity: 0.85; }
.tile .sub { font-size: 0.78rem; opacity: 0.7; }

.recent-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 0.75rem 0; }
.tile-report { display: block; text-decoration: none; }
.tile-report:hover { filter: brightness(1.04); }
.tile-report .r-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.tile-report .r-title { font-weight: 600; font-size: 0.98rem; }
.tile-report .r-badge { background: rgba(255, 255, 255, 0.22); border-radius: 8px; padding: 0.15rem 0.55rem; font-weight: 700; font-size: 0.95rem; }
.tile-mid .r-badge, .tile-light .r-badge { background: rgba(0, 0, 0, 0.10); }
.tile-report .r-date { font-size: 0.78rem; opacity: 0.75; margin-top: 0.1rem; }
.r-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.28); margin: 0.55rem 0 0.45rem; overflow: hidden; }
.tile-mid .r-bar, .tile-light .r-bar { background: rgba(0, 0, 0, 0.15); }
.r-bar > i { display: block; height: 100%; background: #fff; border-radius: 999px; }
.tile-mid .r-bar > i, .tile-light .r-bar > i { background: #000; }
.tile-report .r-meta { font-size: 0.8rem; opacity: 0.9; }
.tile-report .r-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-top: 0.55rem; font-size: 0.8rem; opacity: 0.85; }

/* card "Teste viitoare" + logo in dreapta */
.up-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.up-left { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.up-label { font-weight: 600; }
.up-logo { height: 44px; width: auto; }
.up-note { margin: 0.6rem 0 0; font-size: 0.88rem; color: var(--muted, #5a6474); border-left: 4px solid var(--azure); padding-left: 0.6rem; }

/* fisierul testului in PDF (panoul parintelui) */
.test-pdf { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.5rem 0 0.25rem; }

/* feedback personalizat */
.topic-row { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.topic-line { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.topic-name { font-weight: 600; color: var(--blue); }
.topic-count, .badge-count { background: var(--warn-bg); color: #8a5b12; font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.6rem; border-radius: 999px; white-space: nowrap; }
.topic-q { font-size: 0.88rem; margin-top: 0.25rem; }
.topic-q .bad { color: var(--danger); }
.topic-q .good { color: var(--ok); }
.fb-more { font-size: 0.85rem; color: var(--muted); margin: 0.7rem 0 0.8rem; }
.fb-cta { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 0.9rem 0 0; }
.fb-cta .muted { margin: 0; }

/* Teste: dropdown-uri pe test */
.test-drop { border: 1px solid var(--line); border-radius: 10px; margin-top: 0.6rem; background: #fafcfe; }
.test-drop summary {
  cursor: pointer; padding: 0.65rem 0.9rem; font-weight: 600; color: var(--blue);
  list-style: none; display: flex; align-items: center; gap: 0.5rem;
}
.test-drop summary::-webkit-details-marker { display: none; }
.test-drop summary::before { content: "▸"; font-size: 0.8rem; display: inline-block; transition: transform 0.15s; }
.test-drop[open] summary::before { transform: rotate(90deg); }
.test-drop[open] { background: #fff; }
.test-drop-body { padding: 0.2rem 0.9rem 0.9rem; }
.test-drop-body .muted { margin-top: 0; }
.test-drop-static { padding: 0.65rem 0.9rem; color: var(--ink); font-size: 0.92rem; }

/* pagina /app/raport */
.topic-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.topic-head h3 { margin: 0; color: var(--blue); }
.qa-block { border-bottom: 1px solid var(--line); padding: 0.7rem 0; }
.qa-block:last-child { border-bottom: none; padding-bottom: 0; }
.qa-block .qa-q { margin: 0; font-size: 0.95rem; }
.qa-block .qa-ans { margin: 0.3rem 0 0.1rem; font-size: 0.88rem; }
.qa-block .qa-ans .bad { color: var(--danger); }
.qa-block .qa-ans .good { color: var(--ok); }
.qa-block .qa-src { margin: 0.15rem 0 0; font-size: 0.78rem; color: var(--muted); }

@media (max-width: 720px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .recent-row { grid-template-columns: 1fr; }
  .up-logo { height: 36px; }
}
