:root {
    --primary-color: #333;
    --background-color: #f4f4f4;
    --card-background: white;
    --header-background: #f0f0f0;
    --button-background: rgba(0, 0, 0, 0.2);
    --button-hover: rgba(0, 0, 0, 0.3);
    --table-row-even: #f8f9fa;
    --table-row-hover: rgba(0, 0, 0, 0.05);
    --table-gradient-start: #ffffff;
    --table-gradient-end: #f8f9fa;
    --border-radius: 8px;
    --spacing: 12px;
}

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

body {
    font-family: Arial, sans-serif;
    background-color: var(--background-color);
    margin: 0;
    padding: var(--spacing);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: auto;
    background: var(--card-background);
    padding: var(--spacing);
    border-radius: var(--border-radius);
    box-shadow: none;
}

h1 {
    text-align: center;
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: var(--spacing);
}

h2 {
    text-align: center;
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-bottom: var(--spacing);
}

.controls {
    display: flex;
    gap: var(--spacing);
    margin-bottom: var(--spacing);
    align-items: center;
    justify-content: center;
}

.button-group {
    display: flex;
    gap: var(--spacing);
}

button {
    background: var(--button-background);
    border: none;
    color: black;
    padding: 12px 24px;
    text-align: center;
    text-decoration: none;
    font-size: 1rem;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: background-color 0.3s;
    min-width: 120px;
}

button:hover {
    background: var(--button-hover);
}

button.active {
    background-color: var(--button-hover);
    font-weight: bold;
}

select {
    background: var(--button-background);
    color: black;
    padding: 12px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    min-width: 200px;
    max-width: 300px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
}

select:hover {
    background-color: var(--button-hover);
}

.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: var(--spacing);
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    background: linear-gradient(to bottom, 
        var(--table-gradient-start) 0%,
        var(--table-gradient-end) 100%);
    table-layout: fixed;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: transparent;
    transition: background-color 0.15s ease;
}

th {
    background: var(--header-background);
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 2px solid #ddd;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

th:hover {
    background-color: var(--button-hover);
}

th.sorted-asc::after {
    content: ' ▲';
    font-size: 0.8em;
}

th.sorted-desc::after {
    content: ' ▼';
    font-size: 0.8em;
}

/* Spaltenbreiten */
th:nth-child(1), td:nth-child(1) { width: 15%; } /* Kurs */
th:nth-child(2), td:nth-child(2) { width: 12%; } /* Tag */
th:nth-child(3), td:nth-child(3) { width: 8%; }  /* Stunde */
th:nth-child(4), td:nth-child(4) { width: 15%; } /* Raum */
th:nth-child(5), td:nth-child(5) { width: 15%; } /* Lehrer */
th:nth-child(6), td:nth-child(6) { width: 15%; } /* Typ */
th:nth-child(7), td:nth-child(7) { width: 20%; } /* Notizen */

/* Datumsspalte - keine spezielle Transition, wird von td übernommen */

/* Wenn die Datumsspalte ausgeblendet ist, passe die anderen Spaltenbreiten an */
.date-column[style*="display: none"] ~ td:nth-child(1) { width: 15%; }
.date-column[style*="display: none"] ~ td:nth-child(3) { width: 10%; }
.date-column[style*="display: none"] ~ td:nth-child(4) { width: 15%; }
.date-column[style*="display: none"] ~ td:nth-child(5) { width: 15%; }
.date-column[style*="display: none"] ~ td:nth-child(6) { width: 15%; }
.date-column[style*="display: none"] ~ td:nth-child(7) { width: 30%; }

/* Wenn die Datumsspalte sichtbar ist */
.date-column:not([style*="display: none"]) ~ td:nth-child(1) { width: 15%; }
.date-column:not([style*="display: none"]) ~ td:nth-child(3) { width: 8%; }
.date-column:not([style*="display: none"]) ~ td:nth-child(4) { width: 15%; }
.date-column:not([style*="display: none"]) ~ td:nth-child(5) { width: 15%; }
.date-column:not([style*="display: none"]) ~ td:nth-child(6) { width: 12%; }
.date-column:not([style*="display: none"]) ~ td:nth-child(7) { width: 20%; }
.date-column:not([style*="display: none"]) { width: 15%; }

tr:nth-child(even) {
    background-color: var(--table-row-even);
}

tr:nth-child(odd) {
    background-color: var(--table-gradient-start);
}

tr:hover td {
    background: var(--table-row-hover);
}

/* Mobile Optimierungen */
@media screen and (max-width: 768px) {
    :root {
        --spacing: 8px;
    }

    body {
        padding: 8px;
    }

    .container {
        padding: 12px;
        margin: 0;
        border-radius: var(--border-radius);
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    .controls {
        flex-direction: column;
    }

    .button-group {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    button {
        flex: 1;
        min-width: unset;
        padding: 12px 8px;
        font-size: 0.9rem;
    }

    select {
        width: 100%;
        max-width: unset;
    }

    th, td {
        padding: 8px;
        font-size: 0.85rem;
    }

    /* Horizontales Scrollen mit visuellem Indikator */
    .table-container {
        position: relative;
    }

    .table-container::after {
        display: none;
    }

    /* Verbesserte Touch-Interaktion */
    button, select {
        min-height: 44px;
    }

    .date-column {
        min-width: 100px;
    }
}

/* Landscape-Modus Optimierungen */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .controls {
        flex-direction: row;
    }

    .button-group {
        width: auto;
    }

    select {
        width: auto;
        min-width: 200px;
    }
}

/* Footer Styles */
.footer {
    margin-top: 32px;
    padding: 24px 0 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.75;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-height: 36px;
}

.footer-links a::before {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: calc(100% - 32px);
    height: 2px;
    background: currentColor;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.6;
}

.footer-links a:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
}

.footer-links a:hover::before {
    transform: translateX(-50%) scaleX(1);
}

.footer-links a:active {
    transform: translateY(0);
    background-color: rgba(0, 0, 0, 0.08);
}

.footer-credit {
    margin-top: 20px;
    padding-top: 20px;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--primary-color);
    opacity: 0.65;
    line-height: 1.6;
    position: relative;
}

