/* ==========================================================================
   CDU Ortsverband Insel Föhr - Zentrales Stylesheet (Master Version)
   Stand: Sprint 4 / Corporate Design 2023 Edition
   ========================================================================== */

:root {
    /* --- HAUPTFARBEN (CDU Manual 2023) --- */
    --cadenabbia-tuerkis: #52b7c1;
    --rhoendorf-blau: #2d3c4b;
    --union-gold: #ffa600;
    --union-schwarz: #1b191d;
    --union-rot: #bf111b;
    --weiss: #ffffff;

    /* --- ABSTUFUNGEN (CDU Manual 2023) --- */
    --blau-10: #f2f8fa;
    --blau-25: #ddeef1;
    --tuerkis-10: #e5e5e9;

    /* --- SYSTEM FARBEN --- */
    --grau-bg: var(--blau-10); /* Offizielles 10% Rhöndorf-Blau für Hintergründe */
    --grau-text: #64748b; 
    --error-rot: var(--union-rot); 
}

/* ==========================================================================
   1. GRUNDLAGEN (Base) & TYPOGRAFIE
   ========================================================================== */
body {
    margin: 0;
    font-family: 'IBM Plex Serif', serif; /* Fließtext zwingend in IBM Plex Serif */
    background-color: var(--grau-bg);
    color: var(--rhoendorf-blau);
    line-height: 1.6;
}

/* CD-Regel: Headlines in Inter Extrabold, NIEMALS in reinen Versalien, Laufweite -10 */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    color: var(--rhoendorf-blau);
    margin-top: 0;
    text-transform: none !important; /* Blockiert versehentliche Großschreibung (ALL-CAPS) */
    letter-spacing: -0.02em; /* Entspricht Laufweite -10 */
}

a {
    transition: all 0.2s ease-in-out;
}

/* ==========================================================================
   2. LAYOUT & CONTAINER
   ========================================================================== */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.container-small {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Das neue Dashboard Grid (Intelligentes Masonry) */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

/* Split Layouts (z.B. Kalender Admin) */
.split-layout { 
    display: grid; 
    grid-template-columns: 1fr 400px; 
    gap: 30px; 
    align-items: start; 
}
@media (max-width: 900px) { .split-layout { grid-template-columns: 1fr; } }

/* ==========================================================================
   3. NAVIGATION (Public Header & Intranet Topbar)
   ========================================================================== */

/* Die Header-Leiste bleibt beim Scrollen oben kleben und hat einen leichten Schatten */
.public-header {
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px); 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 15px 0;
    transition: all 0.3s ease;
}

.public-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Logo Styling */
.public-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-size: 24px;
    font-weight: 900;
    color: var(--rhoendorf-blau);
    letter-spacing: -0.5px;
    transition: transform 0.2s;
}

.public-logo:hover {
    transform: scale(1.02);
}

.public-logo img {
    height: 38px;
    width: auto;
}

/* Das Menü an sich */
.public-menu {
    display: flex;
    align-items: center;
    gap: 35px;
}

/* Normale Links (ohne den Login-Button) */
.public-menu a:not(.btn-login) {
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    color: #475569;
    font-weight: 600;
    font-size: 16px;
    position: relative;
    padding-bottom: 5px;
    transition: color 0.2s ease;
}

/* Der animierte Hover-Unterstrich */
.public-menu a:not(.btn-login)::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    bottom: 0;
    left: 0;
    background-color: var(--cadenabbia-tuerkis);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Wenn man mit der Maus drüber fährt ODER die Seite aktiv ist */
.public-menu a:not(.btn-login):hover {
    color: var(--rhoendorf-blau);
}

.public-menu a:not(.btn-login):hover::after,
.public-menu a.active:not(.btn-login)::after {
    width: 100%;
}

.public-menu a.active:not(.btn-login) {
    color: var(--rhoendorf-blau);
}

/* Spezielles Styling für den Login-Button im Menü */
.btn-login {
    background-color: var(--union-gold);
    color: var(--union-schwarz) !important;
    padding: 10px 22px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(255, 166, 0, 0.2);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 166, 0, 0.4);
    background-color: #e59500;
}

/* Mobile Toggle Button (versteckt auf großen Bildschirmen) */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--rhoendorf-blau);
    cursor: pointer;
    padding: 5px;
}

