/*
 * Personalfragebogen – Gestaltung.
 *
 * Ausgangspunkt ist das Handy, nicht der Schreibtisch: Die Leute füllen das
 * im Stehen aus, oft mit einer Hand, manchmal mit Arbeitshandschuhen daneben.
 * Deshalb große Flächen, kräftige Kontraste und pro Bildschirm nur ein Thema.
 *
 * Schriftgröße bei Eingabefeldern mindestens 16px – darunter zoomt iOS beim
 * Antippen automatisch hinein, was das Formular verspringen lässt.
 */

:root {
    /* Neutrales Grau als Grundton – das Firmenlogo bringt die Farbe mit,
       ein farbiger Rahmen darum würde ihm nur Konkurrenz machen. */
    --marke: #454545;
    --marke-hell: #6b6b6b;
    --marke-blass: #f0f0f0;
    --text: #1a1a1a;
    --text-leise: #5f5f5f;
    --rand: #d8d8d8;
    --hintergrund: #ffffff;
    --flaeche: #f7f7f7;
    --fehler: #b3261e;
    --fehler-blass: #fdecea;
    --erfolg: #1b6b3a;      /* bleibt grün: Erfolg soll sich vom Grau abheben */
    --radius: 12px;
    --kopf-hoehe: 64px;
    --fuss-hoehe: 76px;
}

* { box-sizing: border-box; }

/*
 * Das HTML-Attribut hidden setzt display:none nur über eine Browser-Grundregel.
 * Jede eigene display-Angabe (etwa display:flex an der Fußzeile) sticht sie aus,
 * und das Element bleibt sichtbar. Deshalb hier ausdrücklich nachziehen.
 */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--hintergrund);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

/* ---------- Kopf ---------- */

.kopf {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--marke);
    color: #fff;
    padding-top: env(safe-area-inset-top);
}

.kopf-inhalt {
    min-height: var(--kopf-hoehe);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
}

/*
 * Logo als Vektordatei ohne Hintergrund. Die weiße Trennfläche im Original
 * (der Schwung des S) ist auf 'none' gesetzt, damit das Logo auf jedem
 * Untergrund sitzt – ohne weißen Kasten drumherum.
 */
.kopf-logo {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    object-fit: contain;
}

.kopf-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    margin-right: auto;
    min-width: 0;
}

.firma {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.kopf-untertitel {
    font-size: 13px;
    opacity: 0.8;
    font-weight: 400;
}

.sprachwechsel {
    background: rgba(255, 255, 255, 0.15);
    border: 0;
    color: #fff;
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 20px;
    cursor: pointer;
}

.fortschritt {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.fortschritt-balken {
    height: 100%;
    width: 0;
    background: #ffffff;
    transition: width 0.3s ease;
}

/* ---------- Inhalt ---------- */

.inhalt {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px calc(var(--fuss-hoehe) + 24px);
}

h1 {
    font-size: 26px;
    line-height: 1.25;
    margin: 0 0 8px;
    color: var(--marke);
}

h2 {
    font-size: 21px;
    margin: 0 0 4px;
    color: var(--marke);
}

.schritt-zaehler {
    font-size: 14px;
    color: var(--text-leise);
    margin: 0 0 20px;
}

.einleitung {
    color: var(--text-leise);
    margin: 0 0 24px;
}

/* ---------- Formularfelder ---------- */

.feld {
    margin-bottom: 22px;
}

.feld label,
.feld .beschriftung {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 16px;
}

.feld .optional-hinweis {
    font-weight: 400;
    color: var(--text-leise);
    font-size: 14px;
}

/* Pflichtfelder: roter Stern am Feldnamen, dazu eine Legende oben im Schritt */
.pflicht-stern {
    color: var(--fehler);
    font-weight: 700;
    margin-left: 1px;
}

.stern-legende {
    font-size: 14px;
    color: var(--text-leise);
    margin: -12px 0 20px;
}

.feld .hilfe {
    font-size: 14px;
    color: var(--text-leise);
    margin: 0 0 8px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    font-size: 17px;          /* nicht kleiner: sonst zoomt iOS */
    font-family: inherit;
    padding: 14px 14px;
    border: 2px solid var(--rand);
    border-radius: var(--radius);
    background: var(--hintergrund);
    color: var(--text);
    appearance: none;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--marke-hell);
    box-shadow: 0 0 0 3px var(--marke-blass);
}

/* Nummernfelder wie IBAN und Steuer-ID besser lesbar */
input.monospace {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: 0.04em;
}

.feld.hat-fehler input,
.feld.hat-fehler select {
    border-color: var(--fehler);
    background: var(--fehler-blass);
}

/* Auch Auswahlfelder müssen rot werden – dort gibt es kein input-Element */
.feld.hat-fehler .auswahl-option {
    border-color: var(--fehler);
}

.feld.hat-fehler label,
.feld.hat-fehler .beschriftung {
    color: var(--fehler);
}

.feld-fehler {
    display: none;
    color: var(--fehler);
    font-size: 14px;
    margin-top: 6px;
    font-weight: 500;
}

.feld.hat-fehler .feld-fehler { display: block; }

.feld.ist-gueltig input {
    border-color: var(--erfolg);
}

/* ---------- Auswahl als große Flächen ---------- */

.auswahl-liste {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/*
 * .auswahl-option ist ein Knopf, der einen Wert setzt.
 * .haken-zeile ist ein Ankreuzfeld. Sie sehen gleich aus, verhalten sich aber
 * unterschiedlich – deshalb zwei Klassen statt einer.
 */
.auswahl-option,
.haken-zeile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 2px solid var(--rand);
    border-radius: var(--radius);
    background: var(--hintergrund);
    cursor: pointer;
    font-size: 17px;
    text-align: left;
    width: 100%;
}

.auswahl-option:active,
.haken-zeile:active { background: var(--flaeche); }

.haken-zeile input[type="checkbox"] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    accent-color: var(--marke);
}

