/* Verwaltungsbereich
 *
 * Diese Regeln standen frueher als <style>-Block in der Dashboard-Ansicht.
 * Alle anderen Verwaltungsseiten nutzen dieselben Klassen, bekamen die
 * Regeln aber nie zu sehen und wirkten deshalb unformatiert. Jetzt laedt
 * templates/header.php die Datei auf jeder Seite unter /admin.
 */

/* --- Admin Topbar --- */
.admin-topbar {
    background: var(--primary-color);
    color: white;
    padding: 24px 0 20px;
    margin: -40px -20px 0;
    padding-left: 20px;
    padding-right: 20px;
    border-radius: 0 0 12px 12px;
    margin-bottom: 30px;
}

.admin-topbar-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-title {
    font-size: 1.6rem;
    margin: 0;
    color: white;
    border: none;
    padding: 0;
}

.admin-subtitle {
    margin: 4px 0 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn-logout:hover {
    background: rgba(255, 80, 80, 0.8);
    border-color: transparent;
}

/* --- Flash Messages --- */
.admin-alert {
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-weight: 500;
    font-size: 0.95rem;
}

.admin-alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.admin-alert-error {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #f8bbd0;
}

/* --- Quick-Nav Buttons --- */
.admin-quicknav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.admin-quicknav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 22px 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    position: relative;
}

.admin-quicknav-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

.admin-quicknav-icon {
    font-size: 2rem;
}

.admin-quicknav-label {
    text-align: center;
}

/* Badge */
.admin-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e53935;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
    line-height: 1.3;
}

.admin-badge-neutral {
    background: var(--primary-light);
}

/* --- Sections --- */
.admin-section {
    margin-bottom: 50px;
    scroll-margin-top: 80px;
}

.admin-section-title {
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* --- Empty State --- */
.admin-empty {
    text-align: center;
    padding: 40px 20px;
    background: white;
    border-radius: 8px;
    color: var(--text-light);
    font-size: 1rem;
    border: 1px dashed #d0d0d0;
}

/* --- Status Badges --- */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-approved {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-pending {
    background: #fff3e0;
    color: #e65100;
}

.status-rejected {
    background: #fce4ec;
    color: #c62828;
}

/* --- Action Buttons --- */
.action-btn {
    font-size: 1.3rem;
    text-decoration: none;
    padding: 4px;
    transition: transform 0.15s;
    display: inline-block;
}

.action-btn:hover {
    transform: scale(1.2);
}

/* --- Tabellenzellen vertikal zentrieren --- */
.admin-table-wrap td {
    vertical-align: middle;
}

/* --- Replied Toggle (Erinnerungs-Haken) --- */
.replied-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    padding: 4px;
}

.replied-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.replied-toggle-box {
    width: 20px;
    height: 20px;
    border: 2px solid #c0c0c0;
    border-radius: 5px;
    background: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    position: relative;
}

.replied-toggle:hover .replied-toggle-box {
    border-color: var(--accent-color);
    transform: scale(1.2);
}

.replied-toggle input[type="checkbox"]:checked + .replied-toggle-box {
    background: #2e7d32;
    border-color: #2e7d32;
}

.replied-toggle input[type="checkbox"]:checked + .replied-toggle-box::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* --- Table Wrap (responsive) --- */
.admin-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
}

/* --- News Cards im Admin --- */
.admin-news-card {
    padding: 20px 24px;
}

.admin-news-card:hover {
    transform: none;
}

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

/* --- Admin Action Buttons (Edit/Delete) --- */
.admin-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.2s;
}


.council-edit.open { display: block !important; }

/* ---------- Benutzerverwaltung ---------- */

/* Kompakte Tabelle statt Karten: Bei vielen Konten zählt Übersicht
   mehr als große Schaltflächen. */
