/* ==========================================================
   GLAESS Schulungen – Stylesheet
   Designsprache abgestimmt auf KI-Kompass (GLAESS):
   heller Hintergrund, dunkler Header/Sidebar (#111827),
   blauer Akzent (#2563eb), seriös-professionell.
   ========================================================== */

:root {
    --primary:      #2563eb;   /* Akzent (Buttons, Links, Aktiv) */
    --primary-dark: #1d4ed8;
    --dark:         #111827;   /* Sidebar / öffentlicher Header */
    --bg:           #f9fafb;
    --surface:      #ffffff;
    --border:       #e5e7eb;
    --text:         #1a1a1a;
    --muted:        #6b7280;
    --danger:       #dc2626;
    --danger-dark:  #b91c1c;
    --warn:         #d97706;
    --ok:           #059669;
    --radius:       6px;
    --shadow:       0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .06);
    --shadow-lg:    0 10px 25px rgba(0, 0, 0, .1);
    --font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.6;
}

h1, h2, h3 { color: var(--text); margin: 0 0 .5em; line-height: 1.3; font-weight: 700; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 13px; }

/* ---------- Auth-Seiten ---------- */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 32px;
}
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-brand h1 { margin: 0; font-size: 24px; color: var(--primary); }
.auth-brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.auth-title { font-size: 18px; text-align: center; }
.auth-hint { color: var(--muted); font-size: 14px; }
.auth-links { text-align: center; margin-top: 16px; font-size: 14px; }

/* ---------- Formulare ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.field > span { font-weight: 600; color: var(--text); }
input, select, textarea {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    font-size: .95rem;
    background: #fff;
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    line-height: 1.4;
    transition: all .15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-sm { padding: 6px 14px; font-size: .85rem; }
.inline { display: inline; }

/* ---------- Meldungen ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid transparent;
}
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: var(--primary-dark); }
.alert-error { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: var(--ok); }

/* ---------- Admin-Layout ---------- */
.admin-body { display: flex; min-height: 100vh; }
.sidebar {
    width: 230px;
    background: var(--dark);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.sidebar-brand {
    padding: 20px;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.sidebar-nav { display: flex; flex-direction: column; padding: 8px 0; }
.sidebar-nav a {
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
    padding: 11px 20px;
    font-size: 14px;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav a.active { background: rgba(37, 99, 235, .18); color: #fff; border-left-color: var(--primary); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
}
.topbar-title { margin: 0; font-size: 18px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.admin-name { color: var(--muted); font-size: 14px; }
.nav-burger { display: none; font-size: 22px; cursor: pointer; }
.content { padding: 24px; }

/* ---------- Karten / Kennzahlen ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
}
.card-value { font-size: 30px; font-weight: 700; color: var(--primary); }
.card-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.card-ok .card-value { color: var(--ok); }
.card-warn .card-value { color: var(--warn); }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
}

/* ---------- Tabellen / Badges ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.table tbody tr:hover { background: var(--bg); }
.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: #ecfdf5; color: var(--ok); }
.badge-warn { background: #fffbeb; color: var(--warn); }
.badge-muted { background: #f3f4f6; color: var(--muted); }

/* ---------- Toolbar / Suche / Tabellenaktionen ---------- */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.search { display: flex; gap: 8px; flex-wrap: wrap; }
.search input, .search select { width: auto; }
.col-actions { white-space: nowrap; text-align: right; }
.col-actions .inline { margin-left: 4px; }
.table td { vertical-align: top; }

/* ---------- Formulare (Raster) ---------- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; padding-top: 8px; }
.field.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.field.checkbox input { width: auto; }
.error-list { margin: 6px 0 0; padding-left: 18px; }
.form-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-inline select { width: auto; min-width: 280px; }

/* ---------- Detailseite ---------- */
.detail-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.detail-head h3 { margin-bottom: 4px; }
.detail-actions { display: flex; gap: 8px; flex-shrink: 0; }
.panel + .panel { margin-top: 20px; }
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.panel-head h3 { margin: 0; }

/* ---------- Öffentlicher Teilnehmerbereich ---------- */
.public-body { background: var(--bg); }
.public-header {
    background: var(--dark);
    color: #fff;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.public-brand { font-size: 20px; font-weight: 700; }
.public-betreiber { font-size: 13px; color: rgba(255, 255, 255, .8); }
.public-main { max-width: 720px; margin: 32px auto; padding: 0 16px; }
.public-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 32px;
}
.info-block { margin: 20px 0; padding: 16px 20px; background: var(--bg); border-radius: var(--radius); }
.info-list { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; margin: 12px 0 0; }
.info-list dt { font-weight: 600; color: var(--muted); }
.info-list dd { margin: 0; }
.info-note { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.public-card.auth-narrow { max-width: 420px; margin: 0 auto; }

/* ---------- Fragenpool-Optionen (Admin) ---------- */
.options { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.options legend { font-weight: 600; padding: 0 6px; }
.option-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.option-row input[type=checkbox] { width: auto; flex-shrink: 0; }
.option-row input[type=text] { flex: 1; }

/* ---------- Prüfung (Teilnehmer) ---------- */
.exam-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.exam-timer {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: var(--primary);
    color: #fff;
    padding: 6px 14px;
    border-radius: var(--radius);
}
.exam-timer-warn { background: var(--danger); }
.exam-form { margin-top: 16px; }
.exam-question {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 0 0 16px;
}
.exam-question legend { font-weight: 600; padding: 0 6px; }
.qnum { color: var(--primary); }
.exam-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 6px;
    border-radius: var(--radius);
    cursor: pointer;
}
.exam-option:hover { background: var(--bg); }
.exam-option input { width: auto; margin-top: 3px; flex-shrink: 0; }

/* ---------- Ergebnis ---------- */
.result-box { text-align: center; padding: 28px; border-radius: var(--radius); margin: 20px 0; }
.result-ok { background: #f0fdf4; border: 1px solid #bbf7d0; }
.result-fail { background: #fffbeb; border: 1px solid #fcd34d; }
.result-score { font-size: 40px; font-weight: 700; color: var(--primary); }
.result-status { font-size: 20px; font-weight: 600; margin-top: 4px; }
.result-ok .result-status { color: var(--ok); }
.result-fail .result-status { color: var(--warn); }
.result-hint { margin-top: 8px; font-size: 13px; }

/* ---------- Export, Einstellungen, Paginierung ---------- */
.table-scroll { overflow-x: auto; }
.pagination { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.settings-preview { max-height: 60px; margin-top: 8px; border: 1px solid var(--border); border-radius: 4px; background: #fff; padding: 4px; }
textarea.mono { font-family: "Consolas", "DejaVu Sans Mono", monospace; font-size: 13px; }
input[type=color] { padding: 2px; height: 40px; }

/* ---------- Responsive ---------- */
.nav-toggle:checked ~ .sidebar { display: flex; }
@media (max-width: 860px) {
    .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: none; }
    .nav-toggle:checked ~ .sidebar { display: flex; }
    .nav-burger { display: inline; }
}
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .info-list { grid-template-columns: 1fr; }
    .info-list dt { margin-top: 8px; }
}
