/* JSJ Strom-Atlas – Stylesheet
   Erdtöne: Beige, Sand, gedämpftes Grün
   Mobile-first, responsive */

/* === Variablen === */
:root {
    --farbe-erde:       #5C4033;
    --farbe-sand:       #C9B99A;
    --farbe-sand-hell:  #E8DCC8;
    --farbe-beige:      #F5F0E8;
    --farbe-beige-hell: #FAF8F4;
    --farbe-gruen:      #6B7F5E;
    --farbe-gruen-hell: #8FA67E;
    --farbe-gruen-bg:   #EFF3EC;
    --farbe-text:       #3A3028;
    --farbe-text-leicht:#6B5E50;
    --farbe-weiss:      #FFFFFF;
    --farbe-fehler:     #A0522D;
    --farbe-erfolg:     #6B7F5E;
    --farbe-info:       #5C7A99;
    --farbe-markierung: #F0E68C;
    --schatten:         0 2px 8px rgba(60, 48, 36, 0.08);
    --radius:           6px;
    --max-breite:       960px;
    --schrift:          'Georgia', 'Times New Roman', serif;
    --schrift-ui:       -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* === Basis === */
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--schrift);
    color: var(--farbe-text);
    background: var(--farbe-beige-hell);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--farbe-gruen); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--farbe-erde); }

h1, h2, h3, h4 {
    font-family: var(--schrift);
    color: var(--farbe-erde);
    line-height: 1.3;
    margin-bottom: 0.5em;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

p { margin-bottom: 1em; }

/* === Layout === */
.container {
    width: 100%;
    max-width: var(--max-breite);
    margin: 0 auto;
    padding: 0 1rem;
}

.site-main {
    flex: 1;
    padding: 2rem 0;
}

/* === Header === */
.site-header {
    background: var(--farbe-weiss);
    border-bottom: 2px solid var(--farbe-sand);
    box-shadow: var(--schatten);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--farbe-erde) !important;
    letter-spacing: 0.02em;
}

/* Navigation */
.main-nav { position: relative; }

.nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--farbe-erde);
    transition: transform 0.2s;
}

.nav-list {
    display: none;
    list-style: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--farbe-weiss);
    border: 1px solid var(--farbe-sand);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
    min-width: 160px;
    padding: 0.5rem 0;
    z-index: 101;
}
.nav-list.offen { display: block; }

.nav-list li a {
    display: block;
    padding: 0.5rem 1.25rem;
    color: var(--farbe-text);
    font-family: var(--schrift-ui);
    font-size: 0.9rem;
}
.nav-list li a:hover,
.nav-list li a.aktiv {
    background: var(--farbe-beige);
    color: var(--farbe-gruen);
}

/* === Footer === */
.site-footer {
    background: var(--farbe-weiss);
    border-top: 1px solid var(--farbe-sand);
    padding: 1rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--farbe-text-leicht);
    font-family: var(--schrift-ui);
}

/* === Flash-Nachrichten === */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-family: var(--schrift-ui);
    font-size: 0.9rem;
}
.flash-erfolg { background: var(--farbe-gruen-bg); color: var(--farbe-gruen); border: 1px solid var(--farbe-gruen-hell); }
.flash-fehler { background: #FDF2F0; color: var(--farbe-fehler); border: 1px solid #D4A08A; }
.flash-info   { background: #EDF2F7; color: var(--farbe-info); border: 1px solid #A0B4C8; }

/* === Formulare === */
.form-gruppe {
    margin-bottom: 1.25rem;
}

.form-gruppe label {
    display: block;
    margin-bottom: 0.3rem;
    font-family: var(--schrift-ui);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--farbe-erde);
}

.form-gruppe input[type="text"],
.form-gruppe input[type="email"],
.form-gruppe input[type="number"],
.form-gruppe select,
.form-gruppe textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--farbe-sand);
    border-radius: var(--radius);
    font-family: var(--schrift);
    font-size: 1rem;
    color: var(--farbe-text);
    background: var(--farbe-weiss);
    transition: border-color 0.2s;
}
.form-gruppe input:focus,
.form-gruppe select:focus,
.form-gruppe textarea:focus {
    outline: none;
    border-color: var(--farbe-gruen);
    box-shadow: 0 0 0 2px rgba(107, 127, 94, 0.15);
}