.benutzer-tabelle {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    background: var(--bg-white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.benutzer-tabelle th,
.benutzer-tabelle td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.benutzer-tabelle th {
    background: #f7f7f5;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-light);
}

.benutzer-tabelle tbody tr:last-child td { border-bottom: 0; }
.benutzer-tabelle tbody tr:hover { background: #fafafa; }

.benutzer-tabelle .mitte { text-align: center; }
.benutzer-tabelle .rechts { text-align: right; white-space: nowrap; }

.benutzer-tabelle small { color: var(--text-light); }

.ist-gesperrt td { opacity: .55; }

/* Jede Aktion ist ein eigenes Formular - sie sollen aber nebeneinander
   stehen und keine eigene Zeile beanspruchen. */
.zeilen-form { display: inline; margin: 0; }

.kaestchen {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.nicht-moeglich { color: #bbb; }

.knopf-klein {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    color: var(--text-light);
    font-size: .9rem;
    line-height: 1;
    margin-left: 4px;
}

.knopf-klein:hover { border-color: var(--primary-color); color: var(--primary-color); }
.knopf-klein.gefahr:hover { border-color: #a33; color: #a33; }

.status-select.klein {
    padding: 5px 8px;
    font-size: .88rem;
    min-width: 150px;
}

@media (max-width: 720px) {
    .benutzer-tabelle thead { display: none; }
    .benutzer-tabelle, .benutzer-tabelle tbody, .benutzer-tabelle tr, .benutzer-tabelle td { display: block; width: 100%; }
    .benutzer-tabelle tr { border-bottom: 1px solid #eee; padding: 8px 0; }
    .benutzer-tabelle td { border: 0; padding: 6px 14px; }
    .benutzer-tabelle .mitte, .benutzer-tabelle .rechts { text-align: left; }
    .benutzer-tabelle .mitte::before { content: attr(data-titel); }
}

/* ---------- Hervorgehobene Abschnitte ----------
   Abschnitte mit farbiger Linie links (Notfallmeldung, Konten mit
   offenem Passwortwechsel). Ohne Innenabstand klebte der Text an der
   Linie. Die Farbe setzt die Ansicht. */
.admin-section-rand {
    border-left: 4px solid var(--accent-color);
    padding-left: 20px;
}

/* ---------- Kaestchen und Optionsfelder ----------
   Die Webseite gibt jedem input volle Breite. Fuer Kaestchen heisst das:
   riesig und mittig ueber der Beschriftung. */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    padding: 0;
    margin: 0 8px 0 0;
    vertical-align: -2px;
    accent-color: var(--primary-color);
}

/* Eine Beschriftung mit Kaestchen ist ein Satz, keine Feldueberschrift -
   also ohne Grossbuchstaben und Sperrung. */
label:not(.replied-toggle):has(> input[type="checkbox"]),
label:not(.replied-toggle):has(> input[type="radio"]) {
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.95rem;
    font-weight: normal;
    color: var(--text-main);
    cursor: pointer;
}

label:has(> input[type="checkbox"]) small,
label:has(> input[type="radio"]) small {
    display: block;
    margin: 4px 0 0 26px;
    text-transform: none;
    letter-spacing: normal;
}

/* ---------- Filterleiste (Brett, Meldungen) ----------
   Vorher standen hier die grossen Navigationskacheln des Dashboards mit
   einem Punkt als Symbol - ohne Anzahl und ohne erkennbaren aktiven
   Filter. Eine Leiste passt zu dem, was es ist: eine Auswahl. */
.admin-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
}

.admin-filter-eintrag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 999px;
    background: white;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.admin-filter-eintrag:hover {
    border-color: var(--accent-color);
}

.admin-filter-zahl {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #eef0f3;
    color: var(--text-light);
    font-size: 0.78rem;
    text-align: center;
}

.admin-filter-eintrag.aktiv {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.admin-filter-eintrag.aktiv .admin-filter-zahl {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Wartet auf eine Entscheidung - fällt auf, auch wenn der Filter nicht aktiv ist. */
.admin-filter-eintrag.dringend .admin-filter-zahl {
    background: #e53935;
    color: white;
}

/* ---------- Löschen und Bearbeiten ----------
   Die Klasse admin-action-delete stand in zehn Ansichten, war aber
   nirgends definiert: Der Papierkorb erschien als nackter Browserknopf
   neben dem dunklen "Bearbeiten". Gleiche Höhe wie .btn, rot umrandet,
   damit er als zerstörende Aktion erkennbar ist. */
.admin-action-btn {
    border: 1px solid transparent;
    background: white;
    cursor: pointer;
    font-family: inherit;
}

.admin-action-delete {
    border-color: #e6c3c3;
    color: #a33;
}

/* Neben einem grossen "Bearbeiten" gleich hoch wie dieses. */
.btn + form .admin-action-delete,
.btn + .admin-action-delete {
    width: 43px;
    height: 43px;
}

.admin-action-delete:hover {
    background: #a33;
    border-color: #a33;
    color: white;
}

.admin-action-edit {
    border-color: rgba(0, 0, 0, 0.12);
    color: var(--primary-color);
}

.admin-action-edit:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

/* ---------- Status der Mietanfragen ----------
   In der Buchungstabelle quetschte die Spalte die Auswahl auf zwei
   Buchstaben zusammen ("O", "Al"). Die Farbe zeigt den Stand auf einen
   Blick, ohne die Auswahl öffnen zu müssen. */
.status-select {
    min-width: 132px;
    padding: 7px 10px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
}

.status-select-pending {
    background: #fff6e0;
    border-color: #e8cf8f;
    color: #7a5a0b;
}

.status-select-approved {
    background: #e7f4ec;
    border-color: #a9d3b9;
    color: #22613f;
}

.status-select-rejected {
    background: #f9e9e9;
    border-color: #e2b4b4;
    color: #8f2b2b;
}

/* ---------- Schmale Bildschirme ----------
   Die Kopfleiste stand starr nebeneinander; auf dem Handy ragten
   "Zur Verwaltung" und "Abmelden" rechts aus dem Bild. */
.admin-topbar-inner {
    flex-wrap: wrap;
    gap: 14px;
}

.admin-topbar-inner > div:last-child {
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .admin-title {
        font-size: 1.3rem;
    }

    .admin-topbar-inner .btn {
        padding: 8px 14px;
        font-size: 0.88rem;
    }

    .admin-quicknav {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .admin-quicknav-btn {
        padding: 16px 8px;
        font-size: 0.8rem;
    }

    .admin-quicknav-icon {
        font-size: 1.5rem;
    }

    /* "Benachrichtigungen" passt sonst nicht in die Kachel. */
    .admin-quicknav-label {
        hyphens: auto;
        overflow-wrap: anywhere;
    }
}
