* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --primary-dark: #357abd;
    --secondary-color: #f5f5f5;
    --text-color: #333;
    --text-light: #666;
    --border-color: #ddd;
    --error-color: #e74c3c;
    --success-color: #27ae60;
    --header-height: 60px;
    --sidebar-width: 250px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #fafafa;
    color: var(--text-color);
    line-height: 1.6;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-left: 20px;
    flex: 1;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-user span {
    font-weight: 500;
}

/* Hamburger Menu */
.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    display: none; /* Standardmäßig versteckt, wird per JavaScript angezeigt */
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    padding: 0;
    z-index: 1001;
}

.menu-toggle span {
    width: 100%;
    height: 3px;
    background-color: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
    overflow-y: auto;
    display: none; /* Standardmäßig versteckt, wird per JavaScript angezeigt */
}

.sidebar.active {
    transform: translateX(0);
    display: block; /* Wenn aktiv, anzeigen */
}

.sidebar-content {
    padding: 20px 0;
}

.menu-item {
    display: block;
    padding: 15px 25px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s ease;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background-color: var(--secondary-color);
    border-left-color: var(--primary-color);
}

.menu-item.active {
    background-color: var(--secondary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 10px 25px;
}

/* Overlay */
.overlay {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 998;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Content */
.main-content {
    margin-top: var(--header-height);
    padding: 30px 20px;
    min-height: calc(100vh - var(--header-height));
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.dashboard-container {
    max-width: 100%;
    padding: 20px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 2rem;
    font-weight: 600;
}

/* Forms */
.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Form Links */
.form-links {
    margin-top: 20px;
    text-align: center;
}

.form-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.form-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.btn-icon:hover {
    background-color: var(--secondary-color);
}

.btn-edit {
    color: var(--primary-color);
}

.btn-delete {
    color: var(--error-color);
}

.btn-ical {
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    font-size: 0.9rem;
    border-radius: 4px;
}

.btn-ical:hover {
    background: var(--primary-dark);
}

/* Messages */
.error-message {
    color: var(--error-color);
    padding: 12px;
    background: #fee;
    border-radius: 6px;
    border-left: 4px solid var(--error-color);
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    color: var(--success-color);
    padding: 12px;
    background: #efe;
    border-radius: 6px;
    border-left: 4px solid var(--success-color);
    display: none;
}

.success-message.show {
    display: block;
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.users-table thead {
    background: var(--secondary-color);
}

.users-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

.users-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.users-table tbody tr:hover {
    background-color: #fafafa;
}

.users-table tbody tr:last-child td {
    border-bottom: none;
}

/* Dashboard Table */
.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
    table-layout: auto;
}

.dashboard-container .table-container {
    width: 100%;
    overflow-x: auto;
}

.dashboard-table thead {
    background: var(--secondary-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.dashboard-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    min-width: 40px;
}

.dashboard-table th:not(:first-child) {
    min-width: 40px;
}

.dashboard-table th:first-child {
    text-align: left;
    min-width: 100px;
    max-width: 120px;
    position: sticky;
    left: 0;
    background: var(--secondary-color);
    z-index: 11;
}

.dashboard-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    text-align: center;
    min-width: 40px;
    font-size: 0.65rem;
}

.dashboard-table td:not(:first-child) {
    min-width: 40px;
}

.dashboard-table td:first-child {
    text-align: left;
    font-weight: 500;
    position: sticky;
    left: 0;
    background: white;
    z-index: 5;
    font-size: 0.85rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-table tbody tr.current-user-row td:first-child {
    background: #fff176 !important;
}

.dashboard-table tbody tr:hover td:first-child {
    background: #fafafa;
}

.dashboard-table tbody tr.current-user-row:hover td:first-child {
    background: #fff176;
}

.dashboard-table tbody tr:hover {
    background-color: #fafafa;
}

.dashboard-table tbody tr.current-user-row:hover {
    background-color: #fff176;
}

.dashboard-table tbody tr:last-child td {
    border-bottom: none;
}

/* Zeile des angemeldeten Benutzers */
.dashboard-table tbody tr.current-user-row {
    font-weight: bold;
    background-color: #fff176 !important;
}

.dashboard-table tbody tr.current-user-row td {
    font-weight: bold;
    background-color: #fff176 !important;
}

/* Wochenend-Tage (Samstag und Sonntag) */
.dashboard-table th.weekend-day,
.dashboard-table td.weekend-day {
    background-color: #e8f5e9;
}

/* Heutiges Datum */
.dashboard-table th.today,
.dashboard-table td.today {
    background-color: #ffa726;
}

/* Zeile des angemeldeten Benutzers hat Vorrang über weekend-day und today */
.dashboard-table tbody tr.current-user-row td.weekend-day {
    background-color: #ffeb3b !important;
}

.dashboard-table tbody tr.current-user-row td.today {
    background-color: #fbc02d !important;
}

.checkbox-cell {
    text-align: center;
}

.checkbox-cell input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Kombidienste Tabelle */
.kombidienste-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.kombidienste-table thead {
    background: var(--secondary-color);
}

.kombidienste-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

.kombidienste-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.kombidienste-table tbody tr:hover {
    background-color: #fafafa;
}

.kombidienste-table tbody tr:last-child td {
    border-bottom: none;
}

/* Popup */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.popup-overlay.active {
    display: flex;
}

.popup-content {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.popup-content h3 {
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: 600;
}

.actions-cell {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Dienste Tabelle */
.dienste-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.dienste-table thead {
    background: var(--secondary-color);
}

.dienste-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

.dienste-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.dienste-table tbody tr:hover {
    background-color: #fafafa;
}

.dienste-table tbody tr:last-child td {
    border-bottom: none;
}

.color-picker {
    width: 60px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
}

.color-picker:hover {
    border-color: var(--primary-color);
}

.dienst-preview {
    padding: 10px 15px;
    border-radius: 8px;
    display: inline-block;
    font-weight: 500;
    min-width: 150px;
    text-align: center;
}

/* Dashboard Dienst */
.dashboard-dienst {
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .header-title {
        font-size: 1.2rem;
    }

    .container {
        padding: 25px;
    }

    .sidebar {
        width: 100%;
    }

    .users-table {
        font-size: 0.9rem;
    }

    .users-table th,
    .users-table td {
        padding: 10px;
    }
    
    /* Dashboard Header für Smartphone */
    .dashboard-header {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .dashboard-controls {
        flex-direction: column !important;
        width: 100%;
        gap: 10px !important;
    }
    
    .dashboard-controls label {
        width: 100%;
        text-align: center;
    }
    
    .dashboard-controls select {
        width: 100%;
        min-width: auto !important;
    }
    
    .dashboard-controls button {
        width: 100%;
    }
}

