/* =========================================
   1. VARIABLEN & GRUNDEINSTELLUNGEN
   ========================================= */
:root {
    /* --- FARBPALETTE (Standardwerte, werden vom Admin überschrieben) --- */
    --primary: #003d66;
    --primary-light: #003d66;
    --primary-bl: #003d66;
    
    --bg-grey: #f0f2f5;
    --bg-red: #ff0000;
    --bg-blue: #0063a1;
    
    --bg-search: #ffffff; 

    /* Gremien Buttons */
    --bg-group: #2b88af;
    --text-group: #e0e0e0;
    --bg-subgroup: #2b88af7a;
    --text-subgroup: #003d66;
    
    /* Karten & Glas-Effekt */
    --bg-card: rgba(255, 255, 255, 0.75);
    --card-blur: 5px; /* Standard Blur-Wert */

    /* Text & Ränder */
    --white: #ffffff;
    --text: #333;
    --text-grey: #777;
    --text-detail: #3e3743;
    --border: #ddd;
    
    /* Footer Verlauf */
    --awb-background-image: linear-gradient(180deg, #003d66 0%, #0063a1 100%);
}

/* =========================================
   2. BASIS LAYOUT & HINTERGRUND
   ========================================= */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    margin: 0;
    padding-bottom: 90px; /* Platz für Menü */
    background: transparent !important; /* Wichtig für Background-Layer */
    min-height: 100vh;
}

/* Der Hintergrund-Layer (Bild oder Farbe) */
#app-background {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background-color: var(--bg-grey);
    background-image: linear-gradient(135deg, var(--bg-grey) 0%, #e3eaf5 100%);
    background-size: cover;
    background-position: center;
}

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

/* Spinner Screen */
#loading-screen {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: #f0f2f5; display: flex;
    justify-content: center; align-items: center; z-index: 9999;
}
.spinner {
    border: 4px solid #f3f3f3; border-top: 4px solid #004080;
    border-radius: 50%; width: 30px; height: 30px;
    animation: spin 1s linear infinite; margin: 20px auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* HEADER */
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: 0; font-size: 1rem; font-weight: 600; }
h3 { margin: 0; font-size: 0.9rem; font-weight: 800; color: var(--text-detail); text-transform: uppercase; }

/* 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 4px 6px rgba(0,0,0,0.2);
}
.btn-mini-close { background: var(--bg-red); }


/* =========================================
   3. DASHBOARD & KARTEN (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: var(--text); letter-spacing: 1px; 
}

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

/* NEWS Items */
.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; }


/* =========================================
   4. 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: var(--bg-group); color: #666;
    font-weight: 600; cursor: pointer; transition: all 0.2s;
    user-select: none; -webkit-tap-highlight-color: transparent;
}
.nav-item.active {
    background: var(--primary); color: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05); border-top: 1px solid #eee; 
}


/* =========================================
   5. KALENDER (Event Liste)
   ========================================= */
.date-header {
    margin-top: 20px; margin-bottom: 8px; padding-left: 5px;
    font-size: 0.85rem; font-weight: 800; color: var(--text);
    text-transform: uppercase; text-shadow: 1px -1px 1px rgba(211,211,211,0.6);
    letter-spacing: 0.5px;
}

.event-item {
    background: transparent;
    padding: 8px 15px; 
 /*   border-bottom: 1px solid rgba(0,0,0,0.9) !important; */
    border-bottom: 1px solid rgb(180 176 176 / 15%) !important;
    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: rgba(0, 0, 0, 0.05) !important; }