.auswahl-option.gewaehlt {
    border-color: var(--marke);
    background: var(--marke-blass);
    font-weight: 600;
}

.auswahl-option .haken {
    margin-left: auto;
    color: var(--marke);
    font-size: 20px;
    visibility: hidden;
}

.auswahl-option.gewaehlt .haken { visibility: visible; }

/* ---------- Kasten für Hinweise ---------- */

.hinweis {
    background: var(--flaeche);
    border-left: 4px solid var(--marke-hell);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 14px 16px;
    margin: 0 0 20px;
    font-size: 15px;
}

.hinweis-fehler {
    background: var(--fehler-blass);
    border-left: 4px solid var(--fehler);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 14px 16px;
    margin: 0 0 20px;
    font-size: 15px;
}

.hinweis ul { margin: 8px 0 0; padding-left: 20px; }
.hinweis li { margin-bottom: 6px; }

/* ---------- Sprachauswahl ---------- */

.sprach-liste {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.sprach-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    border: 2px solid var(--rand);
    border-radius: var(--radius);
    background: var(--hintergrund);
    font-size: 19px;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.sprach-option .flagge { font-size: 30px; line-height: 1; }

/* ---------- Fotos ---------- */

.foto-liste { display: flex; flex-direction: column; gap: 14px; }

.foto-feld {
    border: 2px dashed var(--rand);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.foto-feld.hat-bild {
    border-style: solid;
    border-color: var(--erfolg);
    text-align: left;
}

.foto-feld .foto-name { font-weight: 600; margin-bottom: 10px; display: block; }

.foto-vorschau {
    max-width: 100%;
    max-height: 180px;
    border-radius: 8px;
    display: block;
    margin: 10px auto 0;
}

.foto-feld input[type="file"] { display: none; }

/* ---------- Unterschrift ---------- */

.unterschrift-flaeche {
    border: 2px solid var(--rand);
    border-radius: var(--radius);
    background: var(--hintergrund);
    touch-action: none;   /* sonst scrollt die Seite beim Unterschreiben */
    width: 100%;
    height: 200px;
    display: block;
}

.unterschrift-linie {
    border-top: 1px solid var(--rand);
    margin: 0 20px;
    padding-top: 6px;
    font-size: 13px;
    color: var(--text-leise);
    text-align: center;
}

/* ---------- Prüfen-Ansicht ---------- */

.pruef-block {
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    margin-bottom: 14px;
    overflow: hidden;
}

.pruef-kopf {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--flaeche);
    padding: 12px 16px;
    font-weight: 600;
}

.pruef-aendern {
    background: none;
    border: 0;
    color: var(--marke-hell);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    padding: 4px 8px;
}

.pruef-zeile {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    border-top: 1px solid var(--rand);
    font-size: 15px;
}

.pruef-zeile .bezeichnung { color: var(--text-leise); flex-shrink: 0; }
.pruef-zeile .wert { text-align: right; font-weight: 500; word-break: break-word; }

/* ---------- Knöpfe ---------- */

.fuss {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 12px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--hintergrund);
    border-top: 1px solid var(--rand);
    z-index: 10;
}

.knopf {
    flex: 1;
    padding: 16px;
    font-size: 17px;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    min-height: 54px;
}

.knopf-weiter {
    background: var(--marke);
    color: #fff;
    flex: 2;
}

.knopf-weiter:disabled { background: var(--rand); color: var(--text-leise); cursor: default; }

.knopf-zurueck {
    background: var(--hintergrund);
    color: var(--marke);
    border-color: var(--rand);
}

.knopf-gross {
    display: block;
    width: 100%;
    padding: 18px;
    font-size: 19px;
    background: var(--marke);
    color: #fff;
    border: 0;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    margin-top: 24px;
}

.knopf-leise {
    background: none;
    border: 0;
    color: var(--marke-hell);
    font-size: 15px;
    font-weight: 600;
    padding: 8px 0;
    cursor: pointer;
    text-decoration: underline;
}

/* ---------- Abschluss ---------- */

.fertig-zeichen {
    font-size: 64px;
    text-align: center;
    margin: 40px 0 16px;
}

.zwischenspeicher-hinweis {
    font-size: 13px;
    color: var(--text-leise);
    text-align: center;
    margin-top: 28px;
}

/* ---------- Größere Bildschirme ---------- */

@media (min-width: 700px) {
    body { background: var(--flaeche); }
    .inhalt {
        background: var(--hintergrund);
        margin-top: 24px;
        margin-bottom: 24px;
        border-radius: 16px;
        padding: 32px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    }
    .fuss {
        position: static;
        max-width: 640px;
        margin: 0 auto 40px;
        border: 0;
        background: none;
    }
}

/* Nutzer mit eingestellter Bewegungsreduzierung nicht mit Animationen behelligen */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
