/* ========================================================
   FIXED VIEWPORT & INDEPENDENT SCROLLING LAYOUT
   ======================================================== */
.course-viewer-page {
    /* Calculates viewport height minus the navbar height (60px) */
    height: calc(100vh - 60px);
    overflow: hidden; 
    background-color: var(--bg-main);
}

.course-layout {
    display: flex;
    height: 100%;
    width: 100%;
}

/* ========================================================
   LEFT SIDEBAR NAVIGATION
   ======================================================== */
.course-sidenav {
    width: 320px;
    min-width: 320px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    height: 100%;
    overflow-y: auto; /* Independent vertical scrollbar */
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Custom Scrollbar styling for sidebar */
.course-sidenav::-webkit-scrollbar,
.course-content-area::-webkit-scrollbar {
    width: 6px;
}

.course-sidenav::-webkit-scrollbar-track,
.course-content-area::-webkit-scrollbar-track {
    background: var(--bg-main);
}

.course-sidenav::-webkit-scrollbar-thumb,
.course-content-area::-webkit-scrollbar-thumb {
    background: var(--border-highlight);
    border-radius: 3px;
}

.course-info-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.course-nav-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.35rem;
}

.course-nav-category {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 0.5px;
}

/* Section Accordions / Accordion Headers */
.nav-section-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-section-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-topic-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-topic-item {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.825rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.35;
}

.nav-topic-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-topic-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    font-weight: 600;
}

/* ========================================================
   RIGHT CONTENT AREA
   ======================================================== */
.course-content-area {
    flex-grow: 1;
    height: 100%;
    overflow-y: auto; /* Independent vertical scrollbar */
    padding: 2.5rem 3rem;
}

.content-max-wrapper {
    max-width: 860px;
    margin: 0 auto;
}

.topic-header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.topic-breadcrumb {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.topic-breadcrumb span {
    color: var(--primary);
}

.topic-main-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.25;
}

/* Topic Body Formatting */
.topic-body {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.topic-body h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 1rem;
}

.topic-body p {
    color: var(--text-secondary);
}

/* Video Frame Container */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: #000;
    border: 1px solid var(--border-color);
    margin: 1rem 0;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Topic Action Footer */
.topic-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ========================================================
   RESPONSIVE TUNING
   ======================================================== */
@media (max-width: 991px) {
    .course-viewer-page {
        height: auto;
        overflow: visible;
    }

    .course-layout {
        flex-direction: column;
    }

    .course-sidenav {
        width: 100%;
        min-width: 100%;
        height: auto;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .course-content-area {
        height: auto;
        padding: 1.5rem 1rem;
    }
}