/* --- assets/css/style.css --- */
/* OPTIMIZED & RESPONSIVE VERSION (FINAL) */

/* 0. GLOBAL RESET & BOX SIZING */
*, *::before, *::after {
    box-sizing: border-box;
}

/* 1. FONTS & GLOBALS */

/* Lokale Einbindung von Inter (Variable Font) */
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Montserrat/Inter-VariableFont_opsz,wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../fonts/Montserrat/Inter-Italic-VariableFont_opsz,wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

/* Lokale Einbindung von Montserrat (Variable Font) */
@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat/Montserrat-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat/Montserrat-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

:root {
    /* Main Colors */
    --primary-color: #5990BA;
    --primary-hover: #4a789a;
    --secondary-color: #6c757d;
    --secondary-hover: #5a6268;
    
    /* Backgrounds & Text */
    --bg-light: #f4f7f6;
    --bg-white: #ffffff;
    --text-light: #FFFFFF;
    --text-dark: #333333;
    --text-muted: #666666;
    
    /* Borders & Shadows */
    --border-color: #e0e0e0;
    --border-light: #eeeeee;
    --shadow-color: rgba(0, 0, 0, 0.1);
    
    /* Feedback */
    --success-bg: #d4edda; --success-text: #155724; --success-border: #c3e6cb;
    --error-bg: #f8d7da;   --error-text: #721c24;   --error-border: #f5c6cb;

    /* Fonts */
    --font-base: 'Inter', sans-serif;
    --font-heading: 'Montserrat', sans-serif;
}

html, body {
    margin: 0; padding: 0;
    font-family: var(--font-base);
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

body {
    display: flex; flex-direction: column;
    min-height: 100vh;
}

/* Links */
a { color: var(--primary-color); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

/* 2. HEADER & LOGO */
.site-header {
    background-color: var(--text-dark);
    color: var(--text-light);
    padding: 1rem 2rem;
    display: flex; align-items: center;
    box-shadow: 0 2px 5px var(--shadow-color);
    transition: all 0.2s;
}

.site-header h1 {
    margin: 0; flex: 1; text-align: right;
    font-size: 1.4rem; font-weight: 600;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
}

.logo-container a {
    color: var(--text-light);
    font-size: 1.5rem; font-weight: 700;
    font-family: var(--font-heading);
    letter-spacing: 1px;
}
.logo-container a:hover { color: #ddd; text-decoration: none; }

/* 3. USER BAR & SEITEN-HEADER */
.user-bar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.9rem; color: var(--text-muted);
}

.page-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

/* 4. LAYOUT CONTAINER & CARDS */
.page-container {
    flex: 1; width: 100%; max-width: 1300px;
    margin: 2rem auto; padding: 0 2rem;
    /* Box-Sizing ist jetzt global gesetzt, daher hier redundant aber sicher */
}

.card {
    background-color: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
    padding: 2rem; margin-bottom: 2rem;
}

.card h2 {
    margin: 0 0 1.5rem 0; padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--bg-light);
    font-family: var(--font-heading);
    color: var(--text-dark);
    font-size: 1.4rem;
}

/* 5. DASHBOARD NAVIGATION */
.dashboard-container {
    flex: 1; display: flex;
    justify-content: center; align-items: flex-start;
    padding-top: 3rem; 
}

.main-navigation {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem; margin-top: 1.5rem;
}

.nav-button {
    background-color: var(--primary-color);
    color: var(--text-light);
    border-radius: 8px; padding: 2rem;
    font-size: 1.1rem; font-weight: 600;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; text-align: center;
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.nav-button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-4px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
    text-decoration: none; color: white;
}
.nav-button i { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.9; }

/* 6. FORMULARE */
.form-container { max-width: 100%; }
.form-grid { display: grid; gap: 1rem; }

.form-group-split {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
}

.form-group { margin-bottom: 0.5rem; text-align: left; }
.form-group label {
    display: block; font-weight: 600;
    margin-bottom: 0.5rem; color: #444;
    font-size: 0.95rem;
}

/* Inputs, Textareas & Selects */
.form-group input, 
.form-group textarea,
.form-group select {
    width: 100%; padding: 0.75rem;
    border: 1px solid #ccc; border-radius: 5px;
    font-family: var(--font-base); font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #fff;
}

.form-group select {
    cursor: pointer;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(89, 144, 186, 0.15);
    outline: none;
}

.form-actions { margin-top: 2rem; display: flex; justify-content: flex-end; }

/* 7. BUTTONS & ACTIONS */
.button-primary, .button-secondary {
    border: none; padding: 0.8rem 1.5rem;
    border-radius: 5px; cursor: pointer;
    transition: background 0.2s;
    display: inline-flex; align-items: center; gap: 0.5rem;
    text-decoration: none; color: white;
}

.button-primary {
    background-color: var(--primary-color);
    font-size: 1rem; font-weight: 600;
}
.button-primary:hover { background-color: var(--primary-hover); }

.button-secondary {
    background-color: var(--secondary-color);
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem; font-weight: 500;
}
.button-secondary:hover { background-color: var(--secondary-hover); }

.button-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 4px;
    color: var(--primary-color); text-decoration: none;
    transition: background 0.2s, color 0.2s;
    margin-left: 0.25rem;
}
.button-icon:hover { background-color: rgba(89, 144, 186, 0.1); }
.button-icon.delete { color: var(--error-text); }
.button-icon.delete:hover { background-color: var(--error-bg); }

