/* --- TSV STEINWEDEL GLOBAL BRANDING & LAYOUT --- */

:root {
    --primary: #1b5e20; 
    --primary-light: #2e7d32;
    --secondary: #f1f8e9; 
    --bg: #f5f5f5; 
    --surface: #ffffff; 
    --text: #1a1a1a; 
    --text-muted: #777777;
    --border: #e0e0e0;
    --footer-bg: #111111; 
    --footer-text: #777777;
    --shadow: 0 4px 15px rgba(0,0,0,0.05);
    
    /* Admin, Status & Action Colors */
    --accent: #2e7d32;
    --warning: #f57c00;
    --danger: #c62828;

    /* Admin-Fix Variables */
    --bg-header: var(--surface);
    --bg-dropdown: var(--surface);
}

/* Dark Mode Support */
[data-theme="dark"] {
    --primary: #4caf50; 
    --primary-light: #81c784;
    --secondary: #1b2e1a; 
    --bg: #0f1110; 
    --surface: #1a1c1b; 
    --text: #f0f0f0; 
    --text-muted: #aaaaaa;
    --border: #2c2e2d;
    --footer-bg: #050505; 
    --footer-text: #555555;
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
    --bg-header: var(--surface);
    --bg-dropdown: var(--surface);
}

* { box-sizing: border-box; }

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; 
    background: var(--bg); 
    color: var(--text); 
    line-height: 1.6; 
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 20px; 
}

/* --- HEADER & NAVIGATION (FIXED & LAYERED) --- */
header { 
    background: var(--bg-header); 
    border-bottom: 4px solid var(--primary); 
    position: sticky; 
    top: 0; 
    left: 0;
    width: 100%;
    z-index: 9999; /* Sehr hoher Wert, damit nichts den Header überlagert */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
}

.nav-wrapper { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    height: 80px; 
    padding: 0.5rem 1rem;
}

.logo-box { 
    display: flex; 
    align-items: center; 
    text-decoration: none; 
    color: var(--text); 
    font-weight: 900; 
}

.header-logo { height: 50px; margin-right: 15px; }

.logo-text-wrapper, .logo-text { display: flex; flex-direction: column; }

.logo-subtitle, .logo-text span:last-child { 
    font-size: 0.7rem; 
    font-weight: normal; 
    color: var(--primary); 
    margin-top: -4px; 
}

.logo-text span:first-child { 
    font-weight: 900; 
    color: var(--primary); 
    text-transform: uppercase; 
}

nav { display: flex; align-items: center; gap: 5px; }

nav a { 
    text-decoration: none; 
    color: var(--text); 
    font-weight: 700; 
    text-transform: uppercase; 
    font-size: 0.8rem; 
    padding: 10px 15px; 
    transition: all 0.2s;
    border-radius: 4px;
}

nav a:hover, nav a.active { color: var(--primary); background: var(--secondary); }

/* Active Link Styling (Merged Fix) */
nav a.active { 
    font-weight: bold;
    border-bottom: 2px solid var(--primary);
}

/* --- DROPDOWNS (Z-INDEX FIX) --- */
.nav-dropdown { 
    position: relative; 
    display: inline-block; 
}

.nav-drop-label { 
    padding: 10px 15px; 
    cursor: pointer; 
    font-weight: 700; 
    text-transform: uppercase; 
    font-size: 0.8rem; 
    color: var(--text);
    border-radius: 4px;
    transition: all 0.2s;
}

.nav-drop-label:hover { 
    background: var(--secondary); 
    color: var(--primary); 
}

.nav-drop-content {
    display: none; 
    position: absolute; 
    background-color: var(--bg-dropdown);
    min-width: 200px; 
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 10000; /* Noch höher als der Header */
    border-radius: 8px; 
    border: 1px solid var(--border);
    margin-top: 5px;
    overflow: hidden;
}

.nav-drop-content a {
    color: var(--text) !important; 
    padding: 12px 15px !important; 
    text-decoration: none;
    display: block; 
    text-transform: none !important; 
    font-size: 0.85rem !important;
    border-radius: 0 !important;
    background: transparent !important;
}

.nav-drop-content a:hover { 
    background-color: var(--secondary) !important; 
    color: var(--primary) !important; 
}

.nav-dropdown:hover .nav-drop-content { 
    display: block; 
}