/* Intranet Topbar (Dashboard) */
.topbar {
    background-color: var(--rhoendorf-blau);
    color: var(--weiss);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid var(--cadenabbia-tuerkis);
}
.topbar.topbar-admin { border-bottom-color: var(--union-gold); }
.topbar.topbar-moderator { border-bottom-color: var(--union-gold); background-color: #1e293b; }

.topbar-logo { font-family: 'Inter', sans-serif; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.logout-btn {
    background-color: rgba(255,255,255,0.1);
    color: var(--weiss);
    text-decoration: none;
    padding: 6px 15px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 13px;
    border-radius: 4px;
}
.logout-btn:hover { background-color: var(--error-rot); }

/* Kleiner Helfer für den Zurück-Button im Intranet */
.back-to-dash {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: color 0.2s;
}
.back-to-dash:hover {
    color: #fff;
}


/* ==========================================================================
   4. BUTTONS & BADGES
   ========================================================================== */
.btn {
    display: inline-block;
    background-color: var(--rhoendorf-blau);
    color: var(--weiss) !important;
    border: none;
    padding: 12px 24px;
    font-family: 'Inter', sans-serif;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    border-radius: 4px;
    text-decoration: none;
    text-align: center;
}
.btn:hover { background-color: #1e293b; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

.btn-gold { background-color: var(--union-gold); color: var(--union-schwarz) !important;}
.btn-gold:hover { background-color: #e59500; }

.btn-primary { background-color: var(--cadenabbia-tuerkis); }

/* Störer-Element (CD-Manual Vorgabe: 10 Grad Winkel, Goldener Grund, weiße Schrift) */
.stoerer {
    display: inline-block;
    background-color: var(--union-gold);
    color: var(--weiss);
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    padding: 8px 16px;
    transform: rotate(-10deg);
    box-shadow: 2px 2px 10px rgba(0,0,0,0.15);
}

/* System Badges */
.badge { display: inline-block; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: bold; }
.badge-public { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.badge-internal { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.badge-warning { background-color: var(--union-rot); color: white; padding: 2px 6px; border-radius: 10px; font-size: 12px; margin-left: 5px; vertical-align: middle; }

/* ==========================================================================
   5. FORMULARE & EDITOREN
   ========================================================================== */
.form-group { margin-bottom: 20px; }

label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--rhoendorf-blau);
    font-size: 14px;
}

input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="time"], input[type="datetime-local"], select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: 'IBM Plex Serif', serif;
    font-size: 15px;
    box-sizing: border-box;
    transition: 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--cadenabbia-tuerkis);
    box-shadow: 0 0 0 3px rgba(82, 183, 193, 0.15);
}

/* WYSIWYG Editor Toolbar */
.editor-toolbar { 
    background: var(--weiss); border: 1px solid #cbd5e1; border-bottom: none; 
    padding: 10px; display: flex; gap: 5px; border-radius: 4px 4px 0 0; align-items: center; flex-wrap: wrap;
}
.editor-toolbar button, .editor-toolbar select { 
    background: white; border: 1px solid #ccc; border-radius: 3px; padding: 6px 12px; 
    cursor: pointer; font-weight: bold; font-family: 'Inter', sans-serif; font-size: 13px; color: #334155;
}
.editor-toolbar button:hover { background: var(--blau-10); }

.content-area { 
    font-family: 'IBM Plex Serif', serif;
    font-size: 15px; line-height: 1.6; min-height: 250px; padding: 20px; 
    border: 1px solid #cbd5e1; border-radius: 0 0 4px 4px; outline: none; background: #fff; 
}
.content-area:focus { border-color: var(--cadenabbia-tuerkis); }

/* ==========================================================================
   6. ALERTS (Benachrichtigungen)
   ========================================================================== */
.alert { padding: 15px; margin-bottom: 20px; font-family: 'Inter', sans-serif; border-radius: 4px; }
.alert-error { background-color: #fef2f2; color: #b91c1c; border-left: 4px solid var(--error-rot); }
.alert-success { background-color: #f0fdf4; color: #15803d; border-left: 4px solid #16a34a; }

/* ==========================================================================
   7. KARTEN (Cards) & EVENT-COMPONENTS
   ========================================================================== */
.card-box {
    background: var(--weiss);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    padding: 25px;
}

/* Dashboard Cards */
.card { 
    display: flex; flex-direction: column; height: 100%; background: #fff; border-radius: 8px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); padding: 25px; position: relative; 
    transition: transform 0.2s, box-shadow 0.2s;
    border-top: 4px solid var(--rhoendorf-blau); 
}
.card h2 { margin-top: 0; font-size: 20px; padding-right: 20px;}
.card p { color: #64748b; font-size: 14px; margin-bottom: 20px; }
.card .btn { margin-top: auto; width: 100%; display: block; box-sizing: border-box; }

/* Dashboard Theme Gold */
.card.theme-gold { border-top-color: var(--union-gold); }
.card.theme-gold .btn { background-color: var(--union-gold); color: var(--union-schwarz) !important; }

/* Event Mini-Kalenderblätter */
.event-date-box { 
    background: var(--rhoendorf-blau); color: white; border-radius: 4px; 
    padding: 10px; text-align: center; min-width: 60px; height: fit-content;
}
.event-date-box .day { font-size: 22px; font-weight: 900; line-height: 1; font-family: 'Inter', sans-serif;}
.event-date-box .month { font-size: 11px; text-transform: uppercase; font-weight: bold; margin-top: 3px; font-family: 'Inter', sans-serif;}

/* Page Header (z.B. Termine, Aktuelles) */
.page-header { background: var(--rhoendorf-blau); color: white; padding: 60px 20px; text-align: center; border-bottom: 5px solid var(--union-gold); }
.page-header h1 { font-family: 'Inter', sans-serif; font-size: 42px; margin: 0 0 15px 0; font-weight: 800; color: white;}
.page-header p { font-size: 18px; color: #cbd5e1; max-width: 600px; margin: 0 auto; line-height: 1.6; }

/* ==========================================================================
   8. FOOTER
   ========================================================================== */
.footer {
    background-color: var(--rhoendorf-blau);
    color: #cbd5e1;
    padding: 60px 5% 30px;
    text-align: center;
    margin-top: 80px;
    border-top: 1px solid #1e293b;
}
.footer p { margin: 5px 0; font-size: 14px; }
.footer a { color: var(--cadenabbia-tuerkis); text-decoration: none; }


/* ==========================================================================
   9. RESPONSIVE DESIGN (Smartphone & Tabellen)
   ========================================================================== */
@media (max-width: 900px) {
    .mobile-toggle {
        display: block; /* Hamburger-Icon einblenden */
    }
    
    .public-menu {
        display: none; /* Menü verstecken */
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #ffffff;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        padding: 20px 0 30px 0;
        gap: 20px;
        text-align: center;
    }
    
    .public-menu.is-open {
        display: flex; /* Menü einblenden, wenn Button geklickt wurde */
    }
    
    .public-menu a:not(.btn-login)::after {
        display: none; /* Keine Striche auf Mobile */
    }
}

@media (max-width: 800px) {
    /* Macht die Admin- und Tresor-Tabellen auf dem Smartphone horizontal wischbar */
    .admin-table, 
    .doc-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap; /* Verhindert, dass der Text in engen Zellen umbricht */
        -webkit-overflow-scrolling: touch; /* Flüssiges Wischen auf iOS */
        border-radius: 4px;
    }
    
    .admin-table th, 
    .admin-table td,
    .doc-table th, 
    .doc-table td {
        padding: 15px 20px;
    }
}

/* ==========================================================================
   10. PRINT STYLES (Für Briefe im Sekretariat)
   ========================================================================== */
@media print {
    body { background: white; }
    .print-hide { display: none !important; }
    .container { margin: 0; padding: 0; max-width: none; }
}

/* ==========================================================================
   11. DSGVO-KONFORME Pfade (Schriften liegen in assets/css/fonts/)
   ========================================================================== */
@font-face {
    font-family: 'IBM Plex Serif';
    src: url('fonts/IBMPlexSerif-Regular.ttf') format('truetype');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'IBM Plex Serif';
    src: url('fonts/IBMPlexSerif-Italic.ttf') format('truetype');
    font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
    font-family: 'IBM Plex Serif';
    src: url('fonts/IBMPlexSerif-Bold.ttf') format('truetype');
    font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter-VariableFont_slnt,wght.ttf') format('truetype-variations');
    font-weight: 100 900; font-style: oblique 0deg 10deg; font-display: swap;
}