:root {
    --accent-color: #F87415;
    --accent-color-2: #ff9a4d;
    --primary-color: #F87415;
    --secondary-color: #ff9a4d;
    --background-color: #ffffff;
    --sidebar-bg: #ffffff;
    --text-color: #333;
    --completed-color: #28a745;
    --hover-bg: #e9ecef;
    --card-bg: #ffffff;
    --border-color: #eee;
    --header-height: 84px;
}

:root[data-theme="dark"] {
    --primary-color: #F87415;
    --secondary-color: #ff9a4d;
    --background-color: #0f1419;
    --sidebar-bg: #161d24;
    --text-color: #e6e6e6;
    --completed-color: #3ddc97;
    --hover-bg: rgba(255,255,255,0.06);
    --card-bg: #1b232b;
    --border-color: rgba(255,255,255,0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    display: flex;
    height: 100vh;
    background-color: var(--background-color);
    color: var(--text-color);
}

html, body {
    height: 100%;
    overflow: hidden;
}

#sidebar {
    width: 360px;
    background: var(--sidebar-bg);
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sidebar-header {
    padding: 20px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.5em;
}

.header-actions button {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

@media (max-width: 768px) {
    .header-actions #sidebar-toggle { display: none; }
}

.header-actions button:hover {
    background: var(--hover-bg);
}

.lesson-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

.sidebar-tag {
    padding: 10px 20px;
    background-color: #dc3545;
    color: #fff;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85em;
}

.lesson-list li .sidebar-tag {
    display: block;
    border-bottom: 1px solid #eee;
}

.lesson-list li a {
    display: flex;
    align-items: flex-start;
    padding: 15px 20px;
    text-decoration: none;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
    gap: 10px;
}

.lesson-list li a:hover {
    background-color: var(--hover-bg);
}

.lesson-list li a.active {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.lesson-list li a .status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0;
    font-size: 0.9em;
    width: 28px;
    height: 24px;
    text-align: center;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.lesson-title {
    flex: 1;
    white-space: normal;
    word-break: break-word;
    line-height: 1.25;
    font-size: 0.95em;
}

.module-tag {
    padding: 12px 20px;
    background-color: var(--card-bg);
    color: var(--text-color);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85em;
    border-bottom: 1px solid var(--border-color);
}

.lesson-list li a.completed .status-icon::before {
    content: '✔';
    color: var(--completed-color);
    font-weight: bold;
}

.lesson-list li a.completed .status-icon {
    color: transparent;
}

#content-area {
    flex-grow: 1;
    padding: 0;
    margin-top: var(--header-height);
    height: calc(100vh - var(--header-height));
    background: var(--background-color);
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}
.lesson-list li a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 8px;
}

.lesson-list li a.last-visited {
    border-left: 4px solid var(--primary-color);
    background-color: rgba(248, 116, 21, 0.08);
}

.site-header { position: fixed; top: 0; left: 360px; right: 0; background: var(--background-color); border: none; box-shadow: none; height: var(--header-height); z-index: 800; display: flex; align-items: center; }
.site-header .header-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: center; }
.site-header .site-logo { max-height: 64px; width: auto; height: auto; display: block; }
@media (max-width: 768px) { .site-header { left: 0; } }
@media (max-width: 600px) { .site-header .site-logo { max-height: 80px; } }

.lesson-list li a.completed .status-icon {
    background: rgba(61, 220, 151, 0.15);
    color: #3ddc97;
    border-color: rgba(61, 220, 151, 0.4);
}
#sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
}

@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        right: 0;
        left: auto;
        top: 0;
        height: 100vh;
        width: 80vw;
        max-width: 360px;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        z-index: 1000;
    }
    #sidebar.open { transform: translateX(0); }
    #sidebar-overlay.show { display: block; z-index: 900; }
    #content-area { margin-top: var(--header-height); height: calc(100vh - var(--header-height)); }
}

.sidebar-handle {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 24px;
    height: 64px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px 0 0 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    display: none;
    z-index: 1100;
}

.sidebar-handle.hidden { display: none; }

@media (max-width: 768px) {
    .sidebar-handle { display: block; }
}
