:root {
    /* --- FARBPALETTE --- */
    --primary: #003d66;
    --primary-light: #003d66;
    --primary-bl: #003d66;
    
    --bg-grey: #f0f2f5;
    --bg-red: #ff0000;
    --bg-blue: #0063a1;
    
    --white: #ffffff;
    --text: #333;
    --border: #ddd;
    
    /* Spezieller Verlauf für die Navigation */
    --awb-background-image: linear-gradient(180deg, #003d66 0%, #0063a1 100%);

    /* --- KATEGORIE FARBEN --- */
    --c-plenum: #d32f2f;
    --c-fraktion: #1976d2;
    --c-enquete: #FFFF00;
    --c-vorstand: #b22222;
    --c-ausschuss: #0000FF;
    --c-presselage: #BA55D3;
    --c-arbeitskreis: #FFD700;
    --c-wahlkreis: #388e3c;
    --c-sonstiges: #9e9e9e;
    --c-frei: rgba(0, 193, 255, 0.6);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-grey);
    color: var(--text);
    margin: 0;
    padding-bottom: 90px; /* Platz für Menü */
}

/* --- HEADER (Desktop/Standard) --- */
header {
    background: var(--primary-bl);
    color: var(--white);
    padding: 15px;
    text-align: center;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
h1 { margin: 0; font-size: 1.2rem; font-weight: 600; }
h2 { margin: 5px; font-size: 1rem; font-weight: 600; }

.container { padding: 0px 15px 15px 15px; max-width: 800px; margin: 0 auto; }
.hidden { display: none !important; }
.spacer-bottom { height: 80px; }

/* --- LISTENANSICHT (Kalender & News) --- */
.date-header {
    margin-top: 20px; margin-bottom: 8px; padding-left: 5px;
    font-size: 1rem; font-weight: 800;
    color: #003d66;
    text-transform: uppercase;
    text-shadow: 1px -1px 1px rgba(211,211,211,0.6);
    letter-spacing: 0.5px;
}

.event-item {
    background: var(--white);
    padding: 6px 15px; 
    border-bottom: 1px solid #f0f0f0;
    display: flex; align-items: center;
    cursor: pointer;
}
.event-item:first-child { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.event-item:last-child { border-bottom: none; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.event-item:active { background-color: #eef4ff; }

/* KATEGORIE BALKEN */
.cat-Plenum      { border-left: 4px solid var(--c-plenum); border-right: 4px solid var(--c-plenum); }
.cat-Presselage  { border-left: 4px solid var(--c-presselage); border-right: 4px solid var(--c-presselage); }
.cat-Fraktion    { border-left: 4px solid var(--c-fraktion); border-right: 4px solid var(--c-fraktion); }
.cat-Enquete     { border-left: 4px solid var(--c-enquete); border-right: 4px solid var(--c-enquete); }
.cat-Vorstand    { border-left: 4px solid var(--c-vorstand); border-right: 4px solid var(--c-vorstand); }
.cat-Ausschuss   { border-left: 4px solid var(--c-ausschuss); border-right: 4px solid var(--c-ausschuss); }
.cat-Arbeitskreis{ border-left: 4px solid var(--c-arbeitskreis); border-right: 4px solid var(--c-arbeitskreis); }
.cat-Wahlkreis   { border-left: 4px solid var(--c-wahlkreis); border-right: 4px solid var(--c-wahlkreis); }
.cat-Sonstiges   { border-left: 4px solid var(--c-sonstiges); border-right: 4px solid var(--c-sonstiges); }
.cat-Frei        { border-left: 4px solid var(--c-frei); border-right: 4px solid var(--c-frei); }

.event-cat-label { 
    font-size: 0.7rem; color: #888; text-transform: uppercase; 
    font-weight: bold; margin-bottom: 2px; display: block; 
}

.event-time { font-weight: 700; color: var(--primary); width: 55px; font-size: 0.85rem; flex-shrink: 0; }
.event-info { flex-grow: 1; padding-right: 10px; }
.event-title { font-size: 1rem; font-weight: 600; color: #222; margin-bottom: 2px; }
.event-loc-short { font-size: 0.85rem; color: #777; }
.event-arrow { color: #ccc; font-size: 1.2rem; }

/* NEWS */
.news-item {
    background: var(--white); padding: 20px; margin-bottom: 15px;
    border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.news-date { font-size: 0.8rem; color: var(--primary); font-weight: bold; text-transform: uppercase; margin-bottom: 5px; }
.news-title { font-size: 1rem; font-weight: bold; color: #222; margin-bottom: 10px; }
.news-content { font-size: 0.95rem; color: #444; line-height: 1.5; white-space: pre-wrap; }

/* --- DETAIL OVERLAY (Modal) --- */
.detail-modal {
    display: none; position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--white); z-index: 2000;
    overflow-y: auto; animation: slideUp 0.25s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.detail-header {
    background: var(--primary-bl); border-bottom: 1px solid #eee;
    color: #FFF;
    padding: 15px 20px; position: sticky; top: 0;
    display: flex; justify-content: space-between; align-items: center; z-index: 2001;
}

.btn-close { font-size: 1.5rem; background: red; border: none; cursor: pointer; color: #fff; border-radius: 4px; padding: 0 10px; }

.detail-content { padding: 25px 20px; }
.detail-label { font-size: 0.75rem; text-transform: uppercase; color: #888; font-weight: bold; margin-top: 20px; display: block; }
.detail-text { font-size: 1.05rem; color: #333; line-height: 1.5; }

.file-download-box {
    display: flex; align-items: center;
    background: #f8f9fa; border: 1px solid #e9ecef;
    padding: 15px; border-radius: 10px; margin-top: 10px;
    text-decoration: none; color: #333;
}
.icon-pdf { font-size: 1.4rem; margin-right: 15px; }

/* --- ADRESSBUCH --- */
.contact-card {
    background: var(--white); border-radius: 12px;
    padding: 20px; margin-bottom: 15px;
    border-style: solid;
    border-color: #008b8b;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.contact-row {
    display: flex; align-items: center; 
    justify-content: flex-start; 
    gap: 8px; padding: 6px 0; 
    border-bottom: 1px solid #eee;
}
.contact-row .btn-mini { margin-left: auto; }
.contact-row:last-child { border-bottom: none; }

.contact-val { 
    font-size: 1rem; color: #333; 
    word-break: break-all; overflow-wrap: anywhere; line-height: 1.4;
}

.contact-note {
    background: #fff8e1; color: #666; font-size: 0.85rem;
    padding: 8px; border-radius: 6px; margin-top: 10px;
    font-style: italic; border-left: 3px solid #ffd54f;
}

/* Versteckter Bereich (Details) */
.contact-details {
    display: none; margin-top: 15px; padding-top: 15px;
    border-top: 1px dashed #ccc; 
    margin-left: -15px; margin-right: -15px; margin-bottom: -15px;
    padding-left: 15px; padding-right: 15px; padding-bottom: 15px;
    border-bottom-left-radius: 8px; border-bottom-right-radius: 8px;
}
.contact-details.show { display: block; animation: slideDown 0.3s ease-out; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.expand-icon { float: right; transition: transform 0.3s; font-size: 0.8rem; color: #999; }

/* Buttons */
.btn-mini, .btn-mini-close {
    background: var(--primary); color: white; text-decoration: none;
    padding: 6px 12px; border-radius: 20px; font-size: 0.8rem;
    white-space: nowrap; border: none; cursor: pointer;
    box-shadow: 0px 8px 10px -7px #000000, 5px 5px 15px 5px rgba(0,0,0,0);
}
.btn-mini-close { background: var(--bg-red); }

/* --- NAVIGATION (Footer) --- */
.nav {
    display: flex; justify-content: space-between; gap: 15px;
    background: var(--awb-background-image); padding: 15px;
    position: fixed; bottom: 0; width: 100%; box-sizing: border-box;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05); border-top: 1px solid #eee;
    z-index: 900;
}
.nav-item {
    flex: 1; text-align: center; padding: 5px 0; font-size: 24px;
    border-radius: 10px; background: #2b88af; color: #666;
    font-weight: 600; cursor: pointer; transition: all 0.2s;
    user-select: none; -webkit-tap-highlight-color: transparent;
    box-shadow: 0px 8px 10px -7px #000000, 5px 5px 15px 5px rgba(0, 0, 0, 0);
}
.nav-item.active {
    background: var(--primary); color: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05); border-top: 1px solid #eee; 
}

/* --- DASHBOARD (Header & Cards) --- */
.dash-header {
    background: var(--primary-bl); color: var(--white);
    padding: 25px 20px; margin: 10px 0 20px 0;
    border-radius: 20px; position: relative;
    box-shadow: 0 4px 10px rgba(0,64,128,0.2);
}
.dash-logo { position: absolute; top: 20px; right: 20px; height: 50px; width: auto; opacity: 0.9; }
.dash-greeting { font-size: 1.4rem; font-weight: 700; margin: 0 0 5px 0; padding-right: 60px; text-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.dash-date { color: rgba(255,255,255,0.8); font-size: 0.95rem; font-weight: 500; }

.dash-section-title { margin: 0 0 12px 10px; font-size: 0.85rem; font-weight: 800; text-transform: uppercase; color: #888; letter-spacing: 1px; }

.dash-card {
    background: var(--white); border-radius: 15px;
    padding: 6px 16px; margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
   /* border-left: 4px solid transparent; */transition: transform 0.2s;
}
.dash-card:active { transform: scale(0.98); }
.dash-card.news-highlight { border-left: 4px solid var(--primary); border-right: 4px solid var(--primary); }
.dash-empty { text-align: center; color: #999; padding: 15px; font-style: italic; }

/* --- SUCHE & LOGINS --- */
.search-bar-container { background: #ffffff; padding: 10px 15px; position: sticky; top: 0; z-index: 90; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 10px; }
.search-input { width: 100%; padding: 10px 15px; border-radius: 20px; border: 1px solid #ddd; background-color: #f0f2f5; font-size: 1rem; outline: none; box-sizing: border-box; }
.search-input:focus { border-color: #003d66; background: #fff; }

#login-view { background: var(--white); padding: 30px; border-radius: 12px; margin-top: 40px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); text-align: center; }
input[type="text"] { width: 100%; padding: 12px; margin: 2px 0; border: 1px solid var(--border); border-radius: 8px; box-sizing: border-box; font-size: 1rem; }
.btn-login { background: var(--primary); color: white; border: none; padding: 12px; width: 100%; border-radius: 8px; font-size: 1rem; font-weight: bold; cursor: pointer; }

/* --- TOAST & OFFLINE BANNER --- */
#copy-toast { visibility: hidden; min-width: 250px; background-color: #333; color: #fff; text-align: center; border-radius: 2px; padding: 16px; position: fixed; z-index: 3000; left: 50%; bottom: 100px; transform: translateX(-50%); font-size: 1rem; }
#copy-toast.show { visibility: visible; animation: fadein 0.5s, fadeout 0.5s 2.5s; }
@keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 100px; opacity: 1;} }
@keyframes fadeout { from {bottom: 100px; opacity: 1;} to {bottom: 0; opacity: 0;} }

#offline-banner { display: none; background-color: #d32f2f; color: white; text-align: center; padding: 5px; font-size: 0.8rem; position: sticky; top: 0; z-index: 200; }

/* --- AKKORDEON (Kontakte) --- */
.group-header {
    background-color: #2b88af; padding: 15px; margin-bottom: 5px; border-radius: 8px;
    cursor: pointer; font-weight: bold; color: #e0e0e0;
    display: flex; justify-content: space-between; align-items: center;
    user-select: none; border: 1px solid #e0e0e0;
    box-shadow: 0 4px 10px rgba(0, 64, 128, 0.2);        
}
.group-content { display: none; padding: 0 5px; margin-bottom: 15px; animation: fadeIn 0.3s; }
.group-content.show { display: block; }
.group-arrow { font-size: 0.8rem; transition: transform 0.3s ease; }
.group-header.active .group-arrow { transform: rotate(180deg); }

/* LEVEL 2 (Untergruppen) */
.sub-group-header {
    background-color: #2b88af7a; padding: 15px; margin-bottom: 5px; border-radius: 8px;
    cursor: pointer; font-weight: bold; color: #003d66; text-align: center;
    display: flex; justify-content: space-between; align-items: center;
    user-select: none; border: 1px solid #e0e0e0;
    box-shadow: 0 4px 10px rgba(0, 64, 128, 0.2); 
}
.sub-group-header:hover { background-color: #f9f9f9; }
.sub-group-content { display: none; margin-bottom: 10px; }
.sub-group-content.show { display: block; }
.sub-group-header.active { border-left: 4px solid var(--primary); color: var(--primary); }
.sub-group-header.active .group-arrow { transform: rotate(180deg); }

/* --- LADE SPINNER --- */
.spinner {
    border: 4px solid #f3f3f3; /* Hellgrau */
    border-top: 4px solid #004080; /* Deine Primary Farbe */
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto; /* Zentriert */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- DARK MODE (Zusammengefasst & Repariert) --- */
body.dark-mode {
    --bg-grey: #121212;
    --white: #1e1e1e;
    --text: #ffffff; /* Weiß für Text */
    --border: #333;
    --primary: #e0e0e0; 
    --primary-light: #4da3ff44;
    --primary-bl: #121212;
}

body.dark-mode .dash-header, body.dark-mode .detail-header, body.dark-mode .header { background: #121212; }
body.dark-mode .dashboard-view, body.dark-mode .nav { background: #1e1e1e; border-top: 1px solid #333; }
body.dark-mode .nav-item { background: #2c2c2c; color: #aaa; }
body.dark-mode .nav-item.active { background: var(--primary); color: #000; }
body.dark-mode input, body.dark-mode textarea { background-color: #2c2c2c !important; color: #fff !important; border-color: #444 !important; }
body.dark-mode .search-bar-container { background: #1e1e1e; box-shadow: 0 2px 5px rgba(255,255,255,0.05); }
body.dark-mode .contact-note { background: #332b00; color: #ccc; border-left-color: #ffb300; }
body.dark-mode .dash-header { box-shadow: none; }
body.dark-mode .dash-card, body.dark-mode .news-item { background: #252525; border: 1px solid #333; box-shadow: none; }
body.dark-mode .detail-text { color: #e0e0e0; }
body.dark-mode .btn-mini { background: var(--primary-bl); color: white; }

/* Textfarben im Dark Mode */
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3, 
body.dark-mode .dash-greeting, body.dark-mode .news-title, 
body.dark-mode .event-title, body.dark-mode .detail-label { color: #ffffff !important; }

body.dark-mode .news-content { color: #d1d1d1 !important; }
body.dark-mode .date-header { color: #aaa; }
body.dark-mode .news-date { color: var(--primary); }
body.dark-mode .contact-val { color: #e3f2fd !important; }

/* Akkordeon Dark Mode */
body.dark-mode .group-header { background-color: #2c2c2c; color: var(--primary); border-color: #444; }
body.dark-mode .sub-group-header { background-color: #1e1e1e; color: #ccc; border-bottom-color: #333; border-left-color: #444; }
body.dark-mode .sub-group-header.active { border-left-color: var(--primary); color: #fff; }