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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --border-color: #e2e8f0;
    --text-color: #1e293b;
    --text-muted: #64748b;
}

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px;
}

/* Header & Navigation */
header {
    background: var(--surface-color);
    padding: 8px 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Dropdown Menu Items */
.dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-color);
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-color);
}

.dropdown-item:active {
    background: var(--border-color);
}

header h1 {
    font-size: 28px;
    margin-bottom: 20px;
    color: var(--text-color);
}

/* Legacy Wochenauswahl CSS removed - week navigation now in SmartShifts tab */

.week-nav-btn {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.week-nav-btn:hover {
    background: var(--primary-hover);
}

/* Dropdown Menu Styles */
.dropdown-item {
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    transition: background 0.15s;
    display: block;
}

.dropdown-item:hover {
    background: var(--bg-color);
}

.dropdown-item:active {
    background: var(--border-color);
}

#week-status-badge {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 5px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-color);
    transition: all 0.2s;
    line-height: 1.2;
}

.nav-btn-icon {
    padding: 5px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn-icon svg {
    width: 12px;
    height: 12px;
}

.nav-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.nav-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Logout Button (same style as nav-btn but without tab switching) */
.btn-logout {
    padding: 5px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
    line-height: 1.2;
}

.btn-logout:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-small {
    font-size: 11px;
    padding: 5px 12px;
}

/* Main Content */
main {
    background: var(--surface-color);
    padding: 5px 15px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 500px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--text-color);
}

h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-color);
}

/* Action Bar */
.action-bar {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-color);
}

thead {
    background: var(--bg-color);
}

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

th {
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

td {
    font-size: 14px;
}

tbody tr:hover {
    background: var(--bg-color);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.status-ok {
    background: #d1fae5;
    color: #065f46;
}

.status-warning {
    background: #fef3c7;
    color: #92400e;
}

.status-danger {
    background: #fee2e2;
    color: #991b1b;
}

.status-full {
    background: #e0e7ff;
    color: #3730a3;
}

/* Dienstplan Grid/Tabelle */
.dienstplan-container {
    overflow-x: auto;
    margin-top: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

#dienstplan-grid table {
    border: 1px solid var(--border-color);
}

#dienstplan-grid thead th {
    border: 1px solid var(--border-color);
    vertical-align: middle;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#dienstplan-grid tbody td {
    border: 1px solid var(--border-color);
}

/* Erste Spalte (Mitarbeiter) fixieren beim Scrollen */
#dienstplan-grid th:first-child,
#dienstplan-grid td:first-child {
    position: sticky;
    left: 0;
    background: var(--surface-color);
    z-index: 5;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}

#dienstplan-grid thead th:first-child {
    z-index: 20;
    background: var(--bg-color);
}

/* Hover-Effekt auf Zeilen entfernt, damit individuelle Zell-Hintergründe (Opacity, Zuweisungen) sichtbar bleiben */

/* Überlastete Mitarbeiter - roter Rahmen */
#dienstplan-grid tbody tr.overloaded {
    border: 3px solid var(--danger-color);
    border-left: 5px solid var(--danger-color);
}

#dienstplan-grid tbody tr.overloaded td:first-child {
    background: #fef2f2;
    font-weight: 600;
    color: var(--danger-color);
}

#dienstplan-grid tbody tr.overloaded:hover td:first-child {
    background: #fee2e2 !important;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10100;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

/* Shift-Editor Modal (niedriger z-index) */
#modal-shift-editor {
    z-index: 10100;
}

/* Wochenschicht-Details Modal (höherer z-index, damit es über dem Editor erscheint) */
#modal-wochenschicht {
    z-index: 10200;
}

.modal-content {
    background: var(--surface-color);
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h3 {
    margin-bottom: 20px;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="time"],
.form-group input[type="week"],
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* Week Picker Input */
.week-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
}

.week-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Footer */
footer {
    margin-top: 30px;
    padding: 20px;
    background: var(--surface-color);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.data-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Overview Sections */
.overview-section {
    margin-bottom: 40px;
}

.overview-section:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 20px;
    }

    header h1 {
        font-size: 22px;
    }

    main {
        padding: 20px;
    }

    nav {
        flex-direction: column;
    }

    .nav-btn {
        width: 100%;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px;
    }
}

