/* ===========================================================
   Sociogram — stijlblad
   Ontwerp: rustige, professionele "rapport / schoolbord" sfeer.
   Achtergrond: zacht ruitjespapier. Kaarten: index-kaart stijl
   met een navy accentbalk boven — het signature-element.
   =========================================================== */

:root {
    --navy: #16324f;
    --navy-dark: #0d2136;
    --paper: #eef1f4;
    --card: #ffffff;
    --ink: #22303f;
    --muted: #5b6b7a;
    --line: #d7dee5;
    --positive: #2f7d5c;
    --positive-bg: #e6f3ec;
    --negative: #a1403c;
    --negative-bg: #f6e8e7;
    --amber: #c98a2c;
    --radius: 10px;
    --shadow: 0 10px 30px rgba(13, 33, 54, 0.12), 0 2px 6px rgba(13, 33, 54, 0.08);
    --font-display: Georgia, "Palatino Linotype", "Times New Roman", serif;
    --font-body: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--paper);
    background-image:
        linear-gradient(rgba(22,50,79,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22,50,79,0.05) 1px, transparent 1px);
    background-size: 28px 28px;
    font-family: var(--font-body);
    color: var(--ink);
    min-height: 100vh;
}

/* ---------- Modal shell ---------- */
.modal-backdrop {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 16px;
}

.modal-box {
    width: 100%;
    max-width: var(--modal-w, 560px);
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border-top: 6px solid var(--navy);
    animation: modal-in .18s ease-out;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(6px) scale(.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-box--wide { --modal-w: 980px; }

.modal-box__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px 14px 28px;
    border-bottom: 1px solid var(--line);
}

.modal-box__header h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin: 0;
    color: var(--navy-dark);
    font-weight: normal;
    letter-spacing: .2px;
}

.modal-close {
    color: var(--muted);
    text-decoration: none;
    font-size: 1.6rem;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
}
.modal-close:hover { background: var(--paper); color: var(--ink); }

.modal-box__body {
    padding: 24px 28px 8px 28px;
}

.modal-box__footer {
    padding: 14px 28px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
    background: var(--paper);
}

/* ---------- Typography ---------- */
h2 { font-family: var(--font-display); font-weight: normal; color: var(--navy-dark); font-size: 1.15rem; }
h3 { font-family: var(--font-display); font-weight: normal; color: var(--navy-dark); font-size: 1.0rem; }
p { line-height: 1.5; }
label { font-weight: 600; font-size: 0.85rem; color: var(--muted); display: block; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: 0.82rem; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
input[type=text], input[type=password], input[type=number], textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 0.95rem;
    font-family: var(--font-body);
    background: #fff;
    color: var(--ink);
}
input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--navy);
    outline-offset: 1px;
    border-color: var(--navy);
}
textarea { min-height: 140px; font-family: "Courier New", monospace; }

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 7px;
    border: 1px solid var(--navy);
    background: var(--navy);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--navy-dark); }
