/* ============================================================
   Härenwies e.V. — Admin-Bereich
   ============================================================ */

:root {
    --gruen-dunkel: #1d4d24;
    --gruen: #2e7d32;
    --gruen-hell: #e8f2e6;
    --gelb: #f2a71b;
    --text: #26302a;
    --text-hell: #5b675e;
    --flaeche: #ffffff;
    --hintergrund: #f2f5f0;
    --rand: #dde5da;
    --rot: #c0392b;
    --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--hintergrund);
}

img { max-width: 100%; }
h1 { color: var(--gruen-dunkel); margin-bottom: 0.8rem; font-size: 1.7rem; }
h2 { color: var(--gruen-dunkel); margin-bottom: 0.6rem; font-size: 1.2rem; }
p { margin-bottom: 0.8rem; }
a { color: var(--gruen); }

/* ---------- Login ---------- */

.login-seite {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(140deg, var(--gruen-dunkel), var(--gruen));
    padding: 1rem;
}

.login-karte {
    background: var(--flaeche);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    padding: 2.2rem 2rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-wappen { height: 80px; margin: 0 auto 0.8rem; display: block; border-radius: 8px; }
.login-karte h1 { font-size: 1.4rem; }
.login-untertitel { color: var(--text-hell); font-size: 0.9rem; margin-bottom: 1.2rem; }
.login-karte label { display: block; text-align: left; font-weight: 600; margin-bottom: 1rem; font-size: 0.92rem; }
.login-karte input {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.7rem 0.8rem;
    font-size: 1rem;
    border: 1px solid var(--rand);
    border-radius: 8px;
}
.login-karte .knopf { width: 100%; }
.login-zurueck { margin-top: 1rem; font-size: 0.88rem; }

/* ---------- Layout ---------- */

.admin-layout { display: flex; min-height: 100vh; }

.admin-menue {
    width: 230px;
    flex-shrink: 0;
    background: var(--gruen-dunkel);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-marke {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 1.1rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.admin-marke img { height: 44px; border-radius: 6px; }
.admin-marke strong { line-height: 1.2; font-size: 0.98rem; }

.admin-menue nav { flex: 1; padding: 0.6rem 0; }

.admin-menue nav a {
    display: block;
    color: #cfe0ca;
    text-decoration: none;
    padding: 0.55rem 1.1rem;
    font-weight: 600;
    font-size: 0.95rem;
    border-left: 4px solid transparent;
}

.admin-menue nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.admin-menue nav a.aktiv { background: rgba(255,255,255,0.12); color: #fff; border-left-color: var(--gelb); }

.admin-menue-fuss { padding: 0.8rem 0; border-top: 1px solid rgba(255,255,255,0.15); }

.admin-angemeldet {
    display: block;
    padding: 0.3rem 1.1rem 0.5rem;
    font-size: 0.82rem;
    color: #9db898;
}
.admin-angemeldet strong { color: #fff; }
.admin-menue-fuss a { display: block; color: #cfe0ca; text-decoration: none; padding: 0.4rem 1.1rem; font-size: 0.9rem; }
.admin-menue-fuss a:hover { color: #fff; }

.admin-inhalt {
    flex: 1;
    padding: 1.8rem 2rem 3rem;
    max-width: 980px;
}

/* ---------- Karten & Zeilen ---------- */

.karte {
    background: var(--flaeche);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    padding: 1.3rem 1.4rem;
    margin-bottom: 1.4rem;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}

.karte-gefahr { border-color: #eab8b2; background: #fdf6f5; margin-top: 2rem; }

.zeile {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--flaeche);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.6rem;
}

.zeile-versteckt { background: #fbf8ef; border-color: #ecd9a8; }
.zeile-text { flex: 1; min-width: 0; }
.zeile-text small { color: var(--text-hell); }
.zeile-vorschau { color: var(--text-hell); font-size: 0.92rem; margin: 0.3rem 0 0; overflow-wrap: break-word; }
.zeile-aktionen { display: flex; gap: 0.4rem; flex-shrink: 0; flex-wrap: wrap; }

.zeile-bild img, .zeile-bild-leer {
    width: 60px;
    height: 74px;
    object-fit: cover;
    border-radius: 6px;
    background: var(--gruen-hell);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

/* ---------- Kacheln (Übersicht) ---------- */

.kachel-raster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1rem;
    margin: 1.2rem 0 2rem;
}

.kachel {
    background: var(--flaeche);
    border: 1px solid var(--rand);
    border-top: 4px solid var(--gruen);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}

.kachel:hover { box-shadow: 0 4px 14px rgba(29,77,36,0.15); }
.kachel-zahl { font-size: 2rem; font-weight: 800; color: var(--gruen-dunkel); line-height: 1.2; }
.kachel-warnung { border-top-color: var(--gelb); }
.kachel-warnung .kachel-zahl { color: #b07b0a; }

.hilfe-liste { list-style: none; }
.hilfe-liste li { padding: 0.45rem 0; border-bottom: 1px solid var(--rand); }
.hilfe-liste li:last-child { border-bottom: none; }

/* ---------- Formulare ---------- */

.formular label { display: block; font-weight: 600; margin-bottom: 1rem; font-size: 0.93rem; }

.formular input[type="text"], .formular input[type="email"], .formular input[type="password"],
.formular textarea, .formular select, .formular input[type="file"] {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.6rem 0.8rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--rand);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
}

.formular textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem; }

.formular input:focus, .formular textarea:focus, .formular select:focus {
    outline: 2px solid var(--gruen);
    border-color: var(--gruen);
}

.formular-zeile { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.formular-zeile label { flex: 1; margin-bottom: 0; min-width: 220px; }
.formular-zeile .knopf { margin-bottom: 2px; }

.feld-raster { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }

.feld-hinweis { font-weight: 400; color: var(--text-hell); font-size: 0.85rem; }

/* Datumsauswahl gut sichtbar machen */
.formular input[type="date"] { cursor: pointer; max-width: 16rem; }
.formular input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.8;
}

/* ---------- Kalender (Admin) ---------- */

.kalender { margin-bottom: 1rem; }

.kalender-kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.kalender-kopf strong { font-size: 1.15rem; color: var(--gruen-dunkel); }

.kalender-nav {
    background: var(--gruen-hell);
    border: none;
    color: var(--gruen-dunkel);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
}

.kalender-nav:hover { background: #d3e6cd; }

.kalender-wochentage, .kalender-tage {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.kalender-wochentage { margin-bottom: 4px; }

.kalender-wochentage span {
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-hell);
    padding: 0.2rem 0;
}

.kalender-tag {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    background: #f2f5f0;
    padding: 0.25rem 0.3rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.kalender-leer { background: transparent; }
.kalender-tag-zahl { font-size: 0.85rem; color: var(--text-hell); font-weight: 600; }
.kalender-tag.heute { outline: 2px solid var(--gelb); }
.kalender-tag.heute .kalender-tag-zahl { color: #b07b0a; font-weight: 800; }

.kalender-tag.hat-termine { background: var(--gruen); cursor: pointer; }
.kalender-tag.hat-termine .kalender-tag-zahl { color: #fff; }
.kalender-tag.hat-termine:hover { background: var(--gruen-dunkel); }

.kalender-tag-titel {
    font-size: 0.68rem;
    color: #fff;
    line-height: 1.15;
    margin-top: 2px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.kalender-tag-punkt { display: none; }

.kalender-monatsliste { margin-top: 1rem; }

.kalender-listeneintrag {
    background: #fff;
    border: 1px solid var(--rand);
    border-left: 4px solid var(--gruen);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.5rem;
}

.kalender-listeneintrag.markiert { border-left-color: var(--gelb); background: #fdf9ee; }
.kalender-listeneintrag.vergangen { opacity: 0.6; }
.kalender-listeneintrag-datum { display: block; font-size: 0.82rem; color: var(--gruen); font-weight: 700; }
.termin-zusatz { color: var(--text-hell); font-size: 0.9rem; }
.kalender-leer-text { color: var(--text-hell); text-align: center; padding: 0.5rem; }

.foto-vorschau {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.foto-vorschau img {
    width: 80px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--rand);
}

.foto-vorschau span { color: var(--text-hell); font-size: 0.9rem; }

.kontrollkaestchen { display: flex !important; align-items: center; gap: 0.5rem; font-weight: 600; }

/* Rechte-Auswahl */
.rechte-feld {
    border: 1px solid var(--rand);
    border-radius: 8px;
    padding: 0.8rem 1rem 0.4rem;
    margin-bottom: 1rem;
}

.rechte-feld legend { font-weight: 700; color: var(--gruen-dunkel); padding: 0 0.4rem; font-size: 0.95rem; }

.rechte-raster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.2rem 1rem;
}

.rechte-raster .kontrollkaestchen { margin-bottom: 0.5rem; font-weight: 500; }

.rechte-liste { margin-top: 0.4rem; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.rechte-liste .etikett { margin-left: 0; }

.admin-schalter {
    background: var(--gruen-hell);
    border: 1px solid var(--rand);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
}

/* Wenn „Administrator“ gesetzt ist, sind die Einzelrechte gegenstandslos */
.rechte-feld.ist-abgeblendet { opacity: 0.45; }

.karte-anfragen { border-left: 4px solid var(--gelb); background: #fffdf7; }
.kontrollkaestchen input { width: auto !important; margin: 0 !important; }

.knopf-zeile { display: flex; gap: 0.6rem; }

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

.knopf {
    display: inline-block;
    background: var(--gruen);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    padding: 0.6rem 1.3rem;
    border-radius: 8px;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
}

.knopf:hover { background: var(--gruen-dunkel); }
.knopf-klein { padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.knopf-rot { background: var(--rot); }
.knopf-rot:hover { background: #93291d; }
.knopf-grau { background: #7d877f; }
.knopf-grau:hover { background: #626b64; }

/* Zustand „Löschen bestätigen“ (nach dem ersten Klick) */
.knopf-bestaetigen {
    background: #b8300f !important;
    color: #fff !important;
    animation: bestaetigen-puls 0.8s ease-in-out infinite alternate;
}
.mini-knopf.knopf-bestaetigen { background: #b8300f !important; }
@keyframes bestaetigen-puls {
    from { box-shadow: 0 0 0 0 rgba(184, 48, 15, 0.5); }
    to   { box-shadow: 0 0 0 4px rgba(184, 48, 15, 0.15); }
}

/* ---------- Hinweise & Etiketten ---------- */

.hinweis { padding: 0.8rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 600; }
.hinweis-ok { background: #e3f4e1; color: #1d5c25; border: 1px solid #b5ddb2; }
.hinweis-fehler { background: #fdeaea; color: #8f1f1f; border: 1px solid #f0bcbc; }
.hinweis-warnung { background: #fdf3df; color: #7a5410; border: 1px solid #ecd9a8; }

.etikett {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    margin-left: 0.4rem;
}

.etikett-gruen { background: #e3f4e1; color: #1d5c25; }
.etikett-gelb { background: #fdf3df; color: #7a5410; }
.etikett-grau { background: #eceeeb; color: #5b675e; }
.etikett-admin { background: var(--gruen-dunkel); color: #fff; }
.etikett-rot { background: #fdeaea; color: var(--rot); }

/* ---------- Protokoll ---------- */

.protokoll-zeile { align-items: flex-start; }

.protokoll-zeit {
    flex-shrink: 0;
    min-width: 6.5rem;
    color: var(--text-hell);
    font-size: 0.88rem;
    line-height: 1.3;
}

.protokoll-loeschung { background: #fdf5f4; border-color: #eab8b2; }

/* Hinweis kurz vor der automatischen Abmeldung */
.abmelde-warnung {
    position: fixed;
    left: 50%;
    bottom: 1.2rem;
    transform: translateX(-50%);
    background: var(--gelb);
    color: #3c2c05;
    font-weight: 700;
    padding: 0.7rem 1.2rem;
    border-radius: 999px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.25);
    z-index: 2000;
    max-width: 92vw;
    text-align: center;
}

/* ---------- Galerie-Verwaltung ---------- */

.admin-alben {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.admin-album {
    position: relative;
    display: block;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--gruen-dunkel);
    text-decoration: none;
    box-shadow: 0 1px 5px rgba(0,0,0,0.1);
}

.admin-album img { width: 100%; height: 100%; object-fit: cover; }

.admin-album-leer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cfe0ca;
    font-size: 0.9rem;
}

.admin-album-titel {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 1.4rem 0.7rem 0.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: #fff;
    font-weight: 700;
    font-size: 0.92rem;
}

.admin-album-anzahl {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
}

.admin-bilder {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.8rem;
    margin-top: 1rem;
}

.admin-bild {
    border: 2px solid var(--rand);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.admin-bild.ist-cover { border-color: var(--gelb); }
.admin-bild img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }

.admin-bild-aktionen {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0.4rem;
    gap: 0.3rem;
}

.mini-knopf {
    background: var(--gruen-hell);
    border: none;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gruen-dunkel);
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

.mini-knopf:hover { background: #d3e6cd; }
.mini-knopf-rot { background: #fdeaea; color: var(--rot); }
.mini-knopf-rot:hover { background: #f6cfcf; }
.mini-knopf-passiv { background: var(--gelb); color: #3c2c05; cursor: default; }

/* ---------- Bilder-Upload ---------- */

.upload-steuerung {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
}

.datei-auswahl {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    background: var(--gruen-hell);
    color: var(--gruen-dunkel);
    border: 2px dashed var(--gruen);
    border-radius: 8px;
    padding: 0.6rem 1.1rem;
    font-weight: 700;
    cursor: pointer;
}

.datei-auswahl:hover { background: #d9ecd3; }
.datei-auswahl input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.upload-fortschritt { margin-top: 1.2rem; }

.upload-balken {
    height: 14px;
    background: var(--rand);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.6rem;
}

.upload-balken-fuellung {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--gruen), var(--gelb));
    border-radius: 999px;
    transition: width 0.25s ease;
}

.upload-status { font-weight: 700; color: var(--gruen-dunkel); margin-bottom: 0.6rem; }

.upload-liste { list-style: none; max-height: 260px; overflow-y: auto; }

.upload-zeile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--rand);
}

.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-zeile-status { white-space: nowrap; font-weight: 600; color: var(--text-hell); }

.upload-zeile.upload-laeuft { background: #fdf9ee; }
.upload-zeile.upload-ok .upload-zeile-status { color: #1d5c25; }
.upload-zeile.upload-fehler { background: #fdeaea; }
.upload-zeile.upload-fehler .upload-zeile-status { color: var(--rot); }

/* ---------- Mobil ---------- */

@media (max-width: 800px) {
    .admin-layout { flex-direction: column; }

    .admin-menue {
        width: 100%;
        height: auto;
        position: static;
    }

    .admin-menue nav {
        display: flex;
        flex-wrap: wrap;
        padding: 0.3rem;
    }

    .admin-menue nav a { border-left: none; border-radius: 6px; padding: 0.45rem 0.7rem; font-size: 0.88rem; }
    .admin-menue-fuss { display: flex; }

    .admin-inhalt { padding: 1.2rem 1rem 2.5rem; }

    .feld-raster { grid-template-columns: 1fr; }

    .zeile { flex-wrap: wrap; }
    .zeile-aktionen { width: 100%; justify-content: flex-end; }

    .kalender-tag { border-radius: 6px; padding: 0.15rem; }
    .kalender-tag-titel { display: none; }
    .kalender-tag.hat-termine { align-items: center; }
    .kalender-tag-punkt {
        display: block;
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #fff;
        margin: 3px auto 0;
    }
}