.form-gruppe textarea { min-height: 120px; resize: vertical; }

/* OTP-Eingabe */
.otp-eingabe {
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 0.5em;
    max-width: 200px;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-family: var(--schrift-ui);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-align: center;
}
.btn:active { transform: scale(0.98); }

.btn-primär {
    background: var(--farbe-gruen);
    color: var(--farbe-weiss);
}
.btn-primär:hover { background: var(--farbe-erde); color: var(--farbe-weiss); }

.btn-sekundär {
    background: var(--farbe-sand-hell);
    color: var(--farbe-erde);
}
.btn-sekundär:hover { background: var(--farbe-sand); }

.btn-gefahr {
    background: var(--farbe-fehler);
    color: var(--farbe-weiss);
}
.btn-gefahr:hover { background: #8B3A1A; color: var(--farbe-weiss); }

.btn-klein { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* === Karten === */
.karte {
    background: var(--farbe-weiss);
    border: 1px solid var(--farbe-sand);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--schatten);
    margin-bottom: 1rem;
}

.karte-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

/* === Login-Seite === */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-box {
    background: var(--farbe-weiss);
    border: 1px solid var(--farbe-sand);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--schatten);
    text-align: center;
}

.login-box h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-box p {
    color: var(--farbe-text-leicht);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* === Dashboard === */
.strom-gitter {
    display: grid;
    gap: 1rem;
}

.strom-karte {
    background: var(--farbe-weiss);
    border: 1px solid var(--farbe-sand);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--schatten);
    transition: border-color 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.strom-karte:hover {
    border-color: var(--farbe-gruen);
    box-shadow: 0 4px 12px rgba(60, 48, 36, 0.12);
    color: inherit;
}

.strom-karte h3 { margin-bottom: 0.25rem; }

.strom-meta {
    display: flex;
    gap: 0.75rem;
    font-family: var(--schrift-ui);
    font-size: 0.8rem;
    color: var(--farbe-text-leicht);
    margin-bottom: 0.5rem;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-family: var(--schrift-ui);
    font-weight: 600;
}
.badge-hauptstrom { background: var(--farbe-gruen-bg); color: var(--farbe-gruen); }
.badge-organstrom { background: #EDE8F0; color: #6B5B7B; }
.badge-sel        { background: #FFF3E0; color: #8B6914; }

.strom-karte .vorschau {
    font-size: 0.9rem;
    color: var(--farbe-text-leicht);
    line-height: 1.5;
}

/* === Suche === */
.such-leiste {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.such-leiste input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--farbe-sand);
    border-radius: var(--radius);
    font-family: var(--schrift);
    font-size: 1rem;
}
.such-leiste input:focus { outline: none; border-color: var(--farbe-gruen); }

.filter-leiste {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-family: var(--schrift-ui);
    font-size: 0.9rem;
}
.filter-leiste select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--farbe-sand);
    border-radius: var(--radius);
    background: var(--farbe-weiss);
    font-size: 0.9rem;
}

mark {
    background: var(--farbe-markierung);
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

.keine-ergebnisse {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--farbe-text-leicht);
    font-style: italic;
}

/* === Strom-Detailseite === */
.strom-detail h1 {
    margin-bottom: 0.25rem;
}
.strom-detail .original-name {
    color: var(--farbe-text-leicht);
    font-style: italic;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.detail-abschnitt {
    margin-bottom: 1.5rem;
}
.detail-abschnitt h2 {
    font-size: 1.1rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--farbe-sand);
    margin-bottom: 0.75rem;
}

/* Grifffolge-Tabelle (Detailseite) */
.griff-tabelle {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--schrift-ui);
    font-size: 0.9rem;
}
.griff-tabelle th,
.griff-tabelle td {
    padding: 0.5rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--farbe-sand);
    vertical-align: top;
}
.griff-tabelle thead th {
    background: var(--farbe-beige);
    color: var(--farbe-erde);
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}
.griff-tabelle .griff-nr {
    text-align: center;
    font-weight: 600;
    color: var(--farbe-gruen);
    width: 40px;
}
.griff-tabelle .griff-kommentar {
    color: var(--farbe-text-leicht);
    font-style: italic;
    font-size: 0.85rem;
}
.griff-tabelle tr:hover td { background: var(--farbe-beige-hell); }

