/* style.css */

/* === GRUNDEINSTELLUNGEN & TYPOGRAFIE === */
* { 
    box-sizing: border-box; 
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; 
    background-color: #f4f7f9; 
    color: #333; 
    margin: 0; 
    padding: 20px; 
    line-height: 1.6; 
}

.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    background-color: #ffffff; 
    padding: 25px 40px; 
    border-radius: 8px; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); 
}

h1, h2, h3, h4 { 
    color: #2c3e50; 
    border-bottom: 2px solid #eef2f5; 
    padding-bottom: 10px; 
    margin-top: 20px; 
    margin-bottom: 20px; 
}

h1 { font-size: 2em; }
h2 { font-size: 1.6em; }
h4 { border-bottom: none; }

hr { 
    border: none; 
    border-top: 1px solid #e0e0e0; 
    margin: 30px 0; 
}

/* --- Navigation (menu.php) --- */
nav {
    display: flex;
    justify-content: space-between; /* Haupt- und Benutzerlinks auseinander schieben */
    align-items: center;
    flex-wrap: wrap; /* Erlaubt Umbruch bei schmalen Bildschirmen */
    gap: 10px;
    background-color: #2c3e50;
    padding: 10px;
    margin-bottom: 25px;
    border-radius: 5px;
}

.nav-links, .nav-user {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-user {
    color: white;
}

.nav-user span {
    margin-right: 15px;
}

nav a {
    color: #ffffff;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-weight: 500;
    display: inline-block; /* Stellt sicher, dass Padding korrekt angewendet wird */
}

nav a:hover {
    background-color: #34495e;
}

.nav-link-verwaltung {
    background-color: #c0392b;
}
.nav-link-verwaltung:hover {
    background-color: #e74c3c;
}

.nav-link-logout {
    background-color: #6c757d;
}
.nav-link-logout:hover {
    background-color: #5a6268;
}




/* === FORMULARE & BUTTONS === */
label { 
    display: block; 
    font-weight: bold; 
    margin-bottom: 5px; 
    color: #555; 
}

input[type="text"], input[type="number"], input[type="password"], input[type="file"], select, textarea { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
    font-size: 1em; 
    margin-bottom: 15px; 
}

textarea { 
    min-height: 60px; 
    resize: vertical; 
}

button, .button, .export-button, .add-button { 
    background-color: #3498db; 
    color: white; 
    padding: 10px 20px; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 1em; 
    font-weight: bold; 
    text-decoration: none; 
    display: inline-block; 
    transition: background-color 0.3s; 
}

button:hover, .button:hover, .export-button:hover, .add-button:hover { 
    background-color: #2980b9; 
}

.filter-form, .bewertung-form, .admin-section, .login-container {
    margin-bottom: 25px;
}
.filter-form select, .filter-form button {
    margin-top: 10px;
}

/* === TABELLEN === */
table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
}

thead th { 
    background-color: #eef2f5; 
    color: #34495e; 
    padding: 12px 15px; 
    text-align: left; 
    font-weight: 600; 
}

tbody td, tfoot td { 
    padding: 12px 15px; 
    border-bottom: 1px solid #e0e0e0; 
}

tbody tr:nth-child(even) { 
    background-color: #f8f9fa; 
}

tbody tr:hover { 
    background-color: #f1f1f1; 
}

tfoot { 
    font-weight: bold; 
    background-color: #f8f9fa; 
    border-top: 2px solid #34495e; 
}

/* Tabellen-spezifische Stile */
.col-10 { width: 10%; }
.col-15 { width: 15%; }
.col-18 { width: 18%; }
.col-30 { width: 30%; }

.komplex-header td { 
    background-color: #34495e; 
    color: white; 
    font-weight: bold; 
    font-size: 1.1em; 
}

.subtotal-row { 
    background-color: #e9ecef !important; 
    font-style: italic; 
    font-weight: 500; 
}

.subtotal-row td { 
    color: #2c3e50; 
}

