/* style.css - Zentrales Design für das CMS-System */

/* --- BASIS & TYPOGRAFIE --- */
:root {
    --primary-color: #0056b3;
    --primary-hover: #004494;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --bg-color: #f4f6f9;
    --text-color: #333333;
    --border-color: #cccccc;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

h1, h2, h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.container {
    max-width: 900px;
    margin: 30px auto;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* --- NAVIGATION --- */
nav {
    background-color: #343a40;
    padding: 10px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.2s;
}

nav a:hover, nav a.active {
    background-color: var(--primary-color);
}

.logout-btn {
    background-color: var(--danger-color);
    margin-left: auto; /* Schiebt Logout nach rechts */
}

/* --- FORMULARE --- */
fieldset {
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
    background-color: #fafafa;
}

legend {
    font-weight: bold;
    color: var(--primary-color);
    padding: 0 10px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

input[type="text"], 
input[type="email"], 
input[type="password"], 
input[type="date"], 
input[type="datetime-local"], 
select, 
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 86, 179, 0.2);
}

/* --- BUTTONS --- */
button, .btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    text-decoration: none;
    transition: background-color 0.2s;
}

button:hover, .btn:hover {
    background-color: var(--primary-hover);
}

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

th, td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
}

th {
    background-color: #e9ecef;
    color: #495057;
}

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

/* --- MELDUNGEN --- */
.msg-success { color: var(--success-color); font-weight: bold; padding: 10px; background: #e8f5e9; border-radius: 4px; margin-bottom: 15px;}
.msg-error { color: var(--danger-color); font-weight: bold; padding: 10px; background: #ffebee; border-radius: 4px; margin-bottom: 15px;}

/* =========================================
   MOBILE OPTIMIERUNG (SMARTPHONES & TABLETS)
   ========================================= */
@media (max-width: 768px) {
    
    /* Außenabstände der Hauptcontainer verkleinern, um Platz zu sparen */
    .container {
        margin: 15px auto !important;
        padding: 15px !important;
    }

    /* Schriften leicht anpassen für bessere mobile Lesbarkeit */
    body {
        font-size: 16px; 
    }
    
    h1 { font-size: 1.6em; }
    h2 { font-size: 1.3em; }

    /* Dashboard-Kacheln auf dem Handy untereinander statt nebeneinander */
    .dashboard-grid {
        grid-template-columns: 1fr; 
        gap: 15px;
    }

    /* Tabellen (im Dashboard) horizontal scrollbar machen, damit sie das Layout nicht sprengen */
    .table-custom {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap; /* Verhindert hässliche Zeilenumbrüche in kleinen Spalten */
    }

    /* Bilder im Lese-Modus maximal auf Bildschirmbreite begrenzen */
    .bild-container img, .galerie-edit-item img {
        width: 100%;
        height: auto;
    }

    /* Navigation / Buttons besser antippbar machen (Touch-Target) */
    .btn-dash, .btn-sm, .btn-weiterlesen {
        padding: 10px 15px;
        margin-bottom: 8px;
        display: inline-block;
    }
    
    /* Suchformular auf der Startseite anpassen */
    .search-form {
        flex-direction: column;
    }
    .btn-search, .btn-reset {
        width: 100%;
        margin-top: 5px;
    }
}
@media (max-width: 768px) {
    /* ... deine bisherigen Handy-Regeln ... */

    /* Formularelemente für Smartphones flexibel machen */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box; /* Verhindert, dass der Rahmen das Feld künstlich verbreitert */
    }
}
/* =========================================
   LIGHTBOX FÜR BILDERGALERIE
   ========================================= */

.lightbox {
    display: none; 
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); 
    
    /* Zurück auf center für ein stabiles Layout */
    align-items: center; 
    justify-content: center; 
    flex-direction: column;
    
    /* DER TRICK: Ein unsichtbarer Puffer unten schiebt das Bild sanft nach oben */
    padding-bottom: 80px; 
}

.lightbox img {
    max-width: 90%;
    max-height: 80vh;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border-radius: 4px;
    animation: fadeIn 0.3s ease; 
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}
.lightbox-close:hover { color: #ccc; }

/* Pfeile ebenfalls minimal anheben, damit sie mittig zum Bild bleiben */
.lightbox-prev, .lightbox-next {
    position: absolute;
    top: 45%; /* Vorher 50%, jetzt etwas weiter oben ausgerichtet */
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    font-size: 30px;
    padding: 15px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.3); }

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

@media (max-width: 600px) {
    .lightbox-prev, .lightbox-next { padding: 10px; font-size: 20px; }
    .lightbox-close { top: 10px; right: 20px; }
    /* Am Smartphone noch etwas mehr Puffer unten lassen für die Daumen-Erreichbarkeit und Browser-Menüleisten */
    .lightbox { padding-bottom: 120px; } 
}