/* Lesson Sidebar Navigation Styles */

:root {
    --sidebar-width: 300px;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --sidebar-accent: #9b51e0;
    --sidebar-hover: #34495e;
    --sidebar-active-bg: rgba(155, 81, 224, 0.2);
    --sidebar-border: #34495e;
}

/* Layout container - sidebar + content */
.lesson-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar - fills its parent container completely */
.lesson-sidebar {
    width: 100%;
    height: 100%;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
    flex-shrink: 0;
}

/* Sidebar header with course title */
.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 2px solid var(--sidebar-border);
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-course-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--sidebar-text);
    text-decoration: none;
    display: block;
    transition: color 0.2s ease;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.sidebar-course-title:hover {
    color: var(--sidebar-accent);
}

/* Progress section */
.sidebar-progress {
    padding: 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.progress-label {
    font-size: 0.875rem;
    color: var(--sidebar-text);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-percentage {
    font-weight: 600;
    color: var(--sidebar-accent);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sidebar-accent) 0%, #3498db 100%);
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}

/* Lesson navigation menu */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-nav-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(236, 240, 241, 0.6);
    padding: 0.75rem 1.25rem 0.5rem;
    margin: 0;
}

.lesson-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lesson-nav-item {
    margin: 0;
}

.lesson-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    text-decoration: none;
    color: var(--sidebar-text);
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.lesson-nav-link:hover {
    background: var(--sidebar-hover);
    border-left-color: var(--sidebar-accent);
}

.lesson-nav-link.active {
    background: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-accent);
    font-weight: 600;
}

.lesson-nav-link.active .lesson-nav-title {
    color: var(--sidebar-accent);
}

/* Checkbox in sidebar */
.lesson-nav-checkbox {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    position: relative;
}

.lesson-nav-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.lesson-nav-checkbox-custom {
    display: block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(236, 240, 241, 0.3);
    border-radius: 3px;
    background: transparent;
    transition: all 0.2s ease;
    position: relative;
}

.lesson-nav-checkbox input[type="checkbox"]:checked + .lesson-nav-checkbox-custom {
    background: #27ae60;
    border-color: #27ae60;
}

.lesson-nav-checkbox input[type="checkbox"]:checked + .lesson-nav-checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Lesson info in nav */
.lesson-nav-info {
    flex: 1;
    min-width: 0;
}

.lesson-nav-number {
    font-size: 0.75rem;
    color: rgba(236, 240, 241, 0.6);
    margin-bottom: 0.125rem;
}

.lesson-nav-title {
    font-size: 0.9rem;
    color: var(--sidebar-text);
    line-height: 1.4;
    transition: color 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Main content area */
.lesson-content {
    flex: 1;
    overflow-y: auto;
    background: #ffffff;
}

/* Content inner wrapper for padding */
.lesson-content-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

/* Tablet responsive - reduce sidebar width */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 260px;
    }

    .sidebar-header {
        padding: 1.25rem 1rem;
    }

    .sidebar-course-title {
        font-size: 1.1rem;
    }

    .sidebar-progress {
        padding: 1rem;
    }

    .lesson-nav-link {
        padding: 0.75rem 1rem;
    }

    .lesson-content-inner {
        padding: 1.5rem;
    }
}

/* Mobile responsive - overlay sidebar */
@media (max-width: 1100px) {
    /* Mobile: overlay sidebar */
    .lesson-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }

    .lesson-sidebar.open {
        transform: translateX(0);
    }

    .lesson-content {
        width: 100%;
    }

    /* Mobile menu toggle button */
    .sidebar-toggle {
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 999;
        width: 44px;
        height: 44px;
        background: var(--sidebar-bg);
        border: none;
        border-radius: 8px;
        color: var(--sidebar-text);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        transition: all 0.2s ease;
    }

    .sidebar-toggle:hover {
        background: var(--sidebar-hover);
    }

    .sidebar-toggle svg {
        width: 24px;
        height: 24px;
    }

    /* Overlay backdrop when sidebar is open */
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    .sidebar-backdrop.show {
        display: block;
    }
}

@media (max-width: 480px) {
    .lesson-content-inner {
        padding: 1rem;
    }

    .sidebar-course-title {
        font-size: 1rem;
    }

    .lesson-nav-title {
        font-size: 0.85rem;
    }
}

/* Scrollbar styling for sidebar */
.lesson-sidebar::-webkit-scrollbar {
    width: 8px;
}

.lesson-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.lesson-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.lesson-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Print styles - hide sidebar when printing */
@media print {
    .lesson-sidebar {
        display: none;
    }

    .lesson-content {
        width: 100%;
    }

    .sidebar-toggle {
        display: none;
    }
}

/* Close button for mobile sidebar (inside header) */
.sidebar-close-btn {
    display: none;  /* Hidden on desktop */
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Show close button on mobile */
@media (max-width: 1100px) {
    .sidebar-header {
        position: relative;
    }

    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
