:root {
    --primary-color: #007bff;
    --background-light: #f9f9f9;
    --text-color: #333;
    --sidebar-width: 260px;
    --transition-speed: 0.3s;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.05);
    --font-base: "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-base);
    color: var(--text-color);
    background-color: var(--background-light);
    line-height: 1.6;
}

/* Layout */
#layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: #fff;
    border-right: 1px solid #e0e0e0;
    padding: 1.5rem;
    box-shadow: var(--shadow-light);
    transition: transform 0.3s ease;
    transform: translateX(0);
    z-index: 999;
    overflow-y: auto;
}

#sidebar h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

#sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#sidebar li {
    margin-bottom: 0.75rem;
}

#sidebar a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: color var(--transition-speed);
}

#sidebar a:hover {
    color: #0056b3;
    text-decoration: underline;
}

#sidebar.closed {
    transform: translateX(-100%);
}

/* Header */
.header-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: #fff;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 1001;
}

.header-bar h1 {
    margin: 0 auto;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.home-button {
    margin-left: auto;
    padding: 0.5rem 1rem;
    background-color: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    display: inline-block;
    transition: background-color 0.2s ease;
}

.home-button:hover {
    background-color: #e0e0e0;
}

/* Toggle Button */
#sidebarToggle {
    position: relative;
    margin-right: 1rem;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 6px;
    box-shadow: var(--shadow-light);
    z-index: 1002;
}

#sidebarToggle:hover {
    background-color: #0056b3;
}

/* Main Content */
main {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    outline: 2px dashed red;
    margin-top: 100px;
    padding: 2rem;
    background-color: #fff;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.02);
    transition: margin-left var(--transition-speed), width var(--transition-speed);
}

/* Accordion */
.accordion {
    max-width: 800px;
    margin: 2rem auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.accordion-item {
    border-bottom: 1px solid #ddd;
}

.accordion-header {
    width: 100%;
    text-align: left;
    background: #f7f9fc;
    border: none;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
}

.accordion-header:hover {
    background: #e9f2ff;
}

.accordion-header.active {
    background: var(--primary-color);
    color: #fff;
}

.accordion-content {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.accordion-content p,
.accordion-content ul {
    margin: 1rem 0;
}

.small-text {
    font-size: 0.85rem;
    color: #666;
}

/* Overlay for mobile sidebar */
#overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 998;
}

#overlay.active {
    display: block;
}

/* Responsive Sidebar */
@media (max-width: 768px) {
    #layout {
        flex-direction: column;
    }

    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: var(--sidebar-width);
        background: #fff;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
    }

    #sidebar.closed {
        transform: translateX(-100%);
    }

    #sidebar:not(.closed) {
        transform: translateX(0);
    }

    #overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.3);
        z-index: 998;
    }

    #overlay.active {
        display: block;
    }

    main {
        margin-left: 0;
        padding: 1rem;
    }
}

/* Lernraum-Box */
.lernraum-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #fff;
    padding: 1.5rem;
    margin: 1.5rem auto;
    border-radius: 8px;
    box-shadow: var(--shadow-light);
    max-width: 800px;
    width: 100%;
    box-sizing: border-box;
}

.lernraum-box img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    object-fit: cover;
}

.lernraum-text {
    text-align: center;
    margin-top: 1rem;
}

.lernraum-text h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 0;
    line-height: 1.3;
}

/* Responsive Anpassung für Lernraum-Box */
@media (max-width: 768px) {
    .lernraum-box {
        padding: 1rem;
        margin: 1rem;
    }

    .lernraum-text h1 {
        font-size: 1.4rem;
    }
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-light);
}

.card h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.card ul {
    padding-left: 1rem;
    margin: 1rem 0;
}

.small-text {
    font-size: 0.85rem;
    color: #666;
}

.card:nth-child(1) {
    border-left: 6px solid #007bff;
}

.card:nth-child(2) {
    border-left: 6px solid #28a745;
}

.card:nth-child(3) {
    border-left: 6px solid #ffc107;
}

.card:nth-child(4) {
    border-left: 6px solid #e83e8c;
}

.card-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.nowrap {
    white-space: nowrap;
}

#subchapter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    overflow-y: auto;
    padding: 2rem;
}

#subchapter-overlay.hidden {
    display: none;
}