/* Abwesende Mitarbeiter */
.absent {
    background: #ffedd5 !important;
}

.absent:hover {
    background: #fed7aa !important;
}

/* Hilfeklassen */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* Wochenschichten Timeline Editor → Moved to css/modules/timeline.css */

/* ===================================
   FOOTER
   =================================== */

.footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    color: #64748b;
}

.footer p {
    margin: 5px 0;
    font-size: 14px;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: opacity 0.2s;
}

.footer a:hover {
    opacity: 0.8;
}

.footer-tagline {
    opacity: 0.7;
}

/* Fullscreen Mode → Moved to css/modules/fullscreen.css */

/* Filter-Bar → Moved to css/modules/filterbar.css */

/* ========================================
   Modal Tabs
   ======================================== */

.modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.modal-tab {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-tab:hover {
    color: var(--text-color);
    background: var(--bg-secondary);
}

.modal-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-badge {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.bereich-tab-content {
    display: none;
}

.bereich-tab-content.active {
    display: block;
}

/* Mitarbeiter Checkbox List */
.mitarbeiter-checkbox-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 4px;
    transition: background 0.2s;
}

.mitarbeiter-checkbox-item:hover {
    background: var(--bg-secondary);
}

.mitarbeiter-checkbox-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    width: 100%;
}

.mitarbeiter-checkbox-item input[type="checkbox"] {
    cursor: pointer;
}

.mitarbeiter-meta {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
}

.mitarbeiter-checkbox-item.changed {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    padding-left: 9px;
}


/* Berichte Tab (Monthly Reports) → Moved to css/modules/berichte.css */

/* Jahresübersicht → Moved to css/modules/annual.css */

/* ===================================
   Custom Dialogs (Alert & Confirm)
   =================================== */

.custom-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10500; /* Über allen Modals */
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.custom-dialog.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.custom-dialog-content {
    background: var(--surface-color);
    padding: 30px;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.25s ease-out;
    text-align: center;
}

.custom-dialog-icon {
    font-size: 48px;
    margin-bottom: 20px;
    line-height: 1;
}

.custom-dialog-message {
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-color);
    margin-bottom: 25px;
    white-space: pre-wrap; /* Preserve line breaks from \n */
}

.custom-dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.custom-dialog-actions button {
    min-width: 100px;
    padding: 10px 20px;
    font-size: 15px;
}

/* Custom Warning Dialog (strukturiert) */
.custom-warning-content {
    text-align: left;
    max-width: 500px;
}

.custom-warning-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.custom-warning-icon {
    font-size: 32px;
    line-height: 1;
}

.custom-warning-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.custom-warning-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.custom-warning-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-color);
}

.custom-warning-list li::before {
    content: "•";
    color: var(--warning-color);
    font-weight: bold;
    font-size: 18px;
    line-height: 1;
}

.warning-type .custom-warning-list li::before {
    color: var(--warning-color);
}

.error-type .custom-warning-list li::before {
    color: var(--danger-color);
}

.custom-warning-question {
    font-size: 15px;
    color: var(--text-muted);
    margin: 0 0 20px 0;
    text-align: center;
}

.custom-warning-content .custom-dialog-actions,
.custom-error-content .custom-dialog-actions {
    justify-content: center;
}

/* Custom Error Dialog (Blockierung) */
.custom-error-content {
    text-align: left;
    max-width: 500px;
}

.custom-error-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--danger-color);
}

.custom-error-icon {
    font-size: 32px;
    line-height: 1;
}

.custom-error-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--danger-color);
    margin: 0;
}

.custom-warning-list.error-list li::before {
    color: var(--danger-color);
}

.custom-error-footer {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 20px 0;
    text-align: center;
    font-style: italic;
}

/* Custom Info Confirm Dialog */
.custom-info-content {
    max-width: 450px;
}

.custom-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.custom-info-icon {
    font-size: 32px;
    line-height: 1;
}

.custom-info-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.custom-info-message {
    font-size: 15px;
    color: var(--text-color);
    margin: 0 0 15px 0;
    line-height: 1.5;
}

.custom-info-details {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.custom-info-details:empty {
    display: none;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .custom-dialog {
        background: rgba(0, 0, 0, 0.8);
    }
}

/* Loading Spinner Animation */
@keyframes spin {
    to { 
        transform: rotate(360deg); 
    }
}
