/* =========================================================
   Förderverein der Leopoldschule – Formular
   Mobil zuerst, passt sich Tablet/Desktop an, Hell-/Dunkelmodus,
   Rechts-nach-links-Sprachen (Arabisch) über logische Eigenschaften.
   ========================================================= */

:root {
    --farbe: #1f5fa8;
    --farbe-dunkel: #174a84;
    --farbe-hell: #e8f0fa;
    --fehler: #b3261e;
    --fehler-hg: #fdf3f2;
    --erfolg: #2e7d32;
    --erfolg-hg: #e3f1e6;
    --text: #1d2430;
    --grau: #5b6472;
    --rand: #c4ccd8;
    --flaeche: #ffffff;
    --flaeche-2: #f5f7fb;
    --hintergrund: #eef2f7;
    --radius: 12px;
    --abstand: clamp(1rem, 4vw, 2rem);
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --farbe: #7fb0f0;
        --farbe-dunkel: #a6c8f5;
        --farbe-hell: #1c2a3d;
        --fehler: #ff8a80;
        --fehler-hg: #3a1f1f;
        --erfolg: #81c784;
        --erfolg-hg: #1e3323;
        --text: #e6eaf0;
        --grau: #a4adbb;
        --rand: #3b4554;
        --flaeche: #1a2029;
        --flaeche-2: #212834;
        --hintergrund: #11151b;
    }
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    margin: 0;
    padding: max(.75rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right))
             max(1.5rem, env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
    font-size: 1rem;           /* 16 px – verhindert Auto-Zoom auf iPhones */
    line-height: 1.55;
    color: var(--text);
    background: var(--hintergrund);
    overflow-wrap: anywhere;
}

/* ---------- Kopfleiste mit Sprachauswahl (oben rechts, bei Arabisch oben links) ---------- */
.kopfleiste {
    max-width: 760px;
    margin: 0 auto .75rem;
    display: flex;
    justify-content: flex-end;
}

.sprachwahl {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: var(--flaeche);
    border: 1px solid var(--rand);
    border-radius: 999px;
    padding: .15rem .35rem .15rem .75rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}
[dir="rtl"] .sprachwahl { padding: .15rem .75rem .15rem .35rem; }
.sprachwahl label { display: flex; align-items: center; cursor: pointer; }
.sprachwahl-icon { font-size: 1.1rem; line-height: 1; }
.sprachwahl select {
    font: inherit;
    font-size: .95rem;
    color: var(--text);
    background: transparent;
    border: 0;
    min-height: 40px;
    padding-inline: .25rem 1.5rem;
    cursor: pointer;
}
.sprachwahl select:focus-visible { outline: 2px solid var(--farbe); outline-offset: 2px; border-radius: 6px; }

.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- Karte ---------- */
.karte {
    max-width: 760px;
    margin: 0 auto;
    background: var(--flaeche);
    border-radius: var(--radius);
    padding: var(--abstand);
    box-shadow: 0 2px 16px rgba(0, 0, 0, .06);
}

h1 {
    margin: 0 0 .75rem;
    font-size: clamp(1.4rem, 1.1rem + 1.6vw, 1.9rem);
    line-height: 1.25;
    color: var(--farbe-dunkel);
}

.einleitung { color: var(--grau); margin: 0 0 1.5rem; font-size: clamp(1rem, .95rem + .3vw, 1.1rem); }

/* ---------- Abschnitte ---------- */
fieldset {
    border: 1px solid var(--rand);
    border-radius: 10px;
    padding: clamp(.9rem, 3vw, 1.35rem);
    padding-block-end: .5rem;
    margin: 0 0 1.5rem;
    min-width: 0;
}