/* 8. TABELLEN */
.table-wrapper { overflow-x: auto; }

.data-table {
    width: 100%; border-collapse: collapse;
    margin-top: 1rem; background-color: #fff;
    font-size: 0.95rem;
}

.data-table thead th {
    background-color: var(--primary-color); color: white;
    text-align: left; padding: 0.8rem 1rem;
    font-weight: 600; font-family: var(--font-heading);
    border-bottom: 2px solid var(--primary-hover);
}

.data-table tbody td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
.data-table tbody tr:hover { background-color: #f9f9f9; }

/* Actions Column (Right aligned) */
.data-table th:last-child,
.data-table td:last-child {
    text-align: right; white-space: nowrap;
}
.data-table th:last-child { width: 1%; }

/* Dateinamen Umbruch (für Backups etc.) */
.filename-cell {
    word-break: break-all;
    min-width: 120px;
}

/* 9. LOGIN & ALERTS */
body.login-page {
    justify-content: center; align-items: center;
    background-color: var(--bg-light);
}
.login-card {
    width: 100%; max-width: 400px; padding: 2.5rem;
    background: #fff; border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.alert-error, .feedback.error, .feedback.success {
    padding: 1rem; border-radius: 5px; margin-bottom: 1.5rem;
}
.alert-error, .feedback.error {
    background-color: var(--error-bg); color: var(--error-text);
    border: 1px solid var(--error-border); text-align: center;
}
.feedback.success {
    background-color: var(--success-bg); color: var(--success-text);
    border: 1px solid var(--success-border);
}

/* 10. STATUS BADGES */
.status-badge {
    display: inline-block; padding: 0.25em 0.6em;
    font-size: 0.75em; font-weight: 600;
    border-radius: 4px; color: #fff;
    vertical-align: middle; text-transform: uppercase;
    letter-spacing: 0.05em;
}
.status-badge.status-aktiv { background-color: #28a745; }
.status-badge.status-inaktiv { background-color: #6c757d; }
.status-badge.status-ausgetreten { background-color: #17a2b8; }
.status-badge.status-geloescht { background-color: #dc3545; }

/* 11. FOOTER */
.site-footer {
    background-color: var(--text-dark); color: var(--text-light);
    padding: 1.5rem 2rem; margin-top: auto; 
    font-size: 0.9rem;
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 1rem;
    font-family: var(--font-heading);
    border-top: 3px solid var(--primary-color);
}
.site-footer p { margin: 0.25rem 0; opacity: 0.9; }

/* Footer Links global (immer weiß/hell im dunklen Footer) */
.site-footer a {
    color: var(--text-light) !important;
    text-decoration: none;
    border-bottom: 1px dotted rgba(255,255,255,0.5);
}
.site-footer a:hover {
    color: #fff !important;
    border-bottom: 1px solid #fff;
}

.font-controls {
    display: flex; gap: 0.5rem; align-items: center;
    background: rgba(255,255,255,0.1);
    padding: 0.25rem 0.5rem; border-radius: 20px;
}
.font-control-button {
    color: var(--text-light); text-decoration: none;
    font-size: 1rem; padding: 0.4rem 0.6rem;
    border-radius: 5px; opacity: 0.7;
    transition: opacity 0.2s, background-color 0.2s;
}
.font-control-button:hover, .font-control-button:focus {
    opacity: 1; background-color: rgba(255, 255, 255, 0.2); outline: none;
}

/* --- 12. MEDIA QUERY: TABLET & KLEINE LAPTOPS (Galaxy Tab A9 etc.) --- */
@media (min-width: 769px) and (max-width: 1400px) {
    /* Zoom-Effekt für Tablets mit hoher Auflösung aber kleinen Screens */
    html { font-size: 115%; }

    .page-container {
        max-width: 96%; /* Bildschirm besser ausnutzen */
        padding: 0 1.5rem;
    }

    .header-logo-img { height: 80px !important; }

    /* Touch-Ziele verbessern */
    .nav-button, .button-primary, .button-secondary { cursor: pointer; }
    
    .font-controls {
        background: rgba(255,255,255,0.15);
        border-radius: 50px;
        padding: 4px 10px;
    }
    .font-control-button {
        font-size: 1.4rem !important;
        padding: 8px 15px !important;
    }
}

/* --- 13. MEDIA QUERY: SMARTPHONES (Mobile Overrides) --- */
@media (max-width: 768px) {
    
    /* GLOBAL: Abstände reduzieren */
    .page-container { 
        padding: 0 1rem; 
        margin-top: 1rem;
    }
    .card { padding: 1.25rem; }

    /* HEADER MOBILE */
    .site-header { padding: 1rem; height: auto; }

    .header-inner-row {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.5rem !important;
        width: 100%;
    }

    .header-logo-img {
        height: auto !important; max-height: 80px; 
        width: auto !important; max-width: 100% !important;
        margin-bottom: 0.5rem; object-fit: contain;
    }

    .header-separator { display: none !important; }

    .site-header h1 {
        text-align: center !important; width: 100%;
        font-size: 1.2rem !important; line-height: 1.3;
        white-space: normal !important; 
    }

    /* DASHBOARD (Index) MOBILE */
    .dashboard-header-row {
        flex-direction: column !important;
        align-items: center !important; 
        text-align: center; gap: 1.5rem !important;
    }
    .dashboard-actions {
        width: 100%; flex-direction: column; gap: 10px !important;
    }
    .dashboard-haus-badge { width: 100%; justify-content: center; }
    .dashboard-logout-btn {
        width: 100%; justify-content: center;
        padding: 12px !important;
        background-color: #fff !important;
        border: 1px solid #dc3545 !important;
        color: #dc3545 !important;
    }
    .dashboard-logout-btn span { display: inline !important; }

    /* NAVIGATION GRID -> LISTE (Mobile) */
    .main-navigation {
        grid-template-columns: 1fr !important;
        gap: 0.8rem !important;
    }
    .nav-button {
        flex-direction: row !important; /* Nebeneinander */
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: left !important;
        padding: 1rem 1.2rem !important;
        min-height: auto !important;
    }
    .nav-button i {
        margin-bottom: 0 !important; margin-right: 1rem !important;
        font-size: 1.5rem !important; width: 30px; text-align: center;
    }
    .nav-button span:first-of-type { font-size: 1rem !important; font-weight: 600; }
    .nav-button span:last-of-type { display: block; margin-top: 2px !important; font-size: 0.75rem !important; }

    /* TABELLEN OPTIMIERUNG */
    .col-hide-mobile, .col-size { display: none; }
    .actions { white-space: nowrap; }
    .data-table th, .data-table td { padding: 10px 5px; font-size: 0.9rem; }
    
    /* Buttons in Tabellen (nur Icon) */
    .btn-text { display: none; }

    /* PAGE HEADER ACTIONS (Buttons stapeln) */
    .page-header-actions {
        flex-direction: column-reverse; /* "Neu" Button nach OBEN */
        gap: 15px; align-items: stretch; margin-bottom: 1.5rem;
    }
    .page-header-actions a, .page-header-actions button {
        width: 100%; justify-content: center;
        display: flex; align-items: center; padding: 12px;
    }

    /* FORMS */
    .form-group-split { grid-template-columns: 1fr; gap: 1rem; }

    /* FOOTER MOBILE */
    .site-footer {
        flex-direction: column; text-align: center;
        gap: 1.5rem; padding-bottom: 2rem;
    }
    .footer-block-mobile { display: block !important; width: 100%; margin-bottom: 0.25rem; font-size: 1.05rem; }
    .footer-address-row { display: inline-block; color: rgba(255,255,255,0.8); }
    .footer-separator, .footer-separator-small { display: none !important; }
    .footer-separator-small + * { margin-left: 0.5rem; } /* Leerzeichen Ersatz */
    .footer-contact-block { display: block !important; margin-bottom: 0.5rem; width: 100%; }
    .footer-contact-block:last-child { margin-bottom: 0; }

    /* FONT CONTROLS (Kapsel-Look) */
    .font-controls {
        margin-top: 1.5rem; padding: 4px;
        background: rgba(255,255,255,0.15); 
        border-radius: 50px; display: inline-flex; gap: 0 !important; 
    }
    .font-control-button {
        background-color: transparent !important; border: none !important;
        font-size: 1.6rem !important; color: #fff !important;
        padding: 12px 25px !important; margin: 0 !important;
    }
    .font-control-button:active {
        background-color: rgba(255,255,255,0.2) !important;
        transform: scale(0.95); border-radius: 50px;
    }
}