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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: #ffffff;
    color: #212121;
    line-height: 1.6;
}

.container {
    max-width: 100%;
    width: 100%;
    min-height: 100vh;
    padding: 0;
}

header {
    background: #ffffff;
    padding-top: 24px;
    margin-bottom: 32px;
    border-bottom: 1px solid #e0e0e0;
}

header > * {
    padding-left: 48px;
    padding-right: 48px;
}

header h1 {
    color: #212121;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

header p {
    color: #757575;
    font-size: 14px;
    font-weight: 400;
}

/* Header und Navigation */
.header-content {
    margin-bottom: 12px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 12px;
    padding-bottom: 12px;
    border-top: 1px solid #e0e0e0;
}

.nav-link {
    color: #757575;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: #212121;
    background: #f5f5f5;
}

.nav-link.active {
    color: #000000;
    background: #e0e0e0;
    font-weight: 600;
}

.section {
    padding: 0 48px 48px;
}

.section h2 {
    color: #212121;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #424242;
    font-weight: 500;
    font-size: 14px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 400 !important;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
    margin: 0;
}

.form-group input {
    width: 100%;
    max-width: 400px;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fafafa;
}

.form-group input:focus {
    outline: none;
    border-color: #000000;
    background: #ffffff;
}

.btn {
    padding: 10px 20px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    background: #ffffff;
    color: #212121;
}

.btn:hover {
    border-color: #000000;
    background: #fafafa;
}

.btn-primary {
    background: #000000;
    color: #ffffff;
    border-color: #000000;
    width: 100%;
    max-width: 400px;
}

.btn-primary:hover {
    background: #212121;
}

.btn-secondary {
    background: #ffffff;
    color: #212121;
    border-color: #d0d0d0;
}

.btn-icon {
    padding: 10px 14px;
    width: auto;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.date-selector input[type="date"] {
    flex: 0 1 auto;
    min-width: 150px;
}

.hidden {
    display: none !important;
}

.error-message {
    color: #d32f2f;
    background: #ffebee;
    padding: 12px 16px;
    border-radius: 4px;
    margin-top: 16px;
    font-size: 14px;
    border-left: 3px solid #d32f2f;
}

.error-message:empty {
    display: none;
}

.loading {
    text-align: center;
    padding: 32px;
    color: #757575;
    font-size: 14px;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.week-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}

.week-display {
    font-weight: 600;
    font-size: 16px;
    color: #212121;
    flex: 1;
    text-align: center;
}

.weekday-display {
    display: inline-block;
    margin-left: 12px;
    font-weight: 600;
    font-size: 14px;
    color: #757575;
}

.results {
    margin-top: 32px;
}

.results h3 {
    color: #424242;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

#teacherList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.teacher-card {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 4px;
    transition: all 0.2s;
    cursor: pointer;
}

.teacher-card:hover {
    border-color: #000000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.teacher-card:active {
    transform: scale(0.98);
}

.teacher-name {
    font-weight: 600;
    font-size: 16px;
    color: #212121;
    margin-bottom: 8px;
}

.teacher-info {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #616161;
}

.teacher-time {
    font-weight: 500;
}

.teacher-reason {
    color: #757575;
    font-style: italic;
    margin-top: 8px;
    font-size: 13px;
}

.no-results {
    text-align: center;
    padding: 64px;
    color: #9e9e9e;
}

.no-results p {
    font-size: 15px;
}

#dateSelect {
    width: auto;
    display: inline-block;
    margin-right: 12px;
    max-width: 200px;
}

#checkBtn {
    width: auto;
    display: inline-block;
}

/* Stundenplan-Grid */
.timetable-grid {
    display: grid;
    grid-template-columns: 80px repeat(5, 1fr);
    gap: 1px;
    background: #e0e0e0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 24px;
}

.timetable-header {
    background: #000000;
    color: #ffffff;
    padding: 12px;
    font-weight: 600;
    text-align: center;
    font-size: 14px;
}

.timetable-time {
    background: #fafafa;
    padding: 12px;
    font-weight: 500;
    text-align: center;
    font-size: 13px;
    color: #616161;
    border-right: 1px solid #e0e0e0;
}

/* Pausen-Zeilen - halbe Höhe */
.timetable-time.break-time {
    padding: 6px;
    font-size: 11px;
    background: #f5f5f5;
    color: #9e9e9e;
    font-style: italic;
}

.timetable-cell {
    background: #ffffff;
    padding: 12px;
    min-height: 80px;
}

.timetable-cell.empty {
    background: #fafafa;
}

/* Pausen-Zellen - halbe Höhe */
.timetable-cell.break-cell {
    min-height: 40px;
    max-height: 40px;
    height: 40px;
    padding: 4px 12px; /* Gleiche horizontale Padding wie normale Zellen für Alignment */
    overflow: hidden;
}

/* Kleinere Schrift in Pausen-Zellen */
.timetable-cell.break-cell .lesson {
    padding: 4px 6px !important;
    margin-bottom: 0 !important;
}

