/* =========================================================
   Learn Page - Immersive Learning Interface
   ========================================================= */

/* ---------- General ---------- */
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #f8f9fa;
}

.min-width-0 {
    min-width: 0;
}

/* ---------- Top Navbar ---------- */
.learn-navbar {
    height: 48px;
    z-index: 1030;
    background-color: #1a1a2e !important;
    border-bottom: 2px solid #FF0000;
}

/* ---------- Wrapper ---------- */
.learn-wrapper {
    height: calc(100vh - 48px);
}

/* ---------- Sidebar ---------- */
.learn-sidebar {
    width: 320px;
    min-width: 320px;
    background: #1a1d23;
    color: #c9d1d9;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.learn-sidebar.collapsed {
    margin-left: -320px;
}

.sidebar-header {
    background: #21252b;
    color: #e6edf3;
    border-bottom: 1px solid #30363d !important;
    flex-shrink: 0;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
}

/* Custom scrollbar for sidebar */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}
.sidebar-content::-webkit-scrollbar-track {
    background: #1a1d23;
}
.sidebar-content::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 3px;
}
.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* Section header */
.section-group {
    border-bottom: 1px solid #21252b;
}

.section-header {
    background: #21252b;
    color: #8b949e;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Lesson items */
.lesson-item {
    color: #c9d1d9;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.lesson-item:hover {
    background: #21252b;
    color: #e6edf3;
    text-decoration: none;
}

.lesson-item.active {
    background: #0d1117;
    color: #00A0FD;
    border-left-color: #00A0FD;
}

.lesson-duration {
    font-size: 0.7rem;
    color: #6e7681;
    margin-top: 2px;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1019;
}

.sidebar-overlay.active {
    display: block;
}

/* ---------- Main Content ---------- */
.learn-content {
    overflow-y: auto;
    background: #fff;
}

/* ---------- Video Section ---------- */
.video-section {
    background: #000;
    width: 100%;
    padding-top: 15px;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 56.25%; /* 16:9 ratio via padding trick - works everywhere */
    height: 0;
    background: #000;
}

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

.video-lang-bar {
    background: #1a1d23;
}

.video-lang-badge {
    background: #30363d;
    color: #c9d1d9;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 4px 10px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.video-lang-badge:hover {
    background: #484f58;
    color: #e6edf3;
}

.video-lang-badge.active {
    background: #00A0FD;
    color: #fff;
}

/* ---------- Lesson Body ---------- */
.lesson-body {
    max-width: 900px;
    margin: 0 auto;
}

.lesson-title {
    font-weight: 700;
    color: #1a1d23;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.75rem;
}

/* Lesson content HTML styling */
.lesson-content {
    line-height: 1.8;
    font-size: 1rem;
    color: #333;
}

.lesson-content h1,
.lesson-content h2,
.lesson-content h3,
.lesson-content h4,
.lesson-content h5,
.lesson-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #1a1d23;
}

.lesson-content p {
    margin-bottom: 1em;
}

.lesson-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
}

.lesson-content pre {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    font-size: 0.9rem;
}

.lesson-content code {
    background: #f6f8fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.lesson-content pre code {
    background: transparent;
    padding: 0;
}

.lesson-content blockquote {
    border-left: 4px solid #00A0FD;
    padding: 0.5em 1em;
    margin: 1em 0;
    background: #f0f7ff;
    border-radius: 0 6px 6px 0;
}

.lesson-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.lesson-content th,
.lesson-content td {
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    text-align: left;
}

.lesson-content th {
    background: #f8f9fa;
    font-weight: 600;
}

/* ---------- Attachments ---------- */
.attachments-section h5 {
    color: #495057;
    font-weight: 600;
}

/* ---------- Quiz Section ---------- */
.quiz-card {
    border: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

.quiz-card .card-header {
    border-radius: 0;
    padding: 1rem 1.25rem;
}

.question-block {
    background: #fafbfc;
    border-radius: 8px !important;
    transition: border-color 0.3s ease;
}

.question-block p.fw-bold {
    color: #1a1d23;
}

.form-check {
    padding: 8px 8px 8px 2em;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.form-check:hover {
    background: #e9ecef;
}

.form-check-input:checked {
    background-color: #00A0FD;
    border-color: #00A0FD;
}

.form-check-label {
    cursor: pointer;
    user-select: none;
}

/* Quiz results styling */
.question-block.border-success {
    background: #d1e7dd;
}

.question-block.border-danger {
    background: #f8d7da;
}

/* ---------- Lesson Navigation ---------- */
.lesson-navigation {
    border-top: 1px solid #e9ecef;
    padding-top: 1rem;
}

.lesson-navigation .btn {
    flex: 1;
    white-space: nowrap;
    min-width: 0;
    font-size: 0.9rem;
    padding: 8px 12px;
}

/* ---------- Progress Bar ---------- */
.progress {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.progress-bar {
    background-color: #FF914D;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .learn-sidebar {
        position: fixed;
        top: 48px;
        left: -320px;
        bottom: 0;
        z-index: 1020;
        transition: left 0.3s ease;
    }

    .learn-sidebar.open {
        left: 0;
    }
}

@media (max-width: 991.98px) {
    /* On mobile/tablet: normal scrollable page instead of immersive flex layout */
    body {
        overflow: auto !important;
    }

    .learn-wrapper {
        display: block !important;
        height: auto !important;
    }

    .learn-content {
        overflow: visible !important;
    }
}

@media (max-width: 575.98px) {
    .learn-sidebar {
        width: 280px;
        min-width: 280px;
    }

    .lesson-body {
        padding: 1rem !important;
    }

    .lesson-title {
        font-size: 1.25rem;
    }

    .lesson-navigation .btn {
        font-size: 0.8rem;
        padding: 6px 8px;
    }
}

/* ---------- Custom Scrollbar (main content) ---------- */
.learn-content::-webkit-scrollbar {
    width: 8px;
}
.learn-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.learn-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}
.learn-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
