/* ========================================
   COMBINED STYLES - MATHEBUCH
   Kombination aus styles.css und stufen.css
======================================== */

/* Reset und Grundeinstellungen */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    /* Verbessert die Touch-Scrolling-Performance */
    -webkit-overflow-scrolling: touch;
}

/* Mobile-optimierte Touch-Targets */
a, button, input, select, textarea {
    -webkit-tap-highlight-color: rgba(74, 144, 226, 0.3);
    /* Mindestgröße für Touch-Targets */
    min-height: 44px;
    min-width: 44px;
}

/* Verbesserte Touch-Interaktion */
.math-button, .login-button, .content-link {
    /* Touch-Feedback */
    -webkit-tap-highlight-color: rgba(74, 144, 226, 0.2);
    /* Verhindert Text-Auswahl beim Tippen */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Zoom-Verhinderung bei Eingabefeldern (iOS) */
input, select, textarea {
    font-size: 16px !important;
}

/* Verbesserte Scrollbar-Darstellung */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ========================================
   HEADER STYLES
======================================== */

header, .header {
    background: linear-gradient(135deg, #6fa8dc, #4a90e2, #357abd);
    color: white;
    text-align: center;
    padding: 30px 0;
    box-shadow: 0 3px 15px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
}

header::before, .header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/></svg>') repeat;
    opacity: 0.3;
}

header h1, .header h1 {
    font-size: 3.2em;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

header p, .header p {
    font-size: 1.5em;
    font-weight: 400;
    position: relative;
    z-index: 1;
    opacity: 0.95;
}

/* ========================================
   NAVIGATION STYLES
======================================== */

.user-nav, .navigation {
    text-align: center;
    padding: 18px 0;
    background: linear-gradient(90deg, #e8f0fe, #f0f7ff, #e8f0fe);
    border-bottom: 2px solid #d0d7e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.user-nav a, .navigation a {
    color: #4a90e2;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1em;
    transition: all 0.3s ease;
    margin: 0 8px;
    padding: 8px 12px;
    border-radius: 6px;
}

.user-nav a:hover, .navigation a:hover {
    color: #2c5aa0;
    background-color: rgba(74, 144, 226, 0.1);
    transform: translateY(-1px);
}

/* ========================================
   MAIN CONTENT AND LAYOUT
======================================== */

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Container Layout für Stufen/Themen-Seiten */
.container {
    display: flex;
    width: 100vw;
    margin: 0;
    gap: 12px;
    padding: 12px;
    box-sizing: border-box;
    min-height: calc(100vh - 120px);
    align-items: stretch;
}

.sidebar {
    width: 380px;
    flex-shrink: 0;
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-height: calc(100vh - 150px);
    box-sizing: border-box;
    font-size: 1.05em;
}

.main-content {
    flex: 1;
    background-color: white;
    padding: 35px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-height: calc(100vh - 150px);
    width: 100%;
    max-width: none;
    font-size: 1.2em;
}

.sidebar h3 {
    color: #4a90e2;
    margin-bottom: 18px;
    font-size: 1.4em;
    font-weight: bold;
}

.sidebar p {
    color: #666;
    line-height: 1.6;
    font-size: 0.9em;
}

/* ========================================
   BUTTON GRID (Hauptseite)
======================================== */

.button-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 20px;
}

.math-button {
    background-color: white;
    border: 2px solid #ddd;
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.math-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #4a90e2;
}

.math-button a {
    display: block;
    padding: 30px 20px;
    text-decoration: none;
    color: #333;
    font-size: 1.1em;
    font-weight: bold;
    text-align: center;
    height: 100%;
    transition: all 0.3s ease;
}

.math-button a:hover {
    background-color: #f8f9fa;
    color: #4a90e2;
}

.math-button span {
    display: block;
    line-height: 1.4;
}

/* ========================================
   THEMEN NAVIGATION (Stufen/Themen-Seiten)
======================================== */

.themen-liste {
    max-height: 500px;
    overflow-y: auto;
}

.thema-container {
    margin: 8px 0;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

.thema-header {
    background: #f8f9fa;
    padding: 12px;
    border-left: 3px solid #4a90e2;
    color: #333;
    font-size: 0.9em;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.thema-header:hover {
    background: #e8f4f8;
}

.thema-header:active {
    background: #d0e8f0;
}

.thema-header.no-arrow {
    cursor: default;
}

.thema-header.no-arrow:hover {
    background: #f8f9fa;
}

.thema-arrow {
    font-size: 0.8em;
    color: #4a90e2;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}

.thema-arrow.rotated {
    transform: rotate(180deg);
}

.unterthemen-container {
    max-height: 0;
    overflow: hidden;
    background: #ffffff;
    opacity: 0;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.unterthemen-container.expanded {
    max-height: 500px;
    opacity: 1;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.unterthemen-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.unterthemen-list li {
    padding: 8px 15px;
    border-bottom: 1px solid #f0f0f0;
    color: #666;
    font-size: 0.85em;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.unterthemen-list li:last-child {
    border-bottom: none;
}

.unterthemen-list li:hover {
    background: #f8f9fa;
    color: #333;
}

.unterthemen-list li.active {
    background: #4a90e2;
    color: white;
    font-weight: bold;
}



.unterthema-id {
    color: #666;
    font-size: 0.9em;
    font-style: italic;
}

.unterthemen-list li.active .unterthema-id {
    color: #ddd;
}

/* ========================================
   AUFGABEN UND FRAGEN STYLES
======================================== */

.aufgabe-block {
    margin-bottom: 30px;
    padding: 25px;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    font-size: 1.15em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aufgabe-block:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.frage-item {
    margin-bottom: 15px;
}

.frage-text h3 {
    margin: 15px 0;
    color: #333;
    font-size: 1.3em;
    line-height: 1.4;
}

.frage-bild img {
    border: 1px solid #ccc;
    border-radius: 3px;
    margin: 10px 0;
    max-width: 100%;
    height: auto;
}

.frage-link .external-link {
    color: #4a90e2;
    text-decoration: none;
    font-weight: bold;
}

.frage-link .external-link:hover {
    text-decoration: underline;
}

.frage-code pre {
    background-color: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 10px;
    overflow-x: auto;
    margin: 10px 0;
}

.frage-code code {
    font-family: 'Courier New', monospace;
}

.frage-iframe iframe {
    border: 1px solid #ddd;
    border-radius: 3px;
    margin: 10px 0;
}

.frage-geogebra {
    margin: 10px 0;
}

.frage-default {
    margin: 10px 0;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 3px;
}

/* ========================================
   NAVIGATION LINKS
======================================== */

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links li {
    margin-bottom: 12px;
}

.nav-links a {
    color: #4a90e2;
    text-decoration: none;
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 1.1em;
    font-weight: 500;
}

.nav-links a:hover {
    background-color: #e8f4f8;
    padding-left: 10px;
    transition: all 0.3s ease;
}

.nav-links a.active {
    font-weight: bold;
    background-color: #e8f4f8;
    padding-left: 10px;
}

/* ========================================
   MODAL STYLES (Lösungen)
======================================== */

.loesung-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);
}

.loesung-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: none;
    border-radius: 8px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.loesung-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4a90e2;
}

.loesung-modal-title {
    margin: 0;
    color: #4a90e2;
    font-size: 1.5em;
}

.loesung-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    line-height: 1;
}

.loesung-close:hover,
.loesung-close:focus {
    color: #000;
}

.loesung-item {
    margin-bottom: 20px;
    padding: 15px;
    border-left: 4px solid #28a745;
    background-color: #f8f9fa;
    border-radius: 0 5px 5px 0;
}

.loesung-item h4 {
    margin: 0 0 10px 0;
    color: #28a745;
    font-size: 1.1em;
}

.loesung-bild img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin: 10px 0;
}

.loesung-link a {
    color: #4a90e2;
    text-decoration: none;
    font-weight: bold;
}

.loesung-link a:hover {
    text-decoration: underline;
}

.loesung-code {
    background-color: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 10px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    overflow-x: auto;
}

/* ========================================
   FORM STYLES
======================================== */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 20px;
}

.login-box {
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    padding: 30px;
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
}

.login-box h2 {
    color: #4a90e2;
    margin-bottom: 25px;
    text-align: center;
    font-size: 2.2em;
    font-weight: 700;
    line-height: 1.2;
}

.info-text {
    background-color: #f8f9fa;
    border-left: 4px solid #4a90e2;
    padding: 15px;
    margin-bottom: 25px;
    border-radius: 5px;
}

.info-text ul {
    margin: 10px 0 0 20px;
}

.info-text li {
    margin: 5px 0;
    color: #555;
}

.login-form {
    margin-top: 20px;
    max-width: 400px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Error field styles */
.form-group input.error-field,
.form-group select.error-field {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.form-group input.error-field:focus,
.form-group select.error-field:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

/* Error messages container */
.error-messages {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
}

.error-messages .error-message {
    color: #721c24;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.error-messages .error-message:last-child {
    margin-bottom: 0;
}

/* Password Toggle Styles */
.password-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-container input {
    padding-right: 45px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    font-size: 16px;
    line-height: 1;
}

.password-toggle:hover {
    background-color: rgba(74, 144, 226, 0.1);
}

.password-toggle:focus {
    outline: none;
    background-color: rgba(74, 144, 226, 0.2);
}

.password-icon {
    display: block;
    font-size: 18px;
    line-height: 1;
}

.form-info {
    background-color: #e8f0fe;
    padding: 10px;
    border-radius: 5px;
    margin: 15px 0;
    font-size: 0.9em;
    color: #555;
}

.login-button, .submit-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #6fa8dc, #4a90e2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-top: 15px;
}

.login-button:hover, .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 144, 226, 0.4);
}

.additional-links, .forgot-password {
    text-align: center;
    margin-top: 20px;
}

.additional-links a, .forgot-password a {
    color: #4a90e2;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9em;
}

.additional-links a:hover, .forgot-password a:hover {
    text-decoration: underline;
}

/* ========================================
   MESSAGE STYLES
======================================== */

.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 5px;
    margin: 15px 0;
    border-left: 4px solid #c62828;
}

.success-message {
    background-color: #e8f5e8;
    color: #2e7d32;
    padding: 10px;
    border-radius: 5px;
    margin: 15px 0;
    border-left: 4px solid #2e7d32;
}

.success-message a {
    color: #2e7d32;
    font-weight: bold;
}

.logout-message {
    background-color: #e8f5e8;
    color: #2e7d32;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    border-left: 4px solid #2e7d32;
    text-align: center;
}

.no-aufgaben {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 40px;
}

/* ========================================
   CONTENT CARDS AND PROFILES
======================================== */

.user-info {
    margin-bottom: 30px;
}

.profile-box {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-left: 4px solid #4a90e2;
}

.profile-box p {
    margin: 10px 0;
    font-size: 1.1em;
}

.mathebuch-content {
    margin-bottom: 30px;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

/* Responsive Anpassungen für Kacheln */
@media (min-width: 768px) {
    .content-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 30px;
    }
}

@media (min-width: 1024px) {
    .content-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
}

@media (min-width: 1200px) {
    .content-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
}

.content-card {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.content-card h3 {
    color: #4a90e2;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.content-card p {
    color: #666;
    margin-bottom: 15px;
}

.content-link {
    display: inline-block;
    padding: 8px 16px;
    background-color: #4a90e2;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.content-link:hover {
    background-color: #2c5aa0;
}

.aufgabe-link {
    background-color: #4a90e2;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
}

.aufgabe-link:hover {
    background-color: #357abd;
}

/* ========================================
   FOOTER
======================================== */

footer {
    text-align: center;
    padding: 20px 0;
    background-color: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    margin-top: 40px;
}

footer a {
    color: #4a90e2;
    text-decoration: none;
    font-weight: bold;
}

footer a:hover {
    text-decoration: underline;
}

/* ========================================
   COOKIE BANNER
======================================== */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #333;
    color: white;
    padding: 20px;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    display: none;
}

.cookie-banner.show {
    display: block;
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.cookie-text {
    flex: 1;
    min-width: 300px;
    text-align: left;
}

.cookie-text h3 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
}

.cookie-text p {
    margin: 0;
    font-size: 0.9em;
    line-height: 1.4;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cookie-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.cookie-btn.accept {
    background-color: #4CAF50;
    color: white;
}

.cookie-btn.accept:hover {
    background-color: #45a049;
}

.cookie-btn.decline {
    background-color: #f44336;
    color: white;
}

.cookie-btn.decline:hover {
    background-color: #da190b;
}

.cookie-btn.settings {
    background-color: #2196F3;
    color: white;
}

.cookie-btn.settings:hover {
    background-color: #0b7dda;
}

/* ========================================
   ANIMATIONEN UND TRANSITIONS
======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(74, 144, 226, 0.3); }
    50% { box-shadow: 0 0 20px rgba(74, 144, 226, 0.6); }
}

.math-button {
    animation: fadeIn 0.6s ease forwards;
}

.sidebar {
    animation: slideInFromLeft 0.8s ease forwards;
}

.content-main {
    animation: fadeIn 1s ease forwards;
}

/* Verschiedene Verzögerungen für die Animation */
.math-button:nth-child(1) { animation-delay: 0.1s; }
.math-button:nth-child(2) { animation-delay: 0.2s; }
.math-button:nth-child(3) { animation-delay: 0.3s; }
.math-button:nth-child(4) { animation-delay: 0.4s; }
.math-button:nth-child(5) { animation-delay: 0.5s; }
.math-button:nth-child(6) { animation-delay: 0.6s; }
.math-button:nth-child(7) { animation-delay: 0.7s; }
.math-button:nth-child(8) { animation-delay: 0.8s; }
.math-button:nth-child(9) { animation-delay: 0.9s; }
.math-button:nth-child(10) { animation-delay: 1.0s; }
.math-button:nth-child(11) { animation-delay: 1.1s; }
.math-button:nth-child(12) { animation-delay: 1.2s; }
.math-button:nth-child(13) { animation-delay: 1.3s; }
.math-button:nth-child(14) { animation-delay: 1.4s; }
.math-button:nth-child(15) { animation-delay: 1.5s; }

/* ========================================
   RESPONSIVE DESIGN
======================================== */

/* Large Screens - Optimal für Klassenzimmer */
@media (min-width: 1400px) {
    .container {
        gap: 15px;
        padding: 15px;
    }
    
    .sidebar {
        width: 400px;
        font-size: 1.15em;
    }
    
    .content-sidebar {
        flex: 0 0 300px;
        font-size: 1.15em;
    }
    
    .content-main {
        font-size: 1.4em;
        padding: 40px;
    }
}

/* Tablet Design */
@media (max-width: 1024px) {
    .content {
        padding: 30px 15px;
    }
    
    .button-grid {
        gap: 25px;
    }
    
    .math-button a {
        padding: 25px 18px;
        font-size: 1.05em;
    }
    
    .content-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
    
    .profile-box,
    .content-card {
        padding: 18px;
    }
    
    /* Container Layout für Tablet */
    .container {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
        width: 100%;
    }
    
    .sidebar {
        width: 100%;
        min-height: auto;
        margin-bottom: 15px;
    }
    
    .main-content {
        width: 100%;
        margin: 0;
        min-height: auto;
    }
    
    .content-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .content-sidebar,
    .content-sidebar-right {
        width: 100%;
        min-width: auto;
        max-height: 300px;
    }
    
    .content-main {
        width: 100%;
        min-width: auto;
    }
}

/* Mobile Large (Landscape phones) */
@media (max-width: 768px) {
    .button-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    header, .header {
        padding: 15px 0;
    }
    
    header h1, .header h1 {
        font-size: 2em;
        margin-bottom: 3px;
    }
    
    header p, .header p {
        font-size: 1.1em;
    }
    
    .user-nav, .navigation {
        padding: 12px 0;
        font-size: 0.95em;
    }
    
    .math-button a {
        padding: 20px 15px;
        font-size: 1em;
        min-height: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .math-button {
        min-height: 100px;
    }
    
    .math-button:hover {
        transform: translateY(-2px);
    }
    
    .content-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .profile-box {
        padding: 15px;
        border-radius: 8px;
    }
    
    .profile-box p {
        margin: 8px 0;
        font-size: 1em;
    }
    
    .content-card {
        padding: 15px;
        border-radius: 8px;
    }
    
    .content-card h3 {
        font-size: 1.2em;
        margin-bottom: 8px;
    }
    
    .content-card p {
        font-size: 0.9em;
        margin-bottom: 12px;
    }
    
    .content-link {
        padding: 6px 12px;
        font-size: 0.9em;
    }
    
    /* Stufen/Themen spezifische Mobile Styles */
    .thema-header {
        padding: 10px;
        font-size: 0.85em;
    }
    
    .unterthemen-list li {
        padding: 6px 12px 6px 25px;
        font-size: 0.8em;
    }
    
    .thema-arrow {
        font-size: 0.7em;
    }
    
    .sidebar {
        padding: 10px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }
    
    .cookie-text {
        text-align: center;
        min-width: auto;
    }
    
    .cookie-buttons {
        justify-content: center;
    }
}

/* Mobile Standard */
@media (max-width: 480px) {
    .button-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-top: 15px;
    }
    
    header, .header {
        padding: 12px 0;
    }
    
    header h1, .header h1 {
        font-size: 1.8em;
        line-height: 1.2;
    }
    
    header p, .header p {
        font-size: 1em;
    }
    
    .content {
        padding: 20px 15px;
    }
    
    .user-nav, .navigation {
        padding: 10px 0;
        font-size: 0.9em;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .user-nav a {
        display: inline-block;
        padding: 8px 12px;
        background-color: rgba(74, 144, 226, 0.1);
        border-radius: 20px;
        transition: background-color 0.3s ease;
    }
    
    .user-nav a:hover {
        background-color: rgba(74, 144, 226, 0.2);
    }
    
    .math-button {
        min-height: 80px;
    }
    
    .math-button a {
        padding: 20px 15px;
        font-size: 0.95em;
        min-height: 70px;
    }
    
    footer {
        padding: 15px 0;
        font-size: 0.9em;
    }
    
    /* Login Container Mobile */
    .login-container {
        padding: 5px;
        min-height: 40vh;
    }
    
    .login-box {
        padding: 20px 15px;
        margin: 0;
        border-radius: 10px;
    }
    
    .login-box h2 {
        font-size: 1.4em;
        margin-bottom: 12px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group input,
    .form-group select {
        padding: 12px 10px;
        font-size: 16px;
        border-radius: 6px;
    }
    
    .login-button, .submit-btn {
        padding: 12px;
        font-size: 15px;
        border-radius: 6px;
    }
    
    .error-message,
    .success-message {
        padding: 8px;
        font-size: 0.9em;
        margin: 10px 0;
    }
}

/* Mobile Extra Small */
@media (max-width: 360px) {
    .content {
        padding: 15px 10px;
    }
    
    header h1, .header h1 {
        font-size: 1.6em;
    }
    
    .math-button a {
        padding: 18px 12px;
        font-size: 0.9em;
        min-height: 65px;
    }
    
    .user-nav, .navigation {
        padding: 8px 0;
        font-size: 0.85em;
    }
    
    .login-box {
        padding: 15px 10px;
    }
    
    .login-box h2 {
        font-size: 1.3em;
    }
    
    .form-group input,
    .form-group select {
        padding: 10px 8px;
        font-size: 16px;
    }
    
    .login-button, .submit-btn {
        padding: 11px;
        font-size: 14px;
    }
}

/* Mobile Utility Classes */
.mobile-hidden {
    display: block;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-hidden {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
    
    .mobile-spacing {
        margin: 10px 0;
    }
    
    ul li {
        margin: 8px 0;
        line-height: 1.4;
    }
}

/* Performance-Optimierungen für Mobile */
@media (max-width: 768px) {
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
    
    .math-button {
        will-change: transform;
        transform: translateZ(0);
    }
    
    .login-button {
        will-change: transform;
        transform: translateZ(0);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .math-button {
        background-color: #2d2d2d;
        border-color: #404040;
    }
    
    .login-box {
        background-color: #2d2d2d;
        color: #e0e0e0;
    }
    
    header, .header {
        background: linear-gradient(135deg, #5a7a9c, #3a70b2);
    }
}

/* ========================================
   BENUTZERTYP-AUSWAHL STYLES
======================================== */

.user-type-selection {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 30px 0;
    max-width: 350px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-type-button {
    display: block;
    text-decoration: none;
    color: inherit;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border: 2px solid #e9ecef;
    border-radius: 18px;
    padding: 25px 20px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.user-type-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.6s;
}

.user-type-button:hover::before {
    left: 100%;
}

.user-type-button:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    border-color: #4a90e2;
    text-decoration: none;
    color: inherit;
}

.user-type-button.schueler:hover {
    border-color: #28a745;
    background: linear-gradient(145deg, #ffffff, #f8fff9);
}

.user-type-button.lehrer:hover {
    border-color: #dc3545;
    background: linear-gradient(145deg, #ffffff, #fff8f8);
}



.user-type-icon {
    font-size: 3em;
    margin-bottom: 15px;
    line-height: 1;
    display: block;
    transition: transform 0.3s ease;
}

.user-type-button:hover .user-type-icon {
    transform: scale(1.1);
}

.user-type-button h3 {
    color: #333;
    font-size: 1.2em;
    font-weight: 700;
    margin: 12px 0 10px 0;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.user-type-button p {
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
    margin: 0;
    transition: color 0.3s ease;
}

/* Responsive für Benutzertyp-Auswahl */
@media (min-width: 768px) {
    .user-type-selection {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
        max-width: 600px;
    }
    
    .user-type-button {
        padding: 30px 25px;
    }
    
    .user-type-button h3 {
        font-size: 1.1em;
        margin: 10px 0 8px 0;
    }
    
    .user-type-button p {
        font-size: 0.85em;
        line-height: 1.3;
    }
}

@media (max-width: 767px) {
    .user-type-button {
        padding: 20px 15px;
    }
    
    .user-type-icon {
        font-size: 2.2em;
        margin-bottom: 10px;
    }
    
    .user-type-button h3 {
        font-size: 1.0em;
        margin: 8px 0 6px 0;
        line-height: 1.2;
    }
    
    .user-type-button p {
        font-size: 0.8em;
        line-height: 1.3;
    }
}

@media (max-width: 480px) {
    .user-type-button {
        padding: 18px 12px;
    }
    
    .user-type-icon {
        font-size: 2em;
        margin-bottom: 8px;
    }
    
    .user-type-button h3 {
        font-size: 0.95em;
        margin: 6px 0 4px 0;
    }
    
    .user-type-button p {
        font-size: 0.75em;
    }
}

/* ========================================
   CONTENT LAYOUT SPECIFIC STYLES
======================================== */

/* Content Container Layout */
.content-container {
    display: flex;
    gap: 12px;
    max-height: 88vh;
    margin-top: 12px;
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
}

.content-sidebar {
    flex: 0 0 280px;
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 22px;
    overflow-y: auto;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    min-width: 280px;
    font-size: 1.1em;
    border: 1px solid #e9ecef;
}

.content-main {
    flex: 1;
    background-color: white;
    border-radius: 10px;
    padding: 40px;
    overflow-y: auto;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    min-width: 500px;
    font-size: 1.35em;
    line-height: 1.8;
    border: 1px solid #e9ecef;
}

.content-sidebar-right {
    flex: 0 0 160px;
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 18px;
    overflow-y: auto;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    min-width: 160px;
    font-size: 1.05em;
    border: 1px solid #e9ecef;
}

/* Thema Container Overrides for Content Pages */
.content-sidebar .thema-container {
    margin-bottom: 20px;
}

.content-sidebar .thema-header {
    padding: 14px 18px;
    background-color: #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
    font-size: 1.05em;
    font-weight: 600;
}

.content-sidebar .thema-header:hover {
    background-color: #dee2e6;
}

.content-sidebar .thema-header.no-arrow {
    cursor: default;
}

.content-sidebar .thema-arrow {
    transition: transform 0.3s ease;
    font-size: 12px;
}

.content-sidebar .thema-arrow.rotated {
    transform: rotate(180deg);
}

.content-sidebar .unterthemen-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 5px 5px;
}

.content-sidebar .unterthemen-container.expanded {
    max-height: 500px;
}

.content-sidebar .unterthemen-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.content-sidebar .unterthemen-list li {
    padding: 16px 22px;
    margin: 0;
    cursor: pointer;
    line-height: 1.6;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
    font-size: 1.15em;
}

.content-sidebar .unterthemen-list li:hover {
    background-color: #f0f8ff;
}

.content-sidebar .unterthemen-list li.active {
    background-color: #4a90e2;
    color: white;
}

.content-sidebar .unterthemen-list li:last-child {
    border-bottom: none;
}

.content-sidebar .unterthema-id {
    color: #666;
    font-size: 0.9em;
    font-style: italic;
}

.content-sidebar .unterthemen-list li.active .unterthema-id {
    color: #ddd;
}

/* Print Styles */
@media print {
    .user-nav,
    .navigation,
    .login-button,
    .submit-btn,
    .additional-links,
    .cookie-banner,
    footer {
        display: none;
    }
    
    .content {
        padding: 0;
    }
    
    .math-button {
        border: 1px solid #000;
        break-inside: avoid;
    }
}

/* ========================================
   KLASSEN-VERWALTUNG STYLES
======================================== */

.klassen-kachel {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.klassen-kachel:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.klassen-kachel.neue-klasse {
    border: 2px dashed #007bff;
    background: #f8f9fa;
}

.klassen-kachel h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.klassen-kachel p {
    margin: 5px 0;
    color: #666;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #000;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.schueler-section {
    border-top: 1px solid #eee;
    padding-top: 20px;
    margin-top: 20px;
}

.schueler-row {
    display: grid;
    grid-template-columns: 80px 1fr 120px 80px;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.schueler-row input[readonly] {
    background: #e9ecef;
}

/* Button Styles */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn:hover {
    opacity: 0.9;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
} 