.timetable-cell.break-cell .lesson-subject {
    font-size: 11px !important;
    line-height: 1.2 !important;
}

.timetable-cell.break-cell .lesson-details {
    font-size: 10px !important;
    line-height: 1.2 !important;
    margin-top: 2px !important;
}

.timetable-cell.break-cell .lesson-substitute {
    font-size: 9px !important;
    margin-top: 2px !important;
}

.lesson {
    background: #f5f5f5;
    border-left: 2px solid #212121;
    padding: 10px;
    border-radius: 2px;
    margin-bottom: 6px;
}

.lesson.substituted {
    background: #ffebee;
    border-left-color: #d32f2f;
    opacity: 0.7;
}

.lesson.cancelled {
    background: #ffebee;
    border-left-color: #d32f2f;
    opacity: 0.7;
}

.lesson.standby {
    background: #e8f5e9;
    border-left-color: #4caf50;
}

.lesson.standby-used {
    background: #e8f5e9;
    border-left-color: #4caf50;
}

.lesson.supervision {
    background: #f3e5f5;
    border-left-color: #9c27b0;
}

.lesson.supervision .lesson-subject {
    text-align: left;
    display: block;
}

.strikethrough {
    text-decoration: line-through;
}

.lesson-subject {
    font-weight: 600;
    font-size: 14px;
    color: #212121;
}

.lesson-details {
    font-size: 12px;
    color: #757575;
    margin-top: 4px;
}

.lesson-substitute {
    font-size: 11px;
    color: #d32f2f;
    margin-top: 4px;
    font-style: italic;
}

.clickable-name {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

.clickable-name:hover {
    text-decoration-style: solid;
    font-weight: 600;
}

.lesson-split {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
}

.lesson-split-left {
    flex: 1;
}

.lesson-split-right {
    padding-left: 12px;
    border-left: 1px solid #a5d6a7;
    display: flex;
    align-items: center;
}

.lesson-badge {
    font-size: 10px;
    font-weight: 600;
    color: #2e7d32;
    background: #c8e6c9;
    padding: 4px 8px;
    border-radius: 3px;
    display: inline-block;
}

/* Monat-Selector */
.month-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.form-control {
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    background: #fafafa;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #000000;
    background: #ffffff;
}

.form-control:hover {
    border-color: #a0a0a0;
}

/* Statistik-Tabelle */
.table-container {
    overflow-x: auto;
    margin-top: 16px;
}

.statistics-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.statistics-table th {
    background: #000000;
    color: #ffffff;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.statistics-table td {
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    font-size: 14px;
}

.statistics-table tbody tr {
    transition: background-color 0.2s ease;
}

.statistics-table tbody tr:hover {
    background: #f9f9f9;
}

.statistics-table .hours-cell {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.statistics-table .total-row {
    background: #f5f5f5;
    font-weight: 600;
    border-top: 2px solid #000000;
}

.statistics-table .total-label {
    text-align: right;
    padding-right: 16px;
}

.statistics-table .total-value {
    text-align: right;
    font-size: 16px;
    color: #000000;
}

.statistics-table .clickable-name {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    color: #1976d2;
    transition: all 0.2s ease;
}

.statistics-table .clickable-name:hover {
    text-decoration-style: solid;
    font-weight: 600;
    color: #1565c0;
}

/* Statistik-Tabs */
.stats-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid #e0e0e0;
}

.stats-tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #757575;
    transition: all 0.2s ease;
    margin-bottom: -2px;
}

.stats-tab:hover {
    color: #212121;
    background: #f5f5f5;
}

.stats-tab.active {
    color: #000000;
    font-weight: 600;
    border-bottom-color: #000000;
}

.tab-content {
    display: block;
}

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

/* Einstellungen */
.help-text {
    font-size: 13px;
    color: #757575;
    margin-top: 8px;
    line-height: 1.5;
}

.settings-info {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 20px;
    margin: 24px 0;
}

.settings-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: #212121;
    margin-bottom: 12px;
}

.settings-info p {
    font-size: 14px;
    color: #424242;
    margin-bottom: 12px;
    line-height: 1.6;
}