/* === NACHRICHTEN & HINWEISE === */
.msg-success, .msg-error, .msg-info {
    padding: 10px 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    text-align: center;
}
.msg-success { color: #155724; background-color: #d4edda; border-color: #c3e6cb; }
.msg-error { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }
.msg-info { color: #0c5460; background-color: #d1ecf1; border-color: #bee5eb; }

.no-results { 
    background-color: #fff3cd; 
    color: #856404; 
    padding: 15px; 
    border: 1px solid #ffeeba; 
    border-radius: 4px; 
    text-align: center; 
}

.count-badge { 
    font-size: 0.8em; 
    color: #6c757d; 
    margin-left: 10px; 
    background-color: #e9ecef; 
    padding: 2px 6px; 
    border-radius: 8px; 
}

.faktor-badge {
    font-size: 0.85em;
    color: #6c757d;
    font-style: italic;
}

/* === LOGIN SEITE === */
.login-container { 
    max-width: 400px; 
    margin: 100px auto; 
    padding: 40px; 
    background: white; 
    border-radius: 8px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); 
}

.login-container h1 { 
    text-align: center; 
    margin-bottom: 25px; 
}

.login-container button { 
    width: 100%; 
}

/* === VERWALTUNGSSEITE === */
.admin-section { 
    border: 1px solid #ddd; 
    padding: 25px; 
    margin-bottom: 25px; 
    border-radius: 8px; 
    background-color: #fff;
}
.admin-section h2, .admin-section h3 { 
    margin-top: 0; 
}

.data-list { 
    list-style-type: none; 
    padding: 0; 
}
.data-list li { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 8px; 
    border-bottom: 1px solid #f0f0f0; 
}
.data-list li:nth-child(even) { 
    background-color: #f9f9f9; 
}

.action-buttons { 
    display: flex; 
    gap: 5px; 
}
.action-buttons a, .delete-form button { 
    font-size: 12px; 
    padding: 5px 10px; 
    margin: 0; 
    text-decoration: none; 
    color: white; 
    border-radius: 3px; 
    border: none; 
    cursor: pointer; 
}

a.edit-button { background-color: #ffc107; color: #212529; }
a.edit-button:hover { background-color: #e0a800; }

.delete-form button { background-color: #dc3545; }
.delete-form button:hover { background-color: #c82333; }

.add-form, .edit-form { 
    margin-top: 20px; 
    padding: 20px; 
    background-color: #f8f9fa; 
    border: 1px solid #dee2e6; 
    border-radius: 5px; 
}
.edit-form { border-color: #ffc107; }

.add-form button { background-color: #28a745; }
.add-form button:hover { background-color: #218838; }

.edit-form button { background-color: #007bff; }
.edit-form button:hover { background-color: #0069d9; }

a.cancel-link { margin-left: 10px; }

.add-form input, .edit-form input, .edit-form select { 
    margin-right: 10px; 
    margin-bottom: 10px;
}
.add-form input[type="text"], .add-form input[type="number"] {
    display: inline-block;
    width: auto; /* override default 100% width */
}

a.btn-add-user {
    display: inline-block;
    margin-bottom: 15px;
    background-color: #17a2b8;
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 4px;
}
a.btn-add-user:hover {
    background-color: #138496;
}

.danger-zone {
    background-color: #fff3cd; 
    border: 1px solid #ffeeba; 
    padding: 15px; 
    margin-bottom: 20px; 
    border-radius: 5px;
}
.danger-zone h4 { color: #856404; margin-top:0; }
.danger-zone p { margin: 0 0 10px 0; }
.danger-zone button { 
    background-color: #dc3545; 
    color: white; 
    width: 100%; 
    padding: 10px; 
    font-size: 1.1em; 
    font-weight: bold; 
}
.danger-zone button:hover { background-color: #c82333; }

/* === BERICHTE & EXPORT === */
.export-container { 
    padding: 15px; 
    background-color: #f8f9fa; 
    border: 1px solid #eee; 
    margin-bottom: 20px; 
    border-radius: 5px; 
}

.export-button.export-pivot {
    background-color: #fd7e14;
}
.export-button.export-pivot:hover {
    background-color: #e67311;
}

/* === RESPONSIVE DESIGN FÜR MOBILGERÄTE === */
@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 16px; /* Bessere Lesbarkeit auf Mobilgeräten */
    }

    .container {
        padding: 15px;
    }

    h1 { font-size: 1.8em; }
    h2 { font-size: 1.4em; }

    /* --- Mobile Navigation --- */
    nav {
        flex-direction: column; /* Stellt Haupt- und Benutzerlinks untereinander dar */
        align-items: stretch; /* Streckt die Elemente auf die volle Breite */
    }

    .nav-links, .nav-user {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }

    nav a {
        text-align: center;
        width: 100%; /* Volle Breite für Links */
        box-sizing: border-box; /* Padding wird in die Breite einbezogen */
    }

    .nav-user {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid #4a627a; /* Trennlinie */
    }

    .nav-user span {
        margin-bottom: 10px;
        text-align: center;
    }

    /* --- Formulare anpassen --- */
    .filter-form, .bewertung-form {
        display: flex;
        flex-direction: column;
    }

    .filter-form select, .filter-form button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px; /* Abstand zwischen den Elementen */
    }

    .add-form input[type="text"], .add-form input[type="number"] {
        width: 100%; /* Volle Breite für Eingabefelder */
        display: block;
    }

    /* --- Tabellen für kleine Bildschirme --- */
    table, thead, tbody, th, td, tr {
        display: block; /* Macht die Tabelle zu einem "block" Element */
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
    }

    td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%; /* Platz für das Label schaffen */
        text-align: right; /* Daten rechts ausrichten */
    }

    td:before {
        /* Fügt den Spaltenkopf als Label hinzu */
        /*position: absolute;*/
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        content: attr(data-label); /* Holt den Text aus dem data-label Attribut */
    }
    
    /* Spezifische Anpassungen für td:before, falls nötig */
    .bewertung-form td:before { content: none; } /* Bei Bewertungsformular nicht nötig */


    /* --- Verwaltungs- und Aktionsbuttons --- */
    .data-list li {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-buttons {
        width: 100%;
        margin-top: 10px;
    }

    .action-buttons a, .delete-form button {
        flex-grow: 1;
        text-align: center;
    }
}