.nav-admin { 
    border: 2px solid var(--primary); 
    border-radius: 4px; 
    color: var(--primary) !important; 
}

.header-btn { 
    background: none; 
    border: none; 
    cursor: pointer; 
    font-size: 1.2rem; 
    padding: 8px; 
    border-radius: 4px; 
    transition: background 0.2s; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}
.header-btn:hover { background: var(--secondary); }

/* --- DOKUMENTATION LAYOUT --- */
.doku-wrapper { max-width: 1200px; margin: 0 auto; padding: 40px 20px; }

.doku-header {
    border-bottom: 4px solid var(--primary);
    margin-bottom: 40px; padding: 30px;
    background: var(--surface); border-radius: 12px; box-shadow: var(--shadow);
}

.doku-header h1 { margin: 0; color: var(--primary); text-transform: uppercase; }

.section-title {
    margin-top: 60px; margin-bottom: 25px; padding-left: 15px;
    border-left: 6px solid var(--primary); color: var(--primary);
    text-transform: uppercase; font-size: 1.3rem; font-weight: 900;
}

.grid-container {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px;
}

.module-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 25px; text-decoration: none; color: var(--text);
    display: flex; flex-direction: column; justify-content: space-between;
    transition: transform 0.3s ease; box-shadow: var(--shadow);
}

.module-card:hover { transform: translateY(-8px); border-color: var(--primary); box-shadow: 0 12px 30px rgba(0,0,0,0.1); }

.module-card h3 { margin: 0 0 12px 0; color: var(--primary); font-size: 1.2rem; text-transform: uppercase; }

.module-card p { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 20px; flex-grow: 1; line-height: 1.5; }

.badge {
    align-self: flex-start; font-size: 0.75rem; padding: 4px 12px; border-radius: 20px;
    background: var(--secondary); color: var(--primary); font-weight: 800; font-family: monospace; border: 1px solid var(--primary);
}

/* --- HERO & TITEL --- */
.hero { 
    background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)), url('bilder/header.jpg') center/cover; 
    height: 300px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: white; 
    text-align: center; 
}

.hero h1 { 
    font-size: 3rem; 
    margin: 0; 
    text-shadow: 2px 2px 10px rgba(0,0,0,0.5); 
    text-transform: uppercase; 
}

.hero-subtitle { 
    font-size: 1.1rem; 
    font-weight: bold; 
    letter-spacing: 1px; 
    margin-bottom: 5px; 
}

.page-title { 
    text-align: center; 
    padding: 60px 0 20px; 
    text-transform: uppercase; 
    color: var(--primary); 
    letter-spacing: 1px; 
}

/* --- NEWS GRID (5 Spalten) --- */
.news-grid { 
    display: grid; 
    grid-template-columns: repeat(5, 1fr); 
    gap: 12px; 
    margin: 40px 0; 
}

.news-card { 
    aspect-ratio: 1/1; 
    background-size: cover; 
    background-position: center; 
    border-radius: 8px; 
    position: relative; 
    cursor: pointer; 
    overflow: hidden; 
    display: flex; 
    align-items: flex-end; 
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.news-card:hover { transform: scale(1.02); }

.news-card::before { 
    content: ''; 
    position: absolute; 
    inset: 0; 
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 70%); 
}

.news-content { position: relative; padding: 12px; color: white; width: 100%; }

.news-title { 
    font-size: 0.75rem; 
    font-weight: bold; 
    line-height: 1.2; 
    margin-bottom: 4px; 
    display: -webkit-box; 
    -webkit-line-clamp: 3; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
}

.news-date { font-size: 0.65rem; opacity: 0.8; }

/* --- SPARTEN & CARDS --- */
.sparte-card, .card { 
    background: var(--surface); 
    border-radius: 12px; 
    overflow: hidden; 
    display: flex; 
    margin-bottom: 40px; 
    border: 1px solid var(--border); 
    box-shadow: var(--shadow); 
}

.card { border-top: 6px solid var(--primary); padding: 25px; flex-direction: column; }

.sparte-img { width: 40%; min-height: 300px; background-size: cover; background-position: center; }
.sparte-text, .card-content { width: 60%; padding: 40px; display: flex; flex-direction: column; justify-content: center; }

.card.vertical { flex-direction: column; }
.card.vertical .card-content { width: 100%; }