.settings-info ul {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.settings-info li {
    font-size: 14px;
    color: #424242;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    line-height: 1.5;
}

.settings-info li:last-child {
    border-bottom: none;
}

.settings-info li strong {
    color: #000000;
    font-weight: 600;
}

.settings-actions {
    margin-top: 24px;
}

.success-message {
    color: #2e7d32;
    background: #e8f5e9;
    padding: 12px 16px;
    border-radius: 4px;
    margin-top: 16px;
    font-size: 14px;
    border-left: 3px solid #4caf50;
}

.success-message:empty {
    display: none;
}

/* Abrechenbarkeits-Info */
.billability-info {
    padding: 16px 20px;
    border-radius: 4px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 12px;
}

.billability-info.billable {
    background: #e8f5e9;
    border-left-color: #4caf50;
    color: #2e7d32;
}

.billability-info.not-billable {
    background: #ffebee;
    border-left-color: #d32f2f;
    color: #c62828;
}

.billability-info.info {
    background: #e3f2fd;
    border-left-color: #1976d2;
    color: #1565c0;
}

.billability-info strong {
    font-weight: 700;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding-top: 16px;
    }

    header > * {
        padding-left: 16px;
        padding-right: 16px;
    }

    header h1 {
        font-size: 20px;
    }

    .section {
        padding: 0 16px 24px;
    }

    .header-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .week-navigation {
        flex-direction: column;
        gap: 12px;
    }

    .week-navigation button {
        width: 100%;
    }

    .date-selector {
        width: 100%;
    }

    .date-selector input[type="date"] {
        flex: 1;
    }

    .btn-primary {
        width: 100%;
        max-width: none;
    }

    #teacherList {
        grid-template-columns: 1fr;
    }

    .timetable-grid {
        font-size: 10px;
        grid-template-columns: 45px repeat(5, minmax(55px, 1fr));
        overflow-x: visible;
    }

    .timetable-header {
        font-size: 11px;
        padding: 6px 2px;
        word-break: break-word;
    }

    .timetable-time {
        padding: 6px 2px;
        font-size: 9px;
    }

    .timetable-cell {
        padding: 4px 1px 4px 2px;
        min-height: 60px;
        text-align: left;
    }

    .lesson {
        padding: 4px 2px 4px 0 !important;
        margin-bottom: 2px;
        border-left-width: 1px;
        text-align: left !important;
        margin-left: 0 !important;
    }

    .lesson-subject {
        font-size: 10px;
        line-height: 1.3;
        word-wrap: break-word;
        hyphens: none;
        text-align: left !important;
        margin: 0 !important;
        padding-left: 0 !important;
    }

    .lesson-details {
        font-size: 9px;
        line-height: 1.3;
        word-wrap: break-word;
        hyphens: none;
        text-align: left !important;
        margin: 0 !important;
        margin-top: 2px !important;
        padding-left: 0 !important;
    }

    .lesson-substitute {
        font-size: 8px;
        line-height: 1.3;
        word-wrap: break-word;
        hyphens: none;
        text-align: left !important;
        margin: 0 !important;
        margin-top: 2px !important;
        padding-left: 0 !important;
    }

    .lesson.supervision {
        padding: 4px 2px 4px 2px !important;
        margin: 0 0 2px -10px !important;
        text-align: left !important;
        text-indent: 0 !important;
    }

    .lesson.supervision .lesson-subject {
        text-align: left !important;
        margin: 0 !important;
        text-indent: 0 !important;
        display: block !important;
        word-wrap: break-word !important;
        hyphens: none !important;
    }

    .lesson.supervision .lesson-details {
        text-align: left !important;
        padding: 0 !important;
        margin: 2px 0 0 0 !important;
        text-indent: 0 !important;
        word-wrap: break-word !important;
        hyphens: none !important;
    }

    .lesson-badge {
        font-size: 9px;
        padding: 3px 6px;
    }

    .main-nav {
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 13px;
    }

    #logoutBtn {
        margin-left: auto;
    }

    .month-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .month-selector select,
    .month-selector button {
        width: 100%;
    }

    .billability-info {
        display: block;
        padding: 12px 16px;
        font-size: 13px;
        word-break: break-word;
    }

    .billability-info strong {
        display: block;
        margin-bottom: 6px;
    }

    .billability-info p {
        margin: 4px 0 0 0;
    }

    .statistics-table {
        font-size: 11px;
    }

    .statistics-table th,
    .statistics-table td {
        padding: 6px 4px;
        font-size: 11px;
    }

    .statistics-table th {
        font-size: 10px;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 18px;
    }

    .timetable-grid {
        grid-template-columns: 40px repeat(5, minmax(50px, 1fr));
        font-size: 9px;
    }

    .timetable-header {
        font-size: 10px;
        padding: 4px 1px;
    }

    .timetable-time {
        font-size: 8px;
    }

    .timetable-cell {
        padding: 3px 1px 3px 1px;
        text-align: left;
    }

    .lesson {
        padding: 3px 1px 3px 0 !important;
        border-left-width: 1px;
        text-align: left !important;
        margin-left: 0 !important;
    }

    .lesson-subject,
    .lesson-details,
    .lesson-substitute {
        word-wrap: break-word;
        hyphens: none;
        line-height: 1.3;
        text-align: left !important;
        margin: 0 !important;
        padding-left: 0 !important;
    }

    .lesson-details,
    .lesson-substitute {
        margin-top: 2px !important;
    }

    .lesson-split {
        flex-direction: column;
        gap: 6px;
    }

    .lesson-split-right {
        padding-left: 0;
        border-left: none;
        border-top: 1px solid #a5d6a7;
        padding-top: 6px;
    }

    .billability-info {
        font-size: 12px;
        padding: 10px 12px;
    }

    .statistics-table {
        font-size: 10px;
    }

    .statistics-table th,
    .statistics-table td {
        padding: 4px 2px;
        font-size: 10px;
    }

    .statistics-table th {
        font-size: 9px;
    }
}