legend {
    font-weight: 650;
    font-size: 1.1rem;
    padding-inline: .5rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.nr {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: var(--farbe);
    color: var(--flaeche);
    font-size: .9rem;
}

/* Zwei Spalten ab Tablet-Breite, sonst eine */
.zeile { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 600px) { .zeile { grid-template-columns: 1fr 1fr; } }

/* ---------- Felder ---------- */
.feld { margin-bottom: .35rem; }
.feld label { display: block; font-weight: 550; margin-bottom: .3rem; }

.feld input[type="text"],
.feld input[type="email"],
.feld input[type="tel"] {
    width: 100%;
    min-height: 48px;                 /* gut tippbar */
    padding: .65rem .8rem;
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    border: 1px solid var(--rand);
    border-radius: 8px;
    background: var(--flaeche);
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
}
.feld input::placeholder { color: var(--grau); opacity: .7; }
.feld input:focus { outline: none; border-color: var(--farbe); box-shadow: 0 0 0 3px var(--farbe-hell); }

/* LTR-Felder (IBAN, E-Mail, Telefon) bei Arabisch rechtsbündig ausrichten */
[dir="rtl"] .feld input[dir="ltr"] { text-align: right; }
.ltr { direction: ltr; unicode-bidi: isolate; }

.hat-fehler input[type="text"],
.hat-fehler input[type="email"],
.hat-fehler input[type="tel"] { border-color: var(--fehler); background: var(--fehler-hg); }

.fehlertext { color: var(--fehler); font-size: .875rem; min-height: 1.25em; margin: .25rem 0 0; }

.pflicht { color: var(--fehler); }
.optional { color: var(--grau); font-weight: 400; font-size: .9rem; }

/* ---------- Checkboxen ---------- */
.check label { font-weight: 400; display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; }
.check input {
    margin: .2rem 0 0;
    width: 1.35rem;
    height: 1.35rem;
    flex-shrink: 0;
    accent-color: var(--farbe);
    cursor: pointer;
}
.check.hat-fehler label { color: var(--fehler); }

/* ---------- SEPA-Mandat & Datenschutz ---------- */
.mandat { display: grid; grid-template-columns: 1fr; gap: .1rem 1rem; margin: 0 0 1rem; font-size: .95rem; }
.mandat dt { font-weight: 650; }
.mandat dd { margin: 0 0 .55rem; }
@media (min-width: 600px) {
    .mandat { grid-template-columns: max-content 1fr; gap: .4rem 1rem; }
    .mandat dd { margin: 0; }
}

.kleingedruckt {
    font-size: .9rem;
    color: var(--grau);
    background: var(--flaeche-2);
    border-radius: 8px;
    padding: .8rem 1rem;
    margin: 0 0 1rem;
}
.kleingedruckt p { margin: 0 0 .5rem; }
.kleingedruckt p:last-child { margin-bottom: 0; }
.kleingedruckt a, .check a { color: var(--farbe); }

.original { margin-top: .6rem; border-top: 1px solid var(--rand); padding-top: .6rem; text-align: start; }
.original summary { cursor: pointer; font-weight: 600; }
.original p { margin-top: .5rem; }

.legende { color: var(--grau); font-size: .875rem; }

/* ---------- Buttons ---------- */
button, .knopf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    background: var(--farbe);
    color: var(--flaeche);
    border: 0;
    border-radius: 8px;
    padding: .8rem 1.75rem;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s;
}
button:hover, .knopf:hover { background: var(--farbe-dunkel); }
button:focus-visible, .knopf:focus-visible { outline: 3px solid var(--farbe-hell); outline-offset: 2px; }
button:disabled { opacity: .6; cursor: wait; }
button.klein { min-height: 36px; padding: .3rem .8rem; font-size: .875rem; }

/* Auf dem Handy: Absenden über die volle Breite */
@media (max-width: 599px) {
    .absenden { width: 100%; }
}

/* ---------- Hinweise ---------- */
.hinweis { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1.25rem; }
.hinweis.fehler { background: var(--fehler-hg); color: var(--fehler); border: 1px solid var(--fehler); }

/* Spam-Falle unsichtbar */
.honig { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- Dankeseite ---------- */
.danke { text-align: center; }
.haken {
    width: 72px; height: 72px; margin: .5rem auto 1rem;
    border-radius: 50%; background: var(--erfolg-hg); color: var(--erfolg);
    display: grid; place-items: center; font-size: 2.2rem; font-weight: 700;
}
.referenz { background: var(--flaeche-2); border-radius: 8px; padding: .75rem 1rem; display: inline-block; }

/* ---------- Fußzeile ---------- */
.fuss { text-align: center; margin: 1.25rem 0 0; font-size: .9rem; color: var(--grau); }
.fuss a { color: var(--grau); display: inline-block; padding: .5rem; }

/* ---------- Große Bildschirme ---------- */
@media (min-width: 1200px) {
    body { padding-top: 2.5rem; }
}

/* ---------- Weniger Bewegung ---------- */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Druck ---------- */
@media print {
    body { background: #fff; color: #000; padding: 0; }
    .kopfleiste, .absenden, .fuss, .knopf { display: none; }
    .karte { box-shadow: none; padding: 0; max-width: none; }
}

/* Nicht veränderbares Feld (Beginn der Mitgliedschaft) */
.feld input.fest {
    background: var(--flaeche-2);
    color: var(--grau);
    border-style: dashed;
    cursor: not-allowed;
}
.feld input.fest:focus { box-shadow: none; border-color: var(--rand); }

/* Hinweis unter einem Feld (z. B. Bank automatisch ermittelt) */
.feldhinweis { color: var(--erfolg); font-size: .85rem; margin: -.1rem 0 .75rem; }
.feldhinweis::before { content: "✓ "; }