/* Seiten-Wahl Buttons */
.seiten-wahl {
    display: flex;
    gap: 0.3rem;
}

/* Schritt-Editor (Admin) */
.schritt-editor { overflow-x: auto; }

.schritt-tabelle input[type="text"] {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--farbe-sand);
    border-radius: var(--radius);
    font-family: var(--schrift-ui);
    font-size: 0.85rem;
    background: var(--farbe-weiss);
}
.schritt-tabelle input[type="text"]:focus {
    outline: none;
    border-color: var(--farbe-gruen);
}

.schritt-aktionen {
    display: flex;
    gap: 0.2rem;
    white-space: nowrap;
}

.btn-icon {
    background: none;
    border: 1px solid var(--farbe-sand);
    border-radius: 3px;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    font-size: 0.85rem;
    color: var(--farbe-text-leicht);
    transition: background 0.15s;
}
.btn-icon:hover { background: var(--farbe-beige); color: var(--farbe-erde); }
.btn-icon-gefahr:hover { background: #FDF2F0; color: var(--farbe-fehler); }

.schritt-nr-zelle {
    text-align: center;
    font-weight: 600;
    color: var(--farbe-gruen);
}

.symptom-liste {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
}
.symptom-liste li {
    background: var(--farbe-beige);
    border: 1px solid var(--farbe-sand);
    border-radius: 3px;
    padding: 0.2rem 0.6rem;
    font-family: var(--schrift-ui);
    font-size: 0.85rem;
}

.notizen-box {
    background: var(--farbe-beige);
    border-left: 3px solid var(--farbe-gruen);
    padding: 1rem 1.25rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--farbe-text-leicht);
}

/* === Admin === */
.admin-tabelle {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--schrift-ui);
    font-size: 0.9rem;
}
.admin-tabelle th,
.admin-tabelle td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--farbe-sand);
}
.admin-tabelle th {
    background: var(--farbe-beige);
    color: var(--farbe-erde);
    font-weight: 600;
}
.admin-tabelle tr:hover td { background: var(--farbe-beige-hell); }

.admin-aktionen {
    display: flex;
    gap: 0.4rem;
}