.card-header {
    font-weight: 900;
    text-transform: uppercase;
    color: var(--primary);
    padding: 20px 40px;
    background: var(--secondary);
    border-bottom: 1px solid var(--border);
    font-size: 1.1rem;
}

/* --- TABELLEN --- */
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th { text-align: left; padding: 12px; background: var(--secondary); color: var(--primary); font-size: 0.7rem; text-transform: uppercase; }
td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 0.85rem; vertical-align: top; }

/* --- ADMIN SPEZIFISCH --- */
.report-item { background: var(--surface); border-bottom: 1px solid var(--border); transition: 0.2s; }
.report-summary { display: grid; grid-template-columns: 100px 140px 1fr 150px; padding: 15px 20px; cursor: pointer; align-items: center; }
.report-summary:hover { background: var(--secondary); }

.status-badge { font-size: 0.65rem; padding: 3px 8px; border-radius: 12px; font-weight: bold; text-align: center; display: inline-block; text-transform: uppercase; }
.status-NEU { background: var(--warning); color: white; }
.status-LIVE { background: var(--primary); color: white; }
.status-ARCHIV { background: #607d8b; color: white; }

.report-details { display: none; padding: 30px; background: var(--bg); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.report-item.open .report-details { display: block; }

.drag-handle { cursor: grab; color: var(--text-muted); padding-right: 10px; font-size: 1.2rem; user-select: none; }
.sortable-ghost { opacity: 0.4; background: var(--secondary) !important; }
.save-indicator { font-size: 0.7rem; font-weight: bold; color: var(--primary); display: none; margin-left: 10px; }

.status-pill { padding: 4px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; text-decoration: none; display: inline-block; }
.pill-public { background: #e8f5e9; color: #2e7d32; }
.pill-private { background: #eceff1; color: #455a64; }

/* --- FORMULAR ELEMENTE --- */
.label-head { font-size: 0.7rem; font-weight: bold; color: var(--primary); display: block; margin-top: 10px; text-transform: uppercase; }

form input, form select, form textarea { 
    width: 100%; padding: 14px; margin: 5px 0 15px; 
    border: 1px solid var(--border); border-radius: 8px; 
    background: var(--bg); color: var(--text); 
    box-sizing: border-box; font-family: inherit; font-size: 1rem; 
    transition: border-color 0.2s, box-shadow 0.2s;
}

form input:focus, form textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--secondary); }

.checkbox-group { 
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); 
    gap: 8px; margin: 10px 0 20px; background: var(--secondary); padding: 15px; border-radius: 4px; 
}
.checkbox-item { display: flex; align-items: center; font-size: 0.8rem; font-weight: bold; cursor: pointer; gap: 8px; }
.checkbox-item input { width: auto; margin: 0; }

.hp-field { display: none !important; }

/* --- KONTAKTE --- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 25px; margin: 40px 0; }

.contact-card { 
    background: var(--surface); padding: 30px; border-radius: 16px; 
    border: 1px solid var(--border); box-shadow: var(--shadow);
    text-align: center; transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column; justify-content: space-between;
}

.contact-card:hover { transform: translateY(-5px); border-color: var(--primary); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }

.contact-card h3 { margin: 15px 0 5px; color: var(--primary); font-size: 1.2rem; }
.contact-card .role { font-size: 0.75rem; font-weight: bold; text-transform: uppercase; color: var(--primary); opacity: 0.8; margin-bottom: 2px; display: block; }
.contact-card .dept { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; display: block; font-weight: 600; }
.contact-card .extra-info { font-size: 0.85rem; color: var(--text-muted); font-style: italic; margin-bottom: 20px; display: block; min-height: 1.2em; }

/* --- BUTTONS --- */
.btn, .btn-contact, .download-btn, .btn-submit { 
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary); color: white; padding: 12px 24px; 
    text-decoration: none; font-weight: bold; border: none; cursor: pointer; 
    transition: 0.3s; border-radius: 8px; text-transform: uppercase; font-size: 0.9rem;
    width: fit-content;
}

.btn-submit { width: 100%; padding: 14px; margin-top: 10px; }

.btn:hover, .btn-contact:hover, .download-btn:hover, .btn-submit:hover { background: var(--primary-light); transform: translateY(-2px); }