.footer-credit::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
}

.footer-credit a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    opacity: 0.85;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: inline-block;
    padding: 2px 4px;
    margin: 0 2px;
    border-radius: 4px;
}

.footer-credit a::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 4px;
    right: 4px;
    height: 1.5px;
    background: currentColor;
    transform: scaleX(0);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.6;
}

.footer-credit a:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.04);
}

.footer-credit a:hover::after {
    transform: scaleX(1);
}

/* Mobile Footer Optimierungen - Top Designer Level */
@media screen and (max-width: 768px) {
    .footer {
        margin-top: 24px;
        padding: 20px 0 16px;
    }

    .footer::before {
        width: 40px;
    }

    .footer-links {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 24px;
        padding: 0 4px;
    }

    .footer-links a {
        font-size: 0.875rem;
        padding: 14px 16px;
        min-height: 48px;
        width: 100%;
        max-width: none;
        border-radius: 8px;
        font-weight: 500;
        background-color: rgba(0, 0, 0, 0.02);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }

    .footer-links a::before {
        display: none;
    }

    .footer-links a:hover {
        background-color: rgba(0, 0, 0, 0.06);
        transform: translateY(-2px);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    }

    .footer-links a:active {
        transform: translateY(0);
        background-color: rgba(0, 0, 0, 0.1);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    }

    .footer-credit {
        margin-top: 16px;
        padding-top: 16px;
        font-size: 0.75rem;
        padding: 16px 12px 0;
        line-height: 1.7;
    }

    .footer-credit::before {
        width: 30px;
    }

    .footer-credit a {
        padding: 4px 6px;
        margin: 0 1px;
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .footer-credit a:hover {
        background-color: rgba(0, 0, 0, 0.06);
    }
}

/* Extra kleine Bildschirme */
@media screen and (max-width: 480px) {
    .footer-links {
        gap: 8px;
    }

    .footer-links a {
        padding: 12px 14px;
        font-size: 0.8125rem;
    }

    .footer-credit {
        font-size: 0.6875rem;
        padding: 14px 8px 0;
    }
}