.seitenkopf {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* === Schnellsuche Dashboard === */
.schnellsuche {
    margin-bottom: 2rem;
}

/* === Kategorie-Gruppen === */
.kategorie-gruppe {
    margin-bottom: 2rem;
}
.kategorie-gruppe h2 {
    font-size: 1.2rem;
    color: var(--farbe-erde);
    padding-bottom: 0.3rem;
    border-bottom: 2px solid var(--farbe-sand);
    margin-bottom: 1rem;
}

/* === Responsive === */
@media (min-width: 600px) {
    .strom-gitter {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-toggle { display: none; }
    .nav-list {
        display: flex !important;
        position: static;
        background: none;
        border: none;
        box-shadow: none;
        padding: 0;
        gap: 0.25rem;
    }
    .nav-list li a {
        padding: 0.4rem 0.75rem;
        border-radius: var(--radius);
    }
}

@media (min-width: 900px) {
    .strom-gitter {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* === Bestätigungsdialog === */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.confirm-box {
    background: var(--farbe-weiss);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.confirm-box p { margin-bottom: 1.5rem; }
.confirm-box .btn { margin: 0 0.25rem; }

/* ==========================================
   Ström-Timer – Praxis-Modus
   ========================================== */

/* --- Auswahl-Phase --- */
.stroem-auswahl {
    max-width: 480px;
    margin: 0 auto;
}

/* --- Timer-Phase --- */
.stroem-timer {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background: #2C2820;
    color: var(--farbe-sand-hell);
    position: fixed;
    inset: 0;
    z-index: 300;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Kopfzeile */
.timer-kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    flex-shrink: 0;
}

.timer-kopf-btn {
    background: none;
    border: 1px solid rgba(201, 185, 154, 0.3);
    color: var(--farbe-sand);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-titel {
    text-align: center;
    flex: 1;
    padding: 0 0.5rem;
}

.timer-titel span:first-child {
    display: block;
    font-family: var(--schrift);
    font-size: 1rem;
    color: var(--farbe-sand-hell);
}

.timer-seite-badge {
    font-family: var(--schrift-ui);
    font-size: 0.75rem;
    background: rgba(107, 127, 94, 0.3);
    color: var(--farbe-gruen-hell);
    padding: 0.1rem 0.5rem;
    border-radius: 3px;
}

.timer-schritt-nr {
    font-family: var(--schrift-ui);
    font-size: 0.8rem;
    color: var(--farbe-sand);
    white-space: nowrap;
}

/* Fortschrittsbalken */
.timer-fortschritt {
    height: 3px;
    background: rgba(201, 185, 154, 0.15);
    flex-shrink: 0;
}

.timer-fortschritt-bar {
    height: 100%;
    background: var(--farbe-gruen-hell);
    transition: width 0.5s ease;
    width: 0%;
}

/* Handpositionen (zwei Hände) */
.timer-haende {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1rem;
    overflow-y: auto;
}

.timer-hand-karte {
    background: rgba(201, 185, 154, 0.08);
    border: 1px solid rgba(201, 185, 154, 0.15);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.timer-hand-label {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.timer-hand-text {
    font-family: var(--schrift);
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--farbe-beige);
}

/* (Grifffolge-Darstellung jetzt via .griff-tabelle) */

/* Countdown */
.timer-countdown {
    flex-shrink: 0;
    text-align: center;
    padding: 0.5rem 1rem 0.25rem;
}

.timer-kreis {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.timer-kreis svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-kreis-bg {
    fill: none;
    stroke: rgba(201, 185, 154, 0.12);
    stroke-width: 6;
}

.timer-kreis-fg {
    fill: none;
    stroke: var(--farbe-gruen-hell);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.timer-zeit {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--schrift-ui);
    font-size: 1.75rem;
    font-weight: 300;
    color: var(--farbe-sand-hell);
    letter-spacing: 0.05em;
}

.timer-gesamt {
    font-family: var(--schrift-ui);
    font-size: 0.8rem;
    color: var(--farbe-sand);
    margin-top: 0.4rem;
    opacity: 0.7;
}

/* Optischer Blitz bei Schrittwechsel */
.timer-blitz {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(201, 185, 154, 0.25) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.6s ease-out;
    pointer-events: none;
    z-index: 301;
}

/* Steuerung */
.timer-steuerung {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem 1rem 2rem;
    flex-shrink: 0;
}

.timer-nav-btn {
    background: none;
    border: 1px solid rgba(201, 185, 154, 0.25);
    color: var(--farbe-sand);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.timer-nav-btn:hover { background: rgba(201, 185, 154, 0.1); }
.timer-nav-btn:disabled { opacity: 0.25; cursor: default; }
.timer-nav-btn:disabled:hover { background: none; }

.timer-play-btn {
    background: var(--farbe-gruen);
    border: none;
    color: var(--farbe-weiss);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.timer-play-btn:hover { background: var(--farbe-erde); }
.timer-play-btn:active { transform: scale(0.95); }

/* --- Abschluss-Phase --- */
.stroem-abschluss {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
}

.abschluss-inhalt {
    text-align: center;
    max-width: 400px;
    padding: 2rem 1rem;
}

.abschluss-symbol {
    font-size: 3rem;
    color: var(--farbe-gruen);
    margin-bottom: 1rem;
    line-height: 1;
}

.abschluss-inhalt h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.abschluss-inhalt p {
    color: var(--farbe-text-leicht);
    font-size: 1rem;
}

/* --- Timer Responsive --- */
@media (min-width: 600px) {
    .timer-haende {
        max-width: 540px;
        margin: 0 auto;
        padding: 1.5rem 2rem;
    }

    .timer-hand-text {
        font-size: 1.25rem;
    }

    .timer-kreis {
        width: 140px;
        height: 140px;
    }

    .timer-zeit {
        font-size: 2rem;
    }
}

@media (min-height: 700px) {
    .timer-haende {
        gap: 1rem;
    }

    .timer-hand-karte {
        padding: 1.25rem 1.5rem;
    }

    .timer-countdown {
        padding: 1rem;
    }
}