/* KATEGORIE BALKEN (Links & Rechts) */
.cat-Plenum        { border-left: 2px solid var(--c-plenum) !important; border-right: 2px solid var(--c-plenum) !important; }
.cat-Presselage    { border-left: 2px solid var(--c-presselage) !important; border-right: 2px solid var(--c-presselage) !important; }
.cat-Fraktion      { border-left: 2px solid var(--c-fraktion) !important; border-right: 2px solid var(--c-fraktion) !important; }
.cat-Enquete       { border-left: 2px solid var(--c-enquete) !important; border-right: 2px solid var(--c-enquete) !important; }
.cat-Vorstand      { border-left: 2px solid var(--c-vorstand) !important; border-right: 2px solid var(--c-vorstand) !important; }
.cat-Ausschuss     { border-left: 2px solid var(--c-ausschuss) !important; border-right: 2px solid var(--c-ausschuss) !important; }
.cat-Arbeitskreis  { border-left: 2px solid var(--c-arbeitskreis) !important; border-right: 2px solid var(--c-arbeitskreis) !important; }
.cat-Wahlkreis     { border-left: 2px solid var(--c-wahlkreis) !important; border-right: 2px solid var(--c-wahlkreis) !important; }
.cat-Sonstiges     { border-left: 2px solid var(--c-sonstiges) !important; border-right: 2px solid var(--c-sonstiges) !important; }
.cat-Frei          { border-left: 2px solid var(--c-frei) !important; border-right: 2px solid var(--c-frei) !important; }
.cat-Fraktions-IT   { border-left: 2px solid var(--c-fraktions-it) !important; border-right: 2px solid var(--c-fraktions-it) !important; }
.cat-Vorstandssitzung { border-left: 2px solid var(--c-vorstandssitzung) !important; border-right: 2px solid var(--c-vorstandssitzung) !important; }