.btn--ghost { background: transparent; color: var(--navy); }
.btn--ghost:hover { background: var(--paper); }
.btn--danger { background: var(--negative); border-color: var(--negative); }
.btn--danger:hover { background: #832f2c; }
.btn--sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ---------- Flash messages ---------- */
.flash { padding: 10px 14px; border-radius: 7px; margin-bottom: 16px; font-size: 0.88rem; }
.flash--error { background: var(--negative-bg); color: var(--negative); border: 1px solid var(--negative); }
.flash--success { background: var(--positive-bg); color: var(--positive); border: 1px solid var(--positive); }
.flash--info { background: #eaf1fb; color: var(--navy-dark); border: 1px solid var(--navy); }

/* ---------- Menu / dashboard tiles ---------- */
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
@media (max-width: 520px) { .menu-grid { grid-template-columns: 1fr; } }
.tile {
    display: block;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--ink);
    background: var(--paper);
}
.tile:hover { border-color: var(--navy); background: #fff; }
.tile strong { display: block; font-family: var(--font-display); color: var(--navy-dark); font-size: 1.05rem; margin-bottom: 4px; }
.tile span { color: var(--muted); font-size: 0.85rem; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; margin: 12px 0 20px 0; font-size: 0.9rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: var(--paper); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.pill--positive { background: var(--positive-bg); color: var(--positive); }
.pill--negative { background: var(--negative-bg); color: var(--negative); }

/* ---------- Student picker (survey) ---------- */
.question-block {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 20px;
    background: #fff;
}
.question-block h3 { margin-top: 0; }
.picker-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .picker-columns { grid-template-columns: 1fr; } }
.picker-col h4 { margin: 0 0 8px 0; font-size: 0.85rem; text-transform: uppercase; letter-spacing: .03em; }
.picker-col--positive h4 { color: var(--positive); }
.picker-col--negative h4 { color: var(--negative); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 34px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.82rem; }
.chip--positive { background: var(--positive-bg); color: var(--positive); }
.chip--negative { background: var(--negative-bg); color: var(--negative); }
.chip button { border: none; background: none; cursor: pointer; color: inherit; font-weight: bold; padding: 0; }
.pool-select { width: 100%; }
.student-list { max-height: 160px; overflow-y: auto; border: 1px solid var(--line); border-radius: 7px; }
.student-list label { font-weight: normal; color: var(--ink); display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin: 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.student-list label:last-child { border-bottom: none; }
.student-list label:hover { background: var(--paper); }

.progress-list { list-style: none; padding: 0; margin: 0; }
.progress-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.progress-list li:last-child { border-bottom: none; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.status-dot--done { background: var(--positive); }
.status-dot--todo { background: var(--line); border: 1px solid var(--muted); }

/* ---------- Print ---------- */
@media print {
    body { background: #fff; }
    .no-print { display: none !important; }
    .modal-backdrop { padding: 0; }
    .modal-box { box-shadow: none; border-top: none; max-width: 100%; }
    .modal-box__footer { border-top: 1px solid #000; }
}

/* ---------- Sociogram canvas ---------- */
#sociogramCanvas { width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.legend { display: flex; gap: 18px; font-size: 0.85rem; margin-top: 8px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 3px; display: inline-block; border-radius: 2px; }
.legend i.pos { background: var(--positive); }
.legend i.neg { background: var(--negative); }

/* ---------- Toggle switch ---------- */
.toggle-form { display: inline-flex; flex-shrink: 0; }
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px; height: 24px;
    background: var(--line);
    border-radius: 999px;
    border: none;
    cursor: pointer;
    transition: background .2s;
    padding: 0;
}
.toggle-switch--on { background: var(--positive); }
.toggle-switch__knob {
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.toggle-switch--on .toggle-switch__knob { transform: translateX(20px); }

/* ---------- Question card ---------- */
.question-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
    background: #fff;
    transition: opacity .2s;
}
.question-card--off { opacity: .5; background: var(--paper); }
.question-card__top {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.question-card__text { flex: 1; min-width: 0; font-size: 0.92rem; line-height: 1.45; }
.question-card__pos { color: var(--positive); font-weight: 600; }
.question-card__neg { color: var(--negative); font-weight: 600; }
.question-card__sep { color: var(--muted); margin: 0 4px; }
.question-edit-form { flex: 1; min-width: 0; }
.question-edit-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Responsive — klein scherm ---------- */
@media (max-width: 600px) {
    .modal-backdrop { padding: 12px 0 0 0; }
    .modal-box {
        border-radius: var(--radius) var(--radius) 0 0;
        max-width: 100%;
    }
    .modal-box__header { padding: 16px 16px 10px 16px; }
    .modal-box__header h1 { font-size: 1.2rem; }
    .modal-box__body { padding: 14px 16px 6px 16px; }
    .modal-box__footer { padding: 10px 16px; }

    h2 { font-size: 1.05rem; }

    .btn { padding: 10px 14px; font-size: 0.88rem; }
    .btn--sm { padding: 8px 12px; }
    .btn-row { gap: 8px; }

    .menu-grid { grid-template-columns: 1fr; gap: 10px; }
    .tile { padding: 14px; }

    table { font-size: 0.82rem; }
    th, td { padding: 7px 6px; }

    .question-card { padding: 12px; }
    .question-card__top { gap: 8px; }
    .question-card__text { font-size: 0.85rem; }
    .question-edit-fields { grid-template-columns: 1fr; }

    .picker-columns { grid-template-columns: 1fr; gap: 14px; }
    .question-block { padding: 12px; }

    .progress-list li { flex-wrap: wrap; gap: 6px; }
}

/* ---------- Responsive — tabel scrollbaar op smalle schermen ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 12px -16px 20px -16px; padding: 0 16px; }
@media (min-width: 601px) { .table-wrap { margin: 12px 0 20px 0; padding: 0; } }
.table-wrap table { margin: 0; min-width: 480px; }

/* ---------- Responsive — medium scherm ---------- */
@media (min-width: 601px) and (max-width: 900px) {
    .modal-backdrop { padding: 24px 12px; }
}

/* ---------- Overlay modals (confirm + help) ---------- */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(13, 33, 54, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    animation: overlay-in .15s ease-out;
}
@keyframes overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.overlay__box {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-top: 6px solid var(--navy);
    width: 100%;
    max-width: 460px;
    animation: modal-in .18s ease-out;
    overflow: hidden;
}
.overlay__box--help {
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}
.overlay__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 12px 24px;
    border-bottom: 1px solid var(--line);
}
.overlay__header h2 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: normal;
    color: var(--navy-dark);
    font-size: 1.25rem;
}
.overlay__body {
    padding: 20px 24px;
}
.overlay__body--scroll {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}
.overlay__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px;
    border-top: 1px solid var(--line);
    background: var(--paper);
}

/* ---------- Help-knop in de header ---------- */
.help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1.5px solid var(--line);
    background: var(--paper);
    color: var(--navy);
    font-weight: 700;
    font-size: 0.92rem;
    font-family: var(--font-display);
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    transition: border-color .15s, background .15s;
    line-height: 1;
}
.help-btn:hover { border-color: var(--navy); background: #fff; }

/* ---------- Help-inhoud stijlen ---------- */
.help-content h3 {
    font-size: 1.05rem;
    margin: 20px 0 8px 0;
    color: var(--navy-dark);
}
.help-content h3:first-child { margin-top: 0; }
.help-content p { font-size: 0.9rem; line-height: 1.55; margin: 6px 0; }
.help-content ul, .help-content dl { font-size: 0.9rem; line-height: 1.55; }
.help-content dt { font-weight: 600; margin-top: 8px; }
.help-content dd { margin: 2px 0 0 0; }
.help-content pre {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.85rem;
    overflow-x: auto;
}
.help-content hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 20px 0;
}
@media (max-width: 600px) {
    .overlay { padding: 12px 8px; }
    .overlay__box { max-width: 100%; }
    .overlay__box--help { max-height: 92vh; }
    .overlay__header { padding: 14px 16px 10px 16px; }
    .overlay__body { padding: 14px 16px; }
    .overlay__footer { padding: 12px 16px; }
}
