/* static/style.css */
body {
    font-family: sans-serif;
    margin: 0;
    background-color: #f4f4f4;
    color: #333;
}

nav {
    background-color: #333;
    color: white;
    padding: 1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
nav a {
    color: white;
    text-decoration: none;
    margin: 0 10px;
}
nav a:hover {
    text-decoration: underline;
}
.badge {
    background-color: #dc3545;
    color: white;
    padding: 2px 6px;
    border-radius: 50%;
    font-size: 0.75em;
    font-weight: bold;
    margin-left: 3px;
    vertical-align: top;
}
nav span {
    margin: 0 10px;
}

.container {
    width: 95%;
    max-width: 1800px;
    margin: 20px auto;
    padding: 20px;
    background-color: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.flash {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
}
.flash.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash.danger { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.flash.info { background-color: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.flash.warning { background-color: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

h2 {
    color: #333;
    text-align: center;
    margin-bottom: 20px;
}

form div {
    margin-bottom: 10px;
}
form label {
    display: block;
    margin-bottom: 5px;
}
form input[type="text"],
form input[type="password"],
form input[type="number"],
form input[type="email"], 
form select,
form textarea {
    width: calc(100% - 22px); 
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box; 
}
form input[type="checkbox"] {
    margin-right: 5px;
    vertical-align: middle;
}
form button, .button, .button-small, .button-small-danger, .button-link {
    display: inline-block;
    padding: 8px 12px;
    margin: 5px 5px 5px 0;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    border: none; 
}
.button, form button[type="submit"] { background-color: #007bff; color: white; }
form button[type="submit"]:hover, .button:hover { background-color: #0056b3; }


.dienstplan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.dienstplan-header a {
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
}
.dienstplan-header a:hover {
    background-color: #e9ecef;
}


.dienstplan-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.dienstplan-table th, .dienstplan-table td {
    border: 1px solid #bbb;
    padding: 1px; /* Extrem platzsparend */
    text-align: center;
    font-size: 0.85em; 
    vertical-align: top;
    height: auto; /* Dynamische Höhe statt fester 120px */
    position: relative; 
}
.dienstplan-table th {
    background-color: #f0f0f0;
    font-weight: bold;
}
.dienstplan-table td:first-child, 
.dienstplan-table th:first-child { 
    text-align: left;
    font-weight: bold;
    width: 160px; 
    min-width: 160px;
    background-color: #e9ecef;
    position: sticky;
    left: 0;
    z-index: 10; 
}
.dienstplan-table th:first-child {
    z-index: 11; 
}

.dienstplan-table th.day-header,
.dienstplan-table td.shift-cell {
    min-width: 85px;
}

.weekend {
    background-color: #f8f9fa !important;
}

.day-header.holiday {
    background-color: #ffebcc !important; 
    color: #8c5300;
    font-weight: bold;
}
td.holiday-bg { 
    background-color: #fff9f2 !important; 
}
td.shift-cell.holiday-bg[style*="background-color"] { }

.total-hours {
    font-weight: bold;
    background-color: #e9ecef;
    position: sticky;
    right: 0; 
    z-index: 10;
}
.dienstplan-table th:last-child { 
     position: sticky;
     right: 0;
     z-index: 11;
     background-color: #f0f0f0; 
}

.shift-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; 
    box-sizing: border-box;
    padding: 2px 0;
    width: 100%; 
}

.shift-select {
    width: 90%;
    max-width: 80px; /* Verhindert, dass es zu breit wird */
    padding: 3px;
    font-size: 0.9em; /* Etwas kleiner für mehr Platz */
    margin-bottom: 2px; /* Weniger Abstand */
    box-sizing: border-box;
}

/* Styling für Zeit-Inputs UNTEREINANDER */
.shift-content .time-inputs-container {
    display: flex; /* Wird von JS auf 'flex' gesetzt, wenn sichtbar */
    flex-direction: column; /* Hauptänderung: Elemente untereinander */
    align-items: center; 
    width: 100%; 
    margin-top: 2px; /* Weniger Abstand */
    margin-bottom: 2px; /* Weniger Abstand */
    gap: 1px; /* Sehr kleiner Abstand zwischen Start, Separator, Ende */
}

.shift-content .time-input {
    width: 90%; /* Breite an Container anpassen */
    max-width: 75px; /* Maximale Breite */
    padding: 2px; 
    font-size: 0.8em; /* Kleinere Schrift für Zeit */
    border: 1px solid #ccc;
    border-radius: 3px;
    box-sizing: border-box;
    text-align: center;
}

.shift-content .time-separator {
    /* Das "-" Zeichen ist bei untereinander Anordnung nicht mehr ideal. */
    /* Man könnte es weglassen oder durch Labels ersetzen. */
    /* Fürs Erste machen wir es sehr klein oder unsichtbar */
    display: none; /* Oder font-size: 0; height: 0; */
    /* padding: 0 2px; */
    /* font-weight: normal; */
}

.shift-content .time-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.1rem rgba(0, 123, 255, 0.25); /* Noch kleinerer Schatten */
    outline: none;
}


.custom-hours-input-container {
    margin-top: 2px; /* Weniger Abstand */
    margin-bottom: 2px; /* Weniger Abstand */
    width: 90%;
}
.custom-hours-input {
    width: 90% !important; /* Volle Breite des Containers */
    max-width: 65px;
    padding: 3px;
    font-size: 0.85em; /* Etwas größer als Zeit-Input */
    text-align: center;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 3px;
}
.shift-display-hours {
    font-size: 0.8em; /* Kleinere Schrift für Stundenanzeige */
    color: #333;
    margin-top: 1px; /* Weniger Abstand */
    min-height: 1em; 
}

.shift-display-fixed { font-weight: bold; margin-bottom: 2px; font-size: 0.9em; }
.time-display-fixed { display: block; font-size: 0.75em; color: #555; margin-top: 1px;}
.hours-display-fixed { display: block; font-size: 0.8em; color: #333; font-weight: bold; margin-top:1px;}


.info-markings-placeholder {
    position: absolute; 
    top: 2px;           
    right: 2px;         
    display: flex;      
    align-items: center;
}
.info-markings-placeholder .info-marking-indicator {
    display: inline-block;
    width: 16px; height: 16px; line-height: 16px; text-align: center;
    border-radius: 50%; margin-left: 3px; cursor: pointer;
    font-weight: bold; color: white; font-size: 0.9em;
    border: none; padding: 0;
}
.info-marking-indicator.status-pending { background-color: orange; }
.info-marking-indicator.status-approved { background-color: green; }
.info-marking-indicator.status-rejected { background-color: red; }

.add-info-marking-btn {
    background: #6c757d; color: white; border: none; border-radius: 50%;
    width: 18px; height: 18px; line-height: 16px; font-size: 12px;
    cursor: pointer; padding: 0;
}
.add-info-marking-btn:hover { background: #545b62; }

.legend { margin-top: 20px; padding: 10px; border: 1px solid #ccc; background-color: #f9f9f9; text-align: left; }
.legend h4 { margin-top: 0; margin-bottom: 10px;}
.legend-item { display: inline-block; padding: 4px 8px; margin: 3px; border-radius: 4px; font-size: 0.9em; border: 1px solid #ccc;}
.holiday-legend { background-color: #ffebcc; color: #8c5300;}

.coverage-row td { font-size: 0.75em; padding: 2px; height: auto; vertical-align: middle; line-height: 1.2;}
.needed-shift { display: block; padding: 1px 3px; margin: 1px auto; border-radius: 3px; background-color: #f8d7da; color: #721c24; font-weight: bold; width: fit-content;}
.needed-ok { color: green; font-size: 1.3em; font-weight: bold;}

.admin-table { width: 100%; border-collapse: collapse; margin-top: 20px;}
.admin-table th, .admin-table td { border: 1px solid #ddd; padding: 10px; text-align: left; font-size: 0.9em;}
.admin-table th { background-color: #f2f2f2;}

.button-small { padding: 6px 10px; font-size: 0.85em; background-color: #6c757d; color:white; }
.button-small:hover { background-color: #545b62; }
.button-small-danger { padding: 6px 10px; font-size: 0.85em; background-color: #dc3545; color:white; }
.button-small-danger:hover { background-color: #c82333; }
.button-link { background-color: transparent; color: #007bff; border: 1px solid #007bff; padding: 7px 11px; }
.button-link:hover { background-color: #e7f3ff; }

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: #fefefe; margin: 10% auto; padding: 25px; border: 1px solid #888; width: 90%; max-width: 550px; border-radius: 8px; position: relative; box-shadow: 0 5px 15px rgba(0,0,0,0.3);}
.close-modal-btn { color: #777; position: absolute; top: 10px; right: 15px; font-size: 32px; font-weight: bold; line-height: 1;}
.close-modal-btn:hover, .close-modal-btn:focus { color: #333; text-decoration: none; cursor: pointer;}
.modal-content h4 { margin-top: 0; margin-bottom: 15px; color: #333;}
.modal-content p { margin-bottom: 10px; font-size: 0.95em;}
#infoMarkingForm textarea, #addInfoMarkingForm textarea { width: calc(100% - 22px); margin-bottom: 15px; padding: 10px; border: 1px solid #ccc; border-radius: 4px; min-height: 70px;}
#addInfoMarkingForm button[type="submit"] { background-color: #28a745; }
#addInfoMarkingForm button[type="submit"]:hover { background-color: #218838;}
#updateMarkingStatusForm button[type="submit"] { background-color: #ffc107; color:black;}
#updateMarkingStatusForm button[type="submit"]:hover { background-color: #e0a800;}

#existingMarkingsListWhenAdding { margin-top: 20px; border-top: 1px solid #eee; padding-top: 15px;}
#existingMarkingsListWhenAdding h5 { margin-top: 0; margin-bottom: 10px; font-size: 1em; color: #555;}
#existingMarkingsListWhenAdding ul, #existingMarkingsUl { list-style-type: none; padding-left: 0; max-height: 150px; overflow-y: auto;}
#existingMarkingsListWhenAdding li, #existingMarkingsUl li { padding: 8px 5px; border-bottom: 1px solid #f0f0f0; font-size: 0.9em;}
#existingMarkingsListWhenAdding li:last-child, #existingMarkingsUl li:last-child { border-bottom: none; }
#existingMarkingsListWhenAdding li small, #existingMarkingsUl li small { display: block; color: #777; font-size: 0.85em; margin-top: 3px;}

/* Formulare & Admin Container */
.form-container, .admin-container {
    max-width: 600px;
    margin: 30px auto;
    padding: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.form-group {
    margin-bottom: 20px;
}

.row {
    display: flex;
    gap: 15px;
}
.col {
    flex: 1;
}

.btn {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}
.btn:hover { background-color: #0056b3; }

.btn-danger { background-color: #dc3545; }
.btn-danger:hover { background-color: #c82333; }

.btn-small { padding: 5px 10px; font-size: 0.85em; }

/* Edit Lock Warning */
.lock-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
}

footer { text-align: center; padding: 1.5em; background-color: #333; color: white; margin-top: 30px;}

/* Navigation Styles */
nav {
    display: flex;
    justify-content: space-between;
    background: #333;
    color: white;
    padding: 0.5rem 1rem;
    align-items: center;
}
nav a { color: white; text-decoration: none; padding: 0.5rem; }
.badge { background: red; color: white; border-radius: 50%; padding: 2px 6px; font-size: 0.7rem; }

/* Dropdown Menu */
.dropdown { display: inline-block; position: relative; }
.dropbtn { background: none; border: none; color: white; cursor: pointer; font-size: 1rem; padding: 0.5rem; }
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
}
.dropdown-content a { color: black; display: block; padding: 12px 16px; text-align: left; }
.dropdown-content a:hover { background-color: #f1f1f1; }
.dropdown:hover .dropdown-content { display: block; }

/* DRUCK-EINSTELLUNGEN */
@media print {
    @page {
        size: landscape;
        margin: 1cm;
    }

    body { background-color: white; }
    nav, footer, .flash, .lock-warning, .dienstplan-header a { display: none !important; }
    
    /* Make container use 100% width and handle potential overflow via compact widths */
    .container { 
        width: 100%; 
        max-width: 100%; 
        margin: 0; 
        padding: 0; 
        box-shadow: none; 
        border: none; 
        overflow: visible;
    }
    
    .dienstplan-header { justify-content: center; }
    .dienstplan-header h2 { font-size: 20pt; margin: 0 0 10px 0; }
    
    .dienstplan-table { 
        border: 2px solid #000; 
        width: 100%; 
        /* Auto table layout allows columns to compress if needed */
        table-layout: auto; 
    }
    
    .dienstplan-table th, .dienstplan-table td { 
        padding: 0; 
        font-size: 7.5pt; 
        border: 1px solid #777 !important;
        vertical-align: middle;
        height: min-content;
        word-wrap: break-word;
    }
    
    .employee-name { font-size: 7.5pt !important; font-weight: bold; width: auto !important; min-width: 50px !important; }
    .dienstplan-table th:first-child, .dienstplan-table td:first-child,
    .dienstplan-table th:last-child, .dienstplan-table td:last-child {
        position: static !important;
    }
    
    .shift-select { display: none !important; }
    
    /* Farben für Schichten etc für BW-Drucker anpassen */
    .shift-display-fixed { font-weight: bold; font-size: 8pt; display: block; }
    .time-display-fixed { font-size: 6.5pt; display: block; }
    
    /* Feiertage und Wochenenden hervorheben */
    .weekend { background-color: #e0e0e0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .holiday, .day-header.holiday, td.holiday-bg {
        background-color: #d0d0d0 !important; 
        border: 2px solid #555 !important; 
        -webkit-print-color-adjust: exact; 
        print-color-adjust: exact; 
    }
    
    .missing-shifts-row { display: none !important; } /* Ggf. beim Druck nicht benötigt */
    
    .print-legend { display: block; margin-top: 10px; page-break-inside: avoid; }
    .legend-item { display: inline-block; margin: 2px; border: 1px solid #000; border-radius: 2px; padding: 1px 3px; font-size: 7pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media screen {
    .container { overflow-x: auto; }
    .print-legend { margin-top: 20px; padding: 10px; }
}