/* Event Details */
.event-cat-label { font-size: 0.7rem; color: var(--primary); text-transform: uppercase; font-weight: bold; margin-bottom: 2px; display: block; }
.event-time { font-weight: 600; color: var(--primary); width: 80px; 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: var(--primary); }
.event-arrow { color: #ccc; font-size: 1.2rem; }


/* =========================================
   6. KONTAKTE & GRUPPEN (Accordion)
   ========================================= */
/* Tabs oben */
.view-switch-container {
    display: flex; background: #e0e0e0; margin: 10px 0 20px 0; padding: 4px; border-radius: 8px;
}
.view-switch-btn {
    flex: 1; border: none; background: transparent; padding: 8px 0;
    border-radius: 6px; font-size: 0.9rem; font-weight: 600; color: #666;
    cursor: pointer; transition: all 0.2s;
}
.view-switch-btn.active {
    background: white; color: #004080; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Accordion Header */
.group-header, .sub-group-header {
    background-color: var(--bg-group); /* Standard (wird unten überschrieben) */
    color: var(--text-group);
    padding: 15px; margin-bottom: 5px; border-radius: 8px;
    cursor: pointer; font-weight: bold; 
    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 {
    background-color: var(--bg-subgroup); 
    color: var(--text-subgroup);
}
.group-header.fav-highlight {
    background: linear-gradient(to right, #ff6347, #FF8C00) !important;
    border-left-color: #f1c40f !important;
    color: white !important;
}

/* Accordion Content & Animation */
.group-content, .sub-group-content { display: none; padding: 0 5px; margin-bottom: 15px; animation: fadeIn 0.3s; }
.group-content.show, .sub-group-content.show { display: block; }
.group-arrow { font-size: 0.8rem; transition: transform 0.3s ease; }
.group-header.active .group-arrow, .sub-group-header.active .group-arrow { transform: rotate(180deg); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* Kontakt-Karten (Complex) */
.contact-card-complex {
    background: white; border-radius: 8px; padding: 15px;
    margin-top: 5px; margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 2px solid #003d66; position: relative; transition: all 0.2s; cursor: default;
}
.contact-card-complex.clickable { cursor: pointer; }
.contact-card-complex.clickable:active { transform: scale(0.99); background: #fafafa; }
.contact-card-complex.is-boss { border-left-color: #004080; } 
.contact-card-complex.is-staff { border-left-color: #9e9e9e; } 

/* Visitenkarte Elemente */
.cc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.cc-name { font-weight: bold; font-size: 1rem; color: #333; margin: 0; line-height: 1.2; }
.cc-room { display: inline-block; background: #f0f2f5; font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; color: #555; margin-left: 8px; font-weight: normal; vertical-align: middle; }
.cc-company { font-weight: bold; font-size: 0.9rem; color: #555; margin-top: 3px; }
.cc-role { color: #004080; font-size: 0.9rem; font-weight: 600; margin-top: 3px; }
.cc-dept { color: #666; font-size: 0.85rem; margin-top: 2px; font-style: italic; }
.cc-arrow { color: #ccc; font-size: 1.2rem; transition: transform 0.2s; margin-left: 10px; }
.cc-main-info { margin-bottom: 5px; }
.cc-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid #f9f9f9; }
.cc-val { font-size: 1rem; color: #333; display: flex; align-items: center; gap: 8px; }
.cc-btn { background: #e3f2fd; color: #004080; text-decoration: none; padding: 6px 12px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; border:none; }
.cc-hidden-details { display: none; margin-top: 15px; padding-top: 10px; border-top: 1px dashed #ddd; background: #f2fffb; margin: 10px -15px -15px -15px; padding: 15px; border-radius: 0 0 8px 8px; }
.cc-hidden-details.show { display: block; animation: fadeIn 0.3s; }
.cc-detail-row { display: flex; align-items: flex-start; margin-bottom: 8px; font-size: 0.9rem; color: #555; }
.cc-detail-icon { width: 25px; font-size: 1.1rem; text-align: center; margin-right: 5px; }


/* =========================================
   7. PROFIL, SUCHE & LOGIN
   ========================================= */
/* Profil Visitenkarte */
.profile-business-card {
    background: var(--bg-card, rgba(255, 255, 255, 0.75));
    backdrop-filter: blur(var(--card-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--card-blur)) saturate(140%);
    border: 1px solid rgba(0, 61, 102, 0.3);
    border-radius: 12px; box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    overflow: hidden; margin-bottom: 20px; margin-top: 10px;
    animation: fadeInUp 0.5s ease-out both;
}
.pbc-header { padding: 30px 20px; background: transparent; border-bottom: 1px solid rgba(0,0,0,0.1); }
.pbc-body { padding: 20px; background: transparent; color: #444; font-size: 1rem; }
.pbc-name { font-size: 1.5rem; font-weight: 800; color: #333; margin-bottom: 5px; line-height: 1.2; }
.pbc-org { font-size: 1rem; color: #555; font-weight: bold; margin-bottom: 2px; }
.pbc-role { font-size: 0.9rem; color: var(--text-grey); font-weight: 400; }
.pbc-row { margin-bottom: 8px; word-break: break-word; }

/* Suche */
.search-bar-container { 
    background: var(--bg-search); 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; padding-right: 40px !important; 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; }
.search-wrapper { position: relative; width: 100%; }
#searchClear { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: #999; font-weight: bold; font-size: 1.2rem; cursor: pointer; display: none; padding: 5px; }
#searchClear:hover { color: var(--primary); }

/* Login */
#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 */
#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; }


/* =========================================
   8. A-Z LISTE & DETAILS
   ========================================= */
.az-header { background: #eee; padding: 5px 15px; font-weight: bold; color: #555; margin-top: 0px; border-top: 1px solid #ddd; }
.az-header.fav-header { color: #d35400; background: #fff3e0; border-radius: 8px 8px 0 0; border-bottom: 2px solid #ffcc80; border-top: none; margin-top: 10px; }
.az-item { background: white; border-bottom: 1px solid #eee; }
.az-item-head { padding: 15px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; }
.az-item-content { display: none; padding: 10px; background: #fafafa; border-top: 1px solid #eee; }

/* Detail Modal */
.detail-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-card, rgba(255, 255, 255, 0.95)) !important;
    backdrop-filter: blur(var(--card-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--card-blur)) saturate(180%);
    z-index: 2000; overflow-y: auto;
    animation: slideUpModal 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes slideUpModal { 0% { transform: translateY(100%); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }

.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.9rem; text-transform: uppercase; color: var(--text-detail); font-weight: 600; margin-top: 20px; display: block; }
.detail-text { font-size: 0.9rem; 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; }


/* =========================================
   9. EFFEKTE: GLAS & ANIMATION
   ========================================= */

/* Zentrale Glas-Effekt Steuerung */
.dash-card, 
.event-item, 
.news-item, 
.news-highlight,
.contact-card-complex,
[id^="fav-list-"] > div:first-child, 
[id^="az-list-"] > div:first-child 
{
    background: var(--bg-card) !important;
    backdrop-filter: blur(var(--card-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--card-blur)) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Glas-Effekt für Gremien-Buttons (farbig) */
.group-header, .sub-group-header {
    backdrop-filter: blur(var(--card-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--card-blur)) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.group-header { background-color: rgba(43, 136, 175, 0.85) !important; color: #fff !important; }
.sub-group-header { background-color: rgba(43, 136, 175, 0.5) !important; color: #003d66 !important; }

/* Eingangs-Animation */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.dash-card, .event-item, .news-item, .contact-list, .contact-card-complex, .view-switch-container, .group-header, .sub-group-header, .az-header, .az-item, .detail-modal, .date-header + div { animation: fadeInUp 0.5s ease-out both; }


/* =========================================
   10. HIGHLIGHT STYLES (Intelligenz)
   ========================================= */

/* A) HAUPT-GRUPPEN (Die blauen Balken) */
.group-header.is-member {
    border-left: 8px solid #ff9800 !important;
    box-shadow: inset 5px 0 0 0 #ff9800 !important; 
    padding-left: 20px !important;
    background-color: rgba(255, 152, 0, 0.15) !important; 
    filter: brightness(0.95);
}

/* B) UNTER-GRUPPEN (Ausschüsse) */
.sub-group-header.is-member {
    border-left: 4px solid #ff9800 !important;
/*    background: linear-gradient(to right, rgba(255, 152, 0, 0.15), rgba(255, 255, 255, 0)) !important; */
    padding-left: 15px !important;
}

/* C) DAS STERNCHEN (Icon Fix) */
.group-header.is-member span:first-child::after,
.sub-group-header.is-member span:first-child::after {
    content: ' ★' !important; color: #ff9800 !important; font-weight: bold !important;
    font-size: 1.1em !important; display: inline-block !important; margin-left: 6px !important; vertical-align: middle;
}

/* D) KALENDER TERMINE */
.event-item.is-relevant {
    border-top: 1px solid #ff9800 !important;
    border-bottom: 1px solid #ff9800 !important;
    background: rgb(255 247 224 / 70%) !important;
    backdrop-filter: blur(var(--card-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--card-blur)) saturate(140%);
}
.event-item.is-relevant .event-time { margin-left: 2px; }


/* =========================================
   11. DARK MODE (Overrides)
   ========================================= */
body.dark-mode {
    --bg-grey: #121212; --white: #1e1e1e; --text: #dfdfdf; --border: #333;
    --primary: #e0e0e0; --primary-light: #4da3ff44; --primary-bl: #121212;
}

/* Dark Mode Basis */
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: rgba(20, 20, 20, 0.95) !important; border-bottom: 1px solid #333; }
body.dark-mode .search-input { background: #333 !important; color: #fff !important; border: 1px solid #555 !important; }

/* Text Overrides */
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: #dfdfdf !important; }
body.dark-mode .news-content, body.dark-mode .cc-dept, body.dark-mode .event-info { color: #cccccc !important; }
body.dark-mode .date-header { color: #aaa; }
body.dark-mode .news-date, body.dark-mode .event-time, body.dark-mode .event-cat-label { color: #90caf9 !important; }
body.dark-mode .event-loc-short { color: #aaa !important; }

/* Dark Mode Backgrounds */
body.dark-mode #app-background { background-image: linear-gradient(135deg, #121212 0%, #2c3e50 100%) !important; }

/* Dark Mode Cards (Container dunkel machen) */
body.dark-mode .dash-card, 
body.dark-mode .event-item, 
body.dark-mode .news-item, 
body.dark-mode .contact-card-complex, 
body.dark-mode .calendar-group,
body.dark-mode .detail-modal, 
body.dark-mode .profile-business-card, 
body.dark-mode [id^="fav-list-"] > div:first-child, 
body.dark-mode [id^="az-list-"] > div:first-child 
{
    background: rgba(30, 30, 30, 0.95) !important;
    color: #e0e0e0 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

/* Kalender Spezial: Einzelzeilen transparent */
body.dark-mode .event-item { background: transparent !important; border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important; border-top: none !important; }
body.dark-mode .event-item:active { background-color: rgba(255, 255, 255, 0.1) !important; }

/* Dark Mode Highlights */
body.dark-mode .group-header.is-member { border-left-color: #ffb300 !important; background-color: rgba(255, 179, 0, 0.2) !important; filter: brightness(1.1); }
body.dark-mode .sub-group-header.is-member { border-left-color: #ffb300 !important; background: linear-gradient(to right, rgba(255, 179, 0, 0.2), rgba(0,0,0,0)) !important; }
body.dark-mode .event-item.is-relevant { background: rgba(255, 152, 0, 0.15) !important; border-left-color: #ffb300 !important; }
body.dark-mode .group-header.fav-highlight { background: linear-gradient(to right, #673f0f, #4d2006) !important; border-left-color: #f1c40f !important; color: white !important; }



/* Karten & Kontakt Overrides */
body.dark-mode .group-header { background-color: rgba(30, 30, 30, 0.85) !important; 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; }
body.dark-mode .view-switch-container { background: #333; }
body.dark-mode .view-switch-btn { color: #aaa; }
body.dark-mode .view-switch-btn.active { background: #555; color: #fff; box-shadow: none; }

body.dark-mode .cc-row {display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid #434343; }

/* Dark Mode Kontakt-Karten */
body.dark-mode .contact-card-complex { border: 1px solid #333; border-left-width: 4px; }
body.dark-mode .cc-name { color: #e0e0e0; }
body.dark-mode .cc-company { color: #aaa; }
body.dark-mode .cc-role { color: #90caf9; }
body.dark-mode .cc-btn { background: rgba(255, 255, 255, 0.1) !important; color: #90caf9 !important; border: 1px solid rgba(255, 255, 255, 0.2) !important; }
body.dark-mode .cc-hidden-details { background: #252525; border-top-color: #444; }
body.dark-mode .cc-detail-row { display: flex; align-items: flex-start; margin-bottom: 8px; font-size: 0.9rem; color: #e0e0e0; }

/* Dark Mode A-Z & Favoriten */
body.dark-mode .az-header { background: rgba(255, 255, 255, 0.1) !important; color: #fff !important; border-top: 1px solid #444 !important; }
body.dark-mode .az-header.fav-header { background: linear-gradient(to right, #3e2723, #5d4037) !important; border-left: 4px solid #ffb300 !important; color: #ffe0b2 !important; }
body.dark-mode .az-item { background: rgba(30, 30, 30, 0.95) !important; border-bottom: 1px solid rgba(255,255,255,0.1) !important; }
body.dark-mode .az-item-head span { background: #1e1e1e !important; color: #e0e0e0 !important; }
body.dark-mode .az-item-content { background: #1e1e1e !important; border-top: 1px solid #333 !important; }

/* Profil Karte Dark */
body.dark-mode .profile-business-card { background: #1e1e1e; border-color: #333; box-shadow: none; }
body.dark-mode .pbc-header { background: linear-gradient(to bottom, #2a2a2a, #1e1e1e); border-bottom-color: #333; }
body.dark-mode .pbc-body { background: #1e1e1e; color: #ccc; }
body.dark-mode .pbc-name { color: #fff; }
body.dark-mode .pbc-org { color: #aaa; }
body.dark-mode .pbc-role { color: #90caf9; }
/* body.dark-mode #qrcode-container { background: black !important; border: 4px solid #000000; } */

body.dark-mode .file-download-box { display: flex; align-items: center; background: #2c2c2c; border: 1px solid #e9ecef; padding: 15px; border-radius: 10px; margin-top: 10px; text-decoration: none; color: #f5f5f5; }
body.dark-mode .btn-mini { background: rgba(255, 255, 255, 0.1) !important; border: 1px solid #93d1ff !important; color: #93d1ff; text-decoration: none; padding: 6px 12px; border-radius: 20px; font-size: 0.8rem; white-space: nowrap; cursor: pointer; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);}
body.dark-mode .btn-mini-close { background: rgba(255, 255, 255, 0.1) !important; border: 1px solid #ff7676 !important; color: #ff7676; text-decoration: none; padding: 6px 12px; border-radius: 20px; font-size: 0.8rem; white-space: nowrap; cursor: pointer; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2); }


/* =========================================
   IOS FIX: Blur-Flackern verhindern
   ========================================= */

/* Wir zwingen das iPhone, die Grafikkarte dauerhaft zu nutzen,
   damit der Blur-Effekt nicht "nachspringt" */

.dash-card, 
.event-item, 
.news-item, 
.contact-card-complex,
.detail-modal,
.group-header,
.sub-group-header {
    /* Trick 1: 3D-Transformation erzwingen */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);

    /* Trick 2: Dem Browser sagen, dass sich was ändert */
    will-change: transform, opacity;

    /* Trick 3: Perspektive setzen (hilft oft bei Glassmorphism) */
    perspective: 1000px;
    -webkit-perspective: 1000px;
}

/* News Content Anpassungen */
.news-content a {
    color: var(--primary);
    text-decoration: underline;
    font-weight: bold;
}

.news-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 10px;
}

.news-content b, .news-content strong {
    font-weight: 800; /* Extra fett */
}


/* =========================================
   DARK MODE GLASS REPAIR (Muss ganz unten stehen!)
   ========================================= */

/* 1. Karten abdunkeln (Dunkles Milchglas) */
body.dark-mode .dash-card, 
body.dark-mode .news-item, 
body.dark-mode .contact-card-complex, 
body.dark-mode #event-list > div[style*="background:white"], 
body.dark-mode [id^="fav-list-"] > div:first-child, 
body.dark-mode [id^="az-list-"] > div:first-child 
{
    /* Dunkles Grau mit Transparenz */
    background: rgba(30, 30, 30, 0.85) !important;
    
    /* Der Rahmen muss im Dark Mode hell und dünn sein, damit man die Kante sieht */
    /* border: 1px solid rgba(255, 255, 255, 0.15) !important; */
    
    /* Textfarbe auf hell zwingen */
    color: #e0e0e0 !important;
    
    /* Schatten etwas stärker für Kontrast */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

/* 2. Text-Inhalte in den Karten auf hell zwingen */
body.dark-mode .event-title,
body.dark-mode .news-title,
body.dark-mode .cc-name,
body.dark-mode .cc-val,
body.dark-mode .cc-company,
body.dark-mode .detail-text {
    color: #dfdfdf !important;
}

body.dark-mode .news-content,
body.dark-mode .cc-dept,
body.dark-mode .event-info {
    color: #cccccc !important;
}

/* 3. Die kleinen Buttons im Telefonbuch (Anrufen, Mail) */
body.dark-mode .cc-btn {
    background: rgba(255, 255, 255, 0.1) !important; /* Leichtes helles Grau */
    color: #90caf9 !important; /* Helles Blau */
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

body.dark-mode .cc-room {
    display: inline-block;
    background: rgba(30, 30, 30, 0.85) !important;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: #dfdfdf !important;
    margin-left: 8px;
    font-weight: normal;
    vertical-align: middle;
}

/* 4. Gremien Buttons (Arbeitskreise etc.) im Dark Mode */
body.dark-mode .group-header {
    /* Dunkleres Blau/Grau für die Hauptgruppen */
    background-color: rgba(20, 24, 26, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

body.dark-mode .sub-group-header {
    /* Noch dunkler für Untergruppen */
    background-color: rgba(30, 30, 30, 0.8) !important; 
    color: #ccc !important;
    border-bottom: 1px solid #444 !important;
}

/* 5. Listen-Ansicht (A-Z) Header */
body.dark-mode div[style*="background:#eee"],
body.dark-mode div[style*="background: rgb(238, 238, 238)"] {
    background: rgba(255, 255, 255, 0.1) !important; /* Transparenter Header */
    color: #fff !important;
    border-top: 1px solid #444 !important;
}

/* 6. Suche im Dark Mode */
body.dark-mode .search-bar-container {
    background: rgba(20, 20, 20, 0.95) !important;
    border-bottom: 1px solid #333;
}
body.dark-mode .search-input {
    background: #333 !important;
    color: #fff !important;
    border: 1px solid #555 !important;
