/* ============================================== */
/* COURSE LEARNING VIEW — learning.css            */
/* ============================================== */

/* Page layout container */
.learning-container {
    max-width: 100vw;
    margin: 5rem 0 0 0; /* Align directly below the 5rem navbar */
    padding: 0;
    display: grid;
    grid-template-columns: 73% 27%;
    grid-template-areas:
        "breadcrumb sidebar"
        "video sidebar"
        "details sidebar";
    gap: 0; /* Flush alignment */
    align-items: start;
    background: #f8fafc;
    overflow-x: hidden;
}

/* Breadcrumb navigation */
.learning-breadcrumb {
    grid-area: breadcrumb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1.5rem 3rem 1.5rem 3rem;
    background: white;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    box-sizing: border-box;
}

.learning-breadcrumb a {
    color: var(--text-dim);
    transition: color 0.2s;
    text-decoration: none;
}

.learning-breadcrumb a:hover {
    color: var(--primary);
}

.learning-breadcrumb span {
    color: var(--text-muted);
}

/* Back button */
.btn-workspace-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.95rem;
    background: white;
    border: 1px solid var(--glass-border);
    color: var(--text-dim) !important;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.btn-workspace-back:hover {
    background: var(--bg-alt);
    border-color: var(--primary-light);
    color: var(--primary) !important;
    transform: translateX(-2px);
}

.btn-workspace-back svg {
    transition: transform 0.2s ease;
}

.btn-workspace-back:hover svg {
    transform: translateX(-2px);
}

/* Video Player section */
.learning-video-section {
    grid-area: video;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #000;
}

.video-player-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #000;
    overflow: hidden;
}

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

/* Navigation controls under the video */
.video-nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 3rem;
    background: white;
    border-bottom: 1px solid var(--glass-border);
    box-sizing: border-box;
}

.btn-video-nav {
    padding: 0.75rem 1.5rem;
    background: white;
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.btn-video-nav:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(88, 80, 236, 0.08);
}

.btn-video-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-alt);
}

/* Lesson Metadata Title inside Card */
.lesson-header-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.lesson-meta-titles {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: left;
}

.learning-course-title {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 0.08em;
}

.learning-lesson-title {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 900;
    color: var(--text-main);
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.lesson-duration-badge {
    background: rgba(88, 80, 236, 0.08);
    color: var(--primary);
    padding: 0.4rem 0.85rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Lesson Content Details Card */
.lesson-details-card {
    grid-area: details;
    background: white;
    border: none;
    border-right: 1px solid var(--glass-border);
    border-radius: 0;
    padding: 3rem;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    box-sizing: border-box;
    min-height: 50vh;
}

.lesson-details-card h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
    border-bottom: 1px solid var(--bg-alt);
    padding-bottom: 0.5rem;
    margin-top: 0.5rem;
    text-align: left;
}

.lesson-description-text {
    font-size: 1.05rem;
    color: var(--text-dim);
    line-height: 1.7;
    text-align: left;
}

.lesson-notes-content {
    font-size: 1rem;
    color: var(--text-dim);
    line-height: 1.75;
    text-align: left;
}

.lesson-code-block {
    margin: 1.5rem 0;
}

.lesson-code-block pre {
    background: #1e1e1e; /* High contrast dark code theme */
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: 'Consolas', 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    text-align: left;
    direction: ltr;
    line-height: 1.5;
}

/* Download resources list styling */
.resources-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.resource-download-link {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1.25rem;
    background: var(--bg-alt);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-dim);
    font-weight: 700;
    font-size: 0.92rem;
    transition: all 0.2s ease;
    align-self: flex-start;
    text-decoration: none;
}

.resource-download-link:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: var(--primary);
    transform: translateY(-1px);
}

.resource-download-link svg {
    color: var(--primary);
    flex-shrink: 0;
}

/* RIGHT SIDEBAR: Curriculum panel */
.learning-sidebar {
    grid-area: sidebar;
    background: white;
    border: none;
    border-left: 1px solid var(--glass-border);
    border-radius: 0;
    box-shadow: none;
    position: sticky;
    top: 5rem; /* Matches navbar top margin */
    height: calc(100vh - 5rem);
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Sidebar scrollbar styles */
.learning-sidebar::-webkit-scrollbar {
    width: 6px;
}

.learning-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.learning-sidebar::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 3px;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    background: var(--bg-alt);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.sidebar-header h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
    text-align: left;
}

/* Sidebar progress tracking bar */
.progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(17, 24, 39, 0.05);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.progress-text {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-align: left;
}

/* Curriculum expandable module list */
.curriculum-list {
    display: flex;
    flex-direction: column;
}

.curriculum-module {
    border-bottom: 1px solid var(--glass-border);
}

.curriculum-module-header {
    width: 100%;
    padding: 1.15rem 1.5rem;
    background: none;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    transition: background-color 0.2s;
}

.curriculum-module-header:hover {
    background-color: var(--bg-alt);
}

.curriculum-module-header::after {
    content: "▼";
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
}

.curriculum-module.active .curriculum-module-header::after {
    transform: rotate(180deg);
}

.curriculum-module-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
    background: #fafbfd;
}

.curriculum-module.active .curriculum-module-body {
    max-height: 1000px;
    transition: max-height 0.3s cubic-bezier(1, 0, 1, 0);
}

/* Lesson Items list */
.lesson-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lesson-item {
    padding: 0.88rem 1.5rem;
    border-top: 1px solid rgba(17, 24, 39, 0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dim);
    transition: all 0.2s ease;
    text-align: left;
}

.lesson-item:hover {
    background: rgba(88, 80, 236, 0.03);
    color: var(--primary);
}

.lesson-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    border-left: 4px solid var(--primary);
    padding-left: calc(1.5rem - 4px);
}

.lesson-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-grow: 1;
    overflow: hidden;
}

.lesson-name {
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
}

.completion-icon {
    font-size: 1rem;
    color: var(--text-muted);
    flex-shrink: 0;
    user-select: none;
}

.lesson-item.completed .completion-icon {
    color: var(--success);
}

.lesson-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    flex-shrink: 0;
    margin-left: 0.75rem;
}

.lesson-item.active .lesson-duration {
    color: var(--primary);
}

/* Responsive media queries */
@media (max-width: 1024px) {
    .learning-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "breadcrumb"
            "video"
            "sidebar"
            "details";
        gap: 0;
        margin-top: 5rem;
        max-width: 100vw;
    }
    
    .learning-breadcrumb {
        padding: 1rem 1.5rem;
    }
    
    .video-nav-buttons {
        padding: 1rem 1.5rem;
    }
    
    .lesson-details-card {
        padding: 2rem 1.5rem;
        border-right: none;
    }
    
    .learning-sidebar {
        position: static;
        max-height: 400px;
        width: 100%;
        border-left: none;
        border-bottom: 1px solid var(--glass-border);
        height: auto;
    }
}

@media (max-width: 768px) {
    .learning-container {
        margin-top: 5rem;
    }
}