.btn-approve { background: var(--accent); }
.btn-archive { background: #607d8b; }
.btn-delete { color: var(--danger); text-decoration: none; font-size: 0.7rem; border: 1px solid var(--danger); padding: 3px 6px; border-radius: 4px; width: auto; background: transparent; }
.btn-delete:hover { background: var(--danger); color: white; transform: none; }

.btn-group { display: flex; gap: 12px; margin-top: 25px; border-top: 1px solid var(--border); padding-top: 20px; }

/* --- STATUS & LOADER --- */
.alert, .msg-info { padding: 18px; border-radius: 10px; margin-bottom: 30px; text-align: center; font-weight: bold; animation: slideDown 0.4s ease-out; }
.success, .msg-info { background: #e8f5e9; color: #1b5e20; border-left: 5px solid #1b5e20; }
.error { background: #ffebee; color: #c62828; border-left: 5px solid #c62828; }

@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

#loader { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.7); z-index: 9999; justify-content: center; align-items: center; flex-direction: column; font-weight: bold; color: var(--primary); }
.spinner { border: 4px solid #f3f3f3; border-top: 4px solid var(--primary); border-radius: 50%; width: 30px; height: 30px; animation: spin 1s linear infinite; margin-bottom: 10px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- SEKTIONEN & TRAINING --- */
.training-toggle { 
    background: var(--secondary); color: var(--primary); border: 1px solid var(--primary); 
    padding: 10px 15px; border-radius: 6px; cursor: pointer; font-weight: bold; 
    width: fit-content; margin-top: 15px; font-size: 0.85rem; transition: 0.2s;
}

.training-toggle:hover { background: var(--primary); color: white; }
.training-content { display: none; margin-top: 15px; overflow-x: auto; }
.training-content.open { display: block; }

.training-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.training-table th { text-align: left; background: var(--primary); color: white; padding: 8px; text-transform: uppercase; }
.training-table td { padding: 8px; border-bottom: 1px solid var(--border); }

.download-box { 
    background: var(--surface); border-radius: 12px; padding: 40px; 
    margin: 60px 0; border: 2px dashed var(--primary); text-align: center; box-shadow: var(--shadow); 
}

.info-section { background: var(--secondary); padding: 40px; border-radius: 15px; margin: 60px 0; border-left: 8px solid var(--primary); }
.maps-link { font-size: 0.8rem; color: var(--primary); text-decoration: none; font-weight: bold; margin-bottom: 10px; display: inline-block; }
.maps-link:hover { text-decoration: underline; }

/* --- MODAL & GALLERY --- */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 2000; padding: 20px; overflow-y: auto; backdrop-filter: blur(5px); }
.modal-content { background: var(--surface); max-width: 800px; margin: 40px auto; padding: 30px; border-radius: 12px; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.close { position: absolute; right: 20px; top: 10px; font-size: 2rem; cursor: pointer; color: var(--text-muted); }

.modal-gallery {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; 
    margin-top: 20px; border-top: 1px solid var(--border); padding-top: 20px;
}
.modal-gallery img, .img-preview img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; cursor: pointer; transition: transform 0.2s; }
.img-preview { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.img-preview img { height: 120px; width: auto; }
.modal-gallery img:hover, .img-preview img:hover { transform: scale(1.05); }

/* --- FOOTER --- */
footer { background: var(--footer-bg); color: var(--footer-text); padding: 40px 0; text-align: center; font-size: 0.8rem; border-top: 1px solid #222; }
footer a { color: var(--footer-text); text-decoration: none; margin: 0 10px; font-weight: bold; transition: color 0.2s; }
footer a:hover { color: var(--primary); text-decoration: underline; }

/* --- RESPONSIVENESS --- */
@media (max-width: 1000px) { .news-grid { grid-template-columns: repeat(3, 1fr); } }

@media (max-width: 800px) { 
    .sparte-card, .card { flex-direction: column; } 
    .sparte-img { width: 100%; height: 200px; min-height: auto; } 
    .sparte-text, .card-content { width: 100%; padding: 25px; } 
    .report-summary { grid-template-columns: 80px 1fr 50px; }
    .report-summary span:nth-child(2) { display: none; }
}

@media (max-width: 600px) { 
    .news-grid { grid-template-columns: repeat(2, 1fr); } 
    .hero h1 { font-size: 2rem; } 
    .nav-wrapper { flex-direction: column; height: auto; padding: 15px 0; gap: 10px; }
}