﻿/**
 * Learn Page Styles
 * Modern, responsive, performant design for course learning interface
 */

/* ==========================================================================
   Variables & Base
   ========================================================================== */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --secondary-color: #6b7280;
    --bg-dark: #1f2937;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --sidebar-width: 280px;
    --header-height: 48px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* ==========================================================================
   Layout Container
   ========================================================================== */
.modern-learning-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-light);
}

/* ==========================================================================
   Header - Ultra Compact with Navigation
   ========================================================================== */
.learning-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    height: 100%;
    gap: 0.5rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
    position: relative;
    z-index: 2;
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-shrink: 1;
    flex-wrap: nowrap;
    position: relative;
    z-index: 1;
    min-width: 0;
    overflow: hidden;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.course-info {
    min-width: 0;
    flex-direction: column;
    line-height: 1.2;
    max-width: 400px;
}

/* Show course-info only on md and up screens (handled in HTML with Bootstrap classes) */
@media (min-width: 768px) {
    .course-info {
        display: flex;
    }
}

@media (max-width: 767.98px) {
    .course-info {
        display: none !important;
    }
}

.course-title {
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-indicator {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Instructor name in header */
.instructor-info {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: all 0.2s ease;
}

.instructor-info:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.instructor-info:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

.instructor-info:focus,
.instructor-info:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.instructor-info i {
    font-size: 0.8rem;
    opacity: 0.7;
}

.instructor-info .instructor-name {
    font-weight: 500;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile: show only icon, make it more prominent */
@media (max-width: 767.98px) {
    .instructor-info {
        padding: 0.375rem;
        min-width: 32px;
        min-height: 32px;
        justify-content: center;
    }

    .instructor-info i {
        font-size: 1rem;
        opacity: 1;
    }
}

/* Icon Buttons */
.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    outline: none;
}

.btn-icon:focus,
.btn-icon:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-icon i {
    font-size: 1rem;
}

/* Navigation Buttons */
.btn-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    outline: none;
}

.btn-nav:focus,
.btn-nav:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.btn-nav:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.2);
}

.btn-nav.primary {
    background: var(--primary-color);
}

.btn-nav.primary:hover:not(.disabled) {
    background: var(--primary-hover);
}

.btn-nav.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Next button styling - colored variant */
.btn-nav.next {
    background: var(--primary-color);
    color: white;
}

.btn-nav.next:hover:not(.disabled) {
    background: var(--primary-hover);
}

.btn-nav.next.disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
}

.btn-nav i {
    font-size: 0.85rem;
}

/* Completion Button in Header */
.completion-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 6px;
    transition: all 0.2s ease;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    outline: none;
}

.completion-btn:focus,
.completion-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.completion-btn i {
    flex-shrink: 0;
}

/* Mobile: show only icon */
@media (max-width: 767.98px) {
    .completion-btn {
        padding: 0.375rem 0.5rem;
        max-width: none;
    }

    .completion-btn .completion-btn-text {
        display: none;
    }

    .completion-btn i {
        margin: 0 !important;
    }
}

/* Tablet: shorter text */
@media (min-width: 768px) and (max-width: 991.98px) {
    .completion-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        max-width: 150px;
    }

    .completion-btn .completion-btn-text {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Progress Indicator in Header */
.progress-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.progress-indicator .progress-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.progress-indicator .progress-bar-mini {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-indicator .progress-bar-mini .fill {
    height: 100%;
    background: var(--success-color);
    transition: width 0.3s ease;
}

/* Time & Status Badges */
.time-badge {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    min-width: 52px;
    justify-content: center;
}

.time-badge span {
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: center;
}

.time-badge i {
    font-size: 0.7rem;
    opacity: 0.7;
    flex-shrink: 0;
}

.status-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    min-width: 52px;
    text-align: center;
}

.status-badge i {
    font-size: 0.85rem;
}

/* ==========================================================================
   Main Layout
   ========================================================================== */
.learning-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.lessons-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all var(--transition-normal);
    z-index: 50;
}

.lessons-sidebar.sidebar-hidden {
    width: 0;
    min-width: 0;
    border-right: none;
    opacity: 0;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0.75rem;
    max-height: calc(100vh - var(--header-height));
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* On short screens, make entire sidebar scrollable instead of just lessons list */
@media (max-height: 600px) {
    .sidebar-content {
        overflow-y: auto;
    }

    /* Allow all sections to shrink on very short screens */
    .progress-section-compact,
    .quiz-section,
    .certificate-section {
        flex-shrink: 1;
    }

    /* Ensure lessons-section has minimum height */
    .lessons-section {
        min-height: 150px;
    }

    /* Compact mobile course info */
    .mobile-course-info {
        padding: 0.375rem 0.5rem;
        margin-bottom: 0.375rem;
    }

    .mobile-course-info .course-title {
        font-size: 0.65rem;
    }

    .mobile-course-info .lesson-indicator {
        font-size: 0.75rem;
    }

    /* Compact progress section */
    .progress-section-compact {
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.5rem;
    }

    /* Compact quiz section */
    .quiz-section {
        max-height: 120px;
        padding-top: 0.5rem;
        margin-top: 0.375rem;
    }

    /* Compact certificate section */
    .certificate-section {
        padding-top: 0.5rem;
    }

    .certificate-card {
        padding: 0.5rem;
    }
}

/* Very short screens (landscape mobile) */
@media (max-height: 450px) {
    .sidebar-content {
        padding: 0.5rem;
    }

    /* Hide non-essential elements */
    .mobile-course-info {
        display: none !important;
    }

    .progress-section-compact {
        padding: 0.375rem 0.5rem;
        margin-bottom: 0.375rem;
    }

    .progress-section-compact .progress-label,
    .progress-section-compact .progress-value {
        font-size: 0.65rem;
    }

    /* Reduce quiz section height */
    .quiz-section {
        max-height: 80px;
    }

    /* Compact lessons */
    .lessons-section {
        min-height: 100px;
    }

    .lesson-button {
        padding: 6px 8px;
    }

    .lesson-icon {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }

    .lesson-details .lesson-title {
        font-size: 0.75rem;
    }
}

/* Mobile Course Info in Sidebar - visible only on mobile */
.mobile-course-info {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.5rem;
}

/* Show mobile-course-info only on mobile (< md) screens */
@media (min-width: 768px) {
    .mobile-course-info {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .mobile-course-info {
        display: block !important;
    }
}

.mobile-course-info .course-title {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.125rem;
}

.mobile-course-info .lesson-indicator {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    line-height: 1.3;
}

/* Progress Section - Compact */
.progress-section-compact {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: white;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.progress-section-compact .progress-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.progress-section-compact .progress-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

.progress-section-compact .progress-value {
    font-size: 0.9rem;
    font-weight: 700;
}

.progress-section-compact .progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-section-compact .progress-bar {
    background: white;
    height: 100%;
    transition: width var(--transition-normal);
}

/* Legacy - kept for compatibility */
.progress-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: white;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.progress-section .progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-section .progress-bar {
    background: white;
    height: 100%;
    transition: width var(--transition-normal);
}

/* ==========================================================================
   ELEGANT LESSONS TIMELINE - REDESIGNED FROM SCRATCH
   ========================================================================== */

/* Lessons Section Container - Fixed title, scrollable list */
.lessons-section {
    margin-bottom: 0.5rem;
    flex: 1 1 auto;
    min-height: 320px; /* Ensure minimum visibility even on short screens */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lessons-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-left: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
    background: white;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.lessons-title i {
    font-size: 0.85rem;
    color: var(--primary-color);
}

/* Modern Timeline Container - Scrollable */
.lessons-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(79, 70, 229, 0.3) transparent;
}

/* Custom scrollbar for lessons list */
.lessons-list::-webkit-scrollbar {
    width: 6px;
}

.lessons-list::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.lessons-list::-webkit-scrollbar-thumb {
    background: rgba(79, 70, 229, 0.3);
    border-radius: 3px;
}

.lessons-list::-webkit-scrollbar-thumb:hover {
    background: rgba(79, 70, 229, 0.5);
}

/* Elegant Timeline Spine */
.lessons-list::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 20px;
    bottom: 20px;
    width: 2px;
    background: linear-gradient(180deg,
        var(--primary-color) 0%,
        var(--success-color) 50%,
        #e2e8f0 100%);
    border-radius: 1px;
    z-index: 0;
    opacity: 0.3;
}

/* Lesson Card - Modern Glassmorphism */
.lesson-card {
    position: relative;
    display: flex;
    padding-left: 40px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: 2px;
    padding-right: 2px;
}

/* Timeline Node - Elegant Dots */
.lesson-card::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 18px;
    width: 10px;
    height: 10px;
    background: white;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    z-index: 2;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
}

/* Lesson Card Hover Effect */
.lesson-card:hover::before {
    transform: scale(1.3);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Completed Lesson - Success State */
.lesson-card.completed::before {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #10b981;
    border-width: 3px;
    width: 12px;
    height: 12px;
    top: 17px;
    left: 13px;
}

.lesson-card.completed::after {
    content: '✓';
    position: absolute;
    left: 15.5px;
    top: 17px;
    color: white;
    font-size: 9px;
    font-weight: 900;
    z-index: 3;
    pointer-events: none;
}

/* Current Lesson - Active State with Pulse */
.lesson-card.current::before {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    border-color: var(--primary-color);
    border-width: 3px;
    width: 14px;
    height: 14px;
    top: 16px;
    left: 12px;
    animation: elegant-pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes elegant-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.5),
                    0 0 0 0 rgba(79, 70, 229, 0.3);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(79, 70, 229, 0),
                    0 0 0 16px rgba(79, 70, 229, 0);
    }
}

/* Locked Lesson - Disabled State */
.lesson-card.locked::before {
    background: #f1f5f9;
    border-color: #cbd5e1;
    opacity: 0.5;
}

/* Lesson Button - Compact Glass Card Design */
.lesson-button {
    flex: 1;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 0.7) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-align: left;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Shine Effect on Hover */
.lesson-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent);
    transition: left 0.6s ease;
}

.lesson-button:hover:not(:disabled)::before {
    left: 100%;
}

.lesson-button:hover:not(:disabled) {
    transform: translateY(-2px) translateX(2px);
    border-color: rgba(79, 70, 229, 0.3);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.12),
                0 4px 8px rgba(0, 0, 0, 0.08);
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 1) 0%,
        rgba(249, 250, 251, 1) 100%);
}

.lesson-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    filter: grayscale(0.3);
}

/* Current Lesson - Premium Highlight */
.lesson-card.current .lesson-button {
    background: linear-gradient(135deg,
        #eef2ff 0%,
        #e0e7ff 50%,
        #ddd6fe 100%);
    border: 1.5px solid rgba(79, 70, 229, 0.4);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.2),
                0 2px 4px rgba(79, 70, 229, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.lesson-card.current .lesson-button:hover:not(:disabled) {
    transform: translateY(-2px) translateX(2px);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.25),
                0 4px 8px rgba(79, 70, 229, 0.15);
}

/* Completed Lesson - Success Accent */
.lesson-card.completed .lesson-button {
    background: linear-gradient(135deg,
        #f0fdf4 0%,
        #dcfce7 100%);
    border: 1.5px solid rgba(16, 185, 129, 0.25);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
}

.lesson-card.completed .lesson-button:hover:not(:disabled) {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.15);
}

/* Locked Lesson - Subtle Disabled */
.lesson-card.locked .lesson-button {
    background: linear-gradient(135deg,
        #f8fafc 0%,
        #f1f5f9 100%);
    border-color: #e2e8f0;
}

.lesson-card.locked .lesson-button:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Lesson Icon - Compact Badge */
.lesson-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-radius: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.lesson-card.current .lesson-icon {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.lesson-card.completed .lesson-icon {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.lesson-card.locked .lesson-icon {
    background: #e2e8f0;
    color: #94a3b8;
}

/* Lesson Content */
.lesson-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lesson-details .lesson-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.lesson-card.current .lesson-title {
    color: var(--primary-color);
    font-weight: 700;
}

.lesson-card.completed .lesson-title {
    color: #059669;
}

.lesson-card.locked .lesson-title {
    color: #94a3b8;
}

/* Lesson Meta Info */
.lesson-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: #64748b;
    flex-wrap: wrap;
    align-items: center;
}

.lesson-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(226, 232, 240, 0.5);
    border-radius: 6px;
}

.lesson-meta i {
    font-size: 0.7rem;
}

/* Progress Bar - Elegant Design */
.lesson-progress {
    margin-top: 8px;
}

.lesson-progress .progress {
    height: 5px;
    background: linear-gradient(90deg, #e2e8f0 0%, #cbd5e1 100%);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.lesson-progress .progress-bar {
    background: linear-gradient(90deg,
        var(--primary-color) 0%,
        #6366f1 50%,
        #8b5cf6 100%);
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(79, 70, 229, 0.4);
    position: relative;
    overflow: hidden;
}

/* Animated Progress Shine */
.lesson-progress .progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.5),
        transparent);
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Quiz Section - Compact */
.quiz-section {
    margin-bottom: 0.5rem;
    flex-shrink: 0;
    max-height: 180px;
    overflow-y: auto;
    scrollbar-width: thin;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

.quiz-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    position: sticky;
    top: 0;
    background: white;
    /*padding: 0.25rem 0;*/
    z-index: 1;
}

.quiz-title i {
    font-size: 0.85rem;
    color: var(--warning-color);
}

.quiz-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quiz-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.quiz-item:hover {
    border-color: var(--primary-color);
    background: #fafafa;
}

.quiz-item.completed {
    background: #f0fdf4;
    border-color: var(--success-color);
}

.quiz-item.locked {
    opacity: 0.6;
}

.quiz-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.quiz-content {
    flex: 1;
    min-width: 0;
}

.quiz-item-title {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quiz-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    display: none;
}

.quiz-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

/* Certificate Section - Compact */
.certificate-section {
    margin-top: 0.5rem;
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
}

.certificate-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.certificate-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.certificate-content h6 {
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
    color: #92400e;
}

.certificate-content p {
    font-size: 0.7rem;
    margin: 0.125rem 0 0.5rem;
    color: #78350f;
}

.certificate-content .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.lesson-content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: white;
    transition: all var(--transition-normal);
}

/* Lesson Header Section - Title & Description */
.lesson-header-section {
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(to bottom, #f8fafc, #ffffff);
}

.lesson-title-main {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

.lesson-description-main {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .lesson-header-section {
        padding: 1rem 1rem 0.75rem;
    }

    .lesson-title-main {
        font-size: 1.15rem;
    }

    .lesson-description-main {
        font-size: 0.875rem;
    }
}

/* No need for sidebar-hidden class - flex: 1 handles it automatically */

/* Lesson Top Bar - Compact and Clean */
.lesson-top-bar {
    background: linear-gradient(to right, #f8fafc, #ffffff);
    border-bottom: 2px solid var(--primary-color);
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.lesson-info {
    display: inline;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: #64748b;
    font-style: normal;
    font-weight: 500;
    margin-top: 0.25rem;
}

    .lesson-info::before {
        content: '🕓';
        font-family: 'bootstrap-icons';
        font-size: 0.85rem;
        color: #94a3b8;
    }

.lesson-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.lesson-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

.lesson-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.time-tracker {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.375rem 0.75rem;
    background: var(--bg-light);
    border-radius: 4px;
}

.lesson-controls {
    display: flex;
    gap: 0.5rem;
}

.lesson-badge .badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

/* Course Time Stats - More Compact */
.course-time-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.7rem;
    background: var(--bg-light);
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
}

.time-stat-compact {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
}

.stat-label {
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    color: var(--text-primary);
}

.time-progress-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-bar-mini {
    width: 80px;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-mini .fill {
    height: 100%;
    background: var(--primary-color);
    transition: width var(--transition-normal);
}

.progress-text-mini {
    font-weight: 700;
    color: var(--primary-color);
}

/* Timer display removed - no longer needed */

.timer-info {
    margin-top: 0.5rem;
}

/* ==========================================================================
   Lesson Content Display
   ========================================================================== */
.lesson-content-display {
    flex: 1;
    padding: 1rem 1.5rem;
    position: relative;
    z-index: 1;
    overflow-y: auto;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    /* Prevent content overflow */
    overflow-x: hidden;
}

/* TTS Audio Section - Responsive */
.tts-audio-section {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid var(--success-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

.tts-audio-section.unavailable {
    background: #f9fafb;
    border-color: var(--border-color);
}

.audio-player-compact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.audio-player-compact audio {
    flex: 1;
    min-width: 250px;
    max-width: 100%;
    height: 36px;
}

.audio-speed-select {
    width: auto;
    min-width: 100px;
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.tts-unavailable-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.tts-unavailable-message i {
    font-size: 1rem;
}

/* Video Start Overlay */
.video-start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(5px);
}

.video-start-content {
    text-align: center;
    color: white;
    padding: 2rem;
}

.video-start-content i.bi-play-circle-fill {
    font-size: 5rem;
    color: #0d6efd;
    margin-bottom: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

.video-start-content h5 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
}

.video-start-content p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
}

.video-start-content .btn {
    font-size: 1.1rem;
    padding: 0.75rem 2rem;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
}

/* Audio Start Overlay */
.audio-start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(16, 185, 129, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(3px);
    border-radius: 0.5rem;
}

.audio-start-content {
    text-align: center;
    color: white;
    padding: 1.5rem;
}

.audio-start-content i.bi-play-circle-fill {
    font-size: 3rem;
    color: white;
    margin-bottom: 0.75rem;
    animation: pulse 2s ease-in-out infinite;
}

.audio-start-content h6 {
    margin-bottom: 0.5rem;
    color: white;
    font-weight: 600;
}

.audio-start-content p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.audio-start-content .btn {
    font-size: 0.9rem;
    padding: 0.5rem 1.5rem;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* Video Content */
.video-content {
    margin-bottom: 1rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: black;
}

.lesson-video {
    width: 100%;
    max-height: 600px;
    display: block;
}

/* Document Content */
.document-content {
    margin-bottom: 1rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: white;
}

.lesson-document {
    width: 100%;
    height: 600px;
    border: none;
}

/* Document Viewer Styles */
.document-viewer-container {
    min-height: 600px;
    background: white;
}

.document-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    color: #6c757d;
}

/* PDF Viewer */
.pdf-viewer {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pdf-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-wrap: wrap;
}

.pdf-page-info {
    font-weight: 500;
    color: #495057;
}

.pdf-zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.zoom-level {
    min-width: 50px;
    text-align: center;
    font-weight: 500;
    color: #495057;
}

.pdf-canvas-container {
    flex: 1;
    overflow: auto;
    padding: 2rem;
    display: flex;
    justify-content: center;
    background: #f8f9fa;
}

#pdfCanvas {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: white;
}

/* Word Viewer */
.word-viewer {
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

.word-toolbar {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 500;
    color: #495057;
}

.word-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    max-height: 800px;
}

.word-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.word-content img {
    max-width: 100%;
    height: auto;
}

.word-content table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.word-content table td,
.word-content table th {
    padding: 0.5rem;
    border: 1px solid #dee2e6;
}

/* PowerPoint Viewer */
.powerpoint-viewer {
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

.ppt-toolbar {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 500;
    color: #495057;
}

.ppt-controls {
    display: flex;
    align-items: center;
}

.ppt-slide-info {
    font-weight: 500;
    color: #495057;
}

.ppt-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    max-height: 800px;
}

#pptxViewer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#pptxViewer .slide {
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: white;
}

#pptxViewer svg {
    max-width: 100%;
    height: auto;
}

/* Document Preview Card (for files that can't be viewed inline) */
.document-preview-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2rem;
    min-height: 400px;
}

.preview-icon {
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Default Viewer */
.default-viewer {
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 600px;
}

/* ==========================================================================
   Text Content - ENHANCED WITH CONFLICT RESOLUTION
   ========================================================================== */
.text-content {
    margin-bottom: 1rem;
}

/* Stronger specificity to override TinyMCE and Bootstrap styles */
.lesson-content-display .text-content .text-wrapper {
    background: white !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    padding: 2rem !important;
    box-shadow: var(--shadow-sm) !important;

    /* Force clean, modern typography */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.7 !important;
    color: #1f2937 !important;

    /* Ensure content doesn't overflow */
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    word-break: break-word !important;

    /* Reset any inherited styles */
    text-align: left !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}

/* Override ALL heading styles from TinyMCE */
.lesson-content-display .text-content .text-wrapper h1,
.lesson-content-display .text-content .text-wrapper h2,
.lesson-content-display .text-content .text-wrapper h3,
.lesson-content-display .text-content .text-wrapper h4,
.lesson-content-display .text-content .text-wrapper h5,
.lesson-content-display .text-content .text-wrapper h6 {
    margin-top: 1.75rem !important;
    margin-bottom: 0.875rem !important;
    color: #111827 !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    text-transform: none !important;
    letter-spacing: -0.02em !important;
}

.lesson-content-display .text-content .text-wrapper h1 {
    font-size: 2rem !important;
    border-bottom: 2px solid var(--primary-color) !important;
    padding-bottom: 0.5rem !important;
}

.lesson-content-display .text-content .text-wrapper h2 {
    font-size: 1.75rem !important;
}

.lesson-content-display .text-content .text-wrapper h3 {
    font-size: 1.5rem !important;
    color: #374151 !important;
}

.lesson-content-display .text-content .text-wrapper h4 {
    font-size: 1.25rem !important;
    color: #4b5563 !important;
}

.lesson-content-display .text-content .text-wrapper h5 {
    font-size: 1.125rem !important;
    color: #6b7280 !important;
}

.lesson-content-display .text-content .text-wrapper h6 {
    font-size: 1rem !important;
    color: #6b7280 !important;
    font-weight: 600 !important;
}

.lesson-content-display .text-content .text-wrapper h1:first-child,
.lesson-content-display .text-content .text-wrapper h2:first-child,
.lesson-content-display .text-content .text-wrapper h3:first-child,
.lesson-content-display .text-content .text-wrapper h4:first-child,
.lesson-content-display .text-content .text-wrapper h5:first-child,
.lesson-content-display .text-content .text-wrapper h6:first-child {
    margin-top: 0 !important;
}

/* Override ALL paragraph styles */
.lesson-content-display .text-content .text-wrapper p {
    margin-bottom: 1.25rem !important;
    color: #374151 !important;
    font-size: 16px !important;
    line-height: 1.7 !important;
    font-family: inherit !important;
}

.lesson-content-display .text-content .text-wrapper p:last-child {
    margin-bottom: 0 !important;
}

/* Override ALL list styles */
.lesson-content-display .text-content .text-wrapper ul,
.lesson-content-display .text-content .text-wrapper ol {
    margin-bottom: 1.25rem !important;
    padding-left: 2rem !important;
    color: #374151 !important;
}

.lesson-content-display .text-content .text-wrapper li {
    margin-bottom: 0.625rem !important;
    line-height: 1.6 !important;
    color: #374151 !important;
}

.lesson-content-display .text-content .text-wrapper ul li {
    list-style-type: disc !important;
}

.lesson-content-display .text-content .text-wrapper ol li {
    list-style-type: decimal !important;
}

/* Nested lists */
.lesson-content-display .text-content .text-wrapper ul ul,
.lesson-content-display .text-content .text-wrapper ol ul {
    list-style-type: circle !important;
}

.lesson-content-display .text-content .text-wrapper ul ul ul,
.lesson-content-display .text-content .text-wrapper ol ul ul {
    list-style-type: square !important;
}

/* Override blockquote styles */
.lesson-content-display .text-content .text-wrapper blockquote {
    border-left: 4px solid var(--primary-color) !important;
    background: #f9fafb !important;
    padding: 1rem 1.5rem !important;
    margin: 1.5rem 0 !important;
    color: #4b5563 !important;
    font-style: italic !important;
    border-radius: 0 8px 8px 0 !important;
}

.lesson-content-display .text-content .text-wrapper blockquote p {
    margin-bottom: 0 !important;
}

/* Override table styles */
.lesson-content-display .text-content .text-wrapper table {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 1.5rem !important;
    border-collapse: collapse !important;
    display: block !important;
    overflow-x: auto !important;
    background: white !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.lesson-content-display .text-content .text-wrapper table th,
.lesson-content-display .text-content .text-wrapper table td {
    border: 1px solid #e5e7eb !important;
    padding: 0.75rem 1rem !important;
    text-align: left !important;
    color: #374151 !important;
    font-size: 15px !important;
}

.lesson-content-display .text-content .text-wrapper table th {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%) !important;
    font-weight: 700 !important;
    color: #111827 !important;
    text-transform: uppercase !important;
    font-size: 13px !important;
    letter-spacing: 0.05em !important;
}

.lesson-content-display .text-content .text-wrapper table tr:hover {
    background: #f9fafb !important;
}

/* Override code and pre styles */
.lesson-content-display .text-content .text-wrapper pre {
    background: #1f2937 !important;
    color: #f9fafb !important;
    border: 1px solid #374151 !important;
    border-radius: 8px !important;
    padding: 1.25rem !important;
    overflow-x: auto !important;
    margin-bottom: 1.5rem !important;
    font-family: 'Courier New', 'Consolas', monospace !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
}

.lesson-content-display .text-content .text-wrapper code {
    background: #f3f4f6 !important;
    color: #dc2626 !important;
    padding: 0.2rem 0.5rem !important;
    border-radius: 4px !important;
    font-family: 'Courier New', 'Consolas', monospace !important;
    font-size: 0.9em !important;
    border: 1px solid #e5e7eb !important;
}

.lesson-content-display .text-content .text-wrapper pre code {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    border: none !important;
}

/* CRITICAL: Override ALL image styles - force responsive */
.lesson-content-display .text-content .text-wrapper img {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    border-radius: 8px !important;
    margin: 1.5rem auto !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

/* Ensure figures are also responsive */
.lesson-content-display .text-content .text-wrapper figure {
    max-width: 100% !important;
    margin: 1.5rem 0 !important;
}

.lesson-content-display .text-content .text-wrapper figure img {
    max-width: 100% !important;
    height: auto !important;
}

.lesson-content-display .text-content .text-wrapper figcaption {
    text-align: center !important;
    font-style: italic !important;
    color: #6b7280 !important;
    margin-top: 0.75rem !important;
    font-size: 0.875rem !important;
}

/* Override link styles */
.lesson-content-display .text-content .text-wrapper a {
    color: var(--primary-color) !important;
    text-decoration: underline !important;
    text-decoration-color: rgba(79, 70, 229, 0.3) !important;
    text-underline-offset: 2px !important;
    transition: all 0.2s ease !important;
}

.lesson-content-display .text-content .text-wrapper a:hover {
    color: var(--primary-hover) !important;
    text-decoration-color: var(--primary-hover) !important;
}

/* Handle embedded iframes responsively */
.lesson-content-display .text-content .text-wrapper iframe {
    max-width: 100% !important;
    border-radius: 8px !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-sm) !important;
}

/* Responsive video embeds */
.lesson-content-display .text-content .text-wrapper .video-embed,
.lesson-content-display .text-content .text-wrapper .media-embed {
    position: relative !important;
    padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
    height: 0 !important;
    overflow: hidden !important;
    margin-bottom: 1.5rem !important;
    border-radius: 8px !important;
}

.lesson-content-display .text-content .text-wrapper .video-embed iframe,
.lesson-content-display .text-content .text-wrapper .media-embed iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* Override any bold/strong styles */
.lesson-content-display .text-content .text-wrapper strong,
.lesson-content-display .text-content .text-wrapper b {
    font-weight: 700 !important;
    color: #111827 !important;
}

/* Override any italic/em styles */
.lesson-content-display .text-content .text-wrapper em,
.lesson-content-display .text-content .text-wrapper i {
    font-style: italic !important;
}

/* Override hr styles */
.lesson-content-display .text-content .text-wrapper hr {
    border: none !important;
    border-top: 2px solid #e5e7eb !important;
    margin: 2rem 0 !important;
}

/* Image Gallery */
.image-gallery {
    margin-bottom: 1rem;
}

.gallery-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.gallery-item {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.gallery-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

/* Quiz Section in Content */
.lesson-content-display .quiz-section {
    margin-bottom: 1rem;
}

.quiz-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.quiz-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.quiz-header h6 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.quiz-content {
    padding: 0.5rem 0;
}

.quiz-meta {
    display: flex;
    gap: 1.5rem;
    margin: 1rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   Lesson Navigation
   ========================================================================== */
.lesson-navigation-simple {
    background: linear-gradient(to top, white 0%, #f8fafc 100%);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    position: sticky;
    bottom: 0;
    z-index: 30;
    box-shadow: 0 -4px 12px -2px rgb(0 0 0 / 0.08);
}

.nav-content-simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Navigation Buttons - Modern Styling */
.nav-content-simple .btn {
    min-width: 120px;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.nav-content-simple .btn-outline-secondary {
    border: 1.5px solid #cbd5e1;
    background: white;
    color: #475569;
}

.nav-content-simple .btn-outline-secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #334155;
    transform: translateX(-2px);
}

.nav-content-simple .btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    border: none;
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.nav-content-simple .btn-primary:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.nav-content-simple .btn i {
    font-size: 1rem;
}

/* ==========================================================================
   Mobile Responsiveness
   ========================================================================== */
@media (max-width: 1024px) {
    .lessons-sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .lessons-sidebar.mobile-active {
        transform: translateX(0);
    }

    .mobile-menu-overlay {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
        z-index: 40;
    }

    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .lesson-status-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .lesson-status {
        width: 100%;
        justify-content: space-between;
    }

    .timer-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 0.5rem;
        gap: 0.375rem;
    }

    .header-left {
        gap: 0.25rem;
        flex: 0 0 auto;
    }

    .header-center {
        gap: 0.25rem;
        flex: 1;
        justify-content: center;
        overflow: visible;
    }

    .header-right {
        gap: 0.25rem;
        flex: 0 0 auto;
    }

    /* Hide progress bar on mobile, just show text */
    .progress-indicator .progress-bar-mini {
        display: none;
    }

    .progress-indicator {
        padding: 0.25rem 0.5rem;
    }

    /* Compact navigation buttons */
    .btn-nav {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .btn-nav i {
        font-size: 0.8rem;
    }

    /* Hide text on nav buttons, show only icon on mobile */
    .btn-nav span {
        display: none;
    }

    /* Hide instructor name, show only icon */
    .instructor-info .instructor-name {
        display: none;
    }

    .instructor-info {
        padding: 0.25rem 0.375rem;
    }

    /* Compact time badge */
    .time-badge {
        padding: 0.2rem 0.375rem;
        font-size: 0.7rem;
    }

    .time-badge i {
        display: none;
    }

    /* Compact icon buttons */
    .btn-icon {
        width: 28px;
        height: 28px;
    }

    .btn-icon i {
        font-size: 0.9rem;
    }

    /* Status badge compact */
    .status-badge {
        padding: 0.2rem 0.375rem;
        font-size: 0.7rem;
    }

    .lesson-content-display {
        padding: 1rem;
    }

    /* Enhanced mobile text content styling */
    .lesson-content-display .text-content .text-wrapper {
        padding: 1.25rem !important;
        font-size: 15px !important;
        border-radius: 8px !important;
    }

    .lesson-content-display .text-content .text-wrapper h1 {
        font-size: 1.5rem !important;
    }

    .lesson-content-display .text-content .text-wrapper h2 {
        font-size: 1.375rem !important;
    }

    .lesson-content-display .text-content .text-wrapper h3 {
        font-size: 1.25rem !important;
    }

    .lesson-content-display .text-content .text-wrapper h4,
    .lesson-content-display .text-content .text-wrapper h5,
    .lesson-content-display .text-content .text-wrapper h6 {
        font-size: 1.125rem !important;
    }

    /* Ensure tables scroll horizontally on mobile */
    .lesson-content-display .text-content .text-wrapper table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Adjust code blocks for mobile */
    .lesson-content-display .text-content .text-wrapper pre {
        padding: 1rem !important;
        font-size: 13px !important;
        border-radius: 6px !important;
    }

    .lesson-content-display .text-content .text-wrapper code {
        font-size: 0.85em !important;
    }

    /* Adjust blockquotes for mobile */
    .lesson-content-display .text-content .text-wrapper blockquote {
        padding: 0.75rem 1rem !important;
        margin: 1rem 0 !important;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .course-time-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    /* Ultra-small screens - maximize readability */
    .lesson-content-display .text-content .text-wrapper {
        padding: 1rem !important;
        font-size: 14px !important;
    }

    .lesson-content-display .text-content .text-wrapper h1 {
        font-size: 1.375rem !important;
    }

    .lesson-content-display .text-content .text-wrapper h2 {
        font-size: 1.25rem !important;
    }

    .lesson-content-display .text-content .text-wrapper h3 {
        font-size: 1.125rem !important;
    }

    .lesson-content-display .text-content .text-wrapper h4,
    .lesson-content-display .text-content .text-wrapper h5,
    .lesson-content-display .text-content .text-wrapper h6 {
        font-size: 1rem !important;
    }

    .lesson-content-display .text-content .text-wrapper img {
        margin: 1rem auto !important;
    }

    .lesson-content-display .text-content .text-wrapper pre {
        padding: 0.75rem !important;
        font-size: 12px !important;
    }

    .lesson-content-display .text-content .text-wrapper table th,
    .lesson-content-display .text-content .text-wrapper table td {
        padding: 0.5rem !important;
        font-size: 13px !important;
    }

    .lesson-content-display {
        padding: 0.75rem;
    }
}

/* ==========================================================================
   Animations & Loading States
   ========================================================================== */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.loading-skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 50%,
        #f0f0f0 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: 4px;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.text-muted {
    color: var(--text-secondary) !important;
}

.text-center {
    text-align: center;
}

/* NOTE: Do NOT override Bootstrap's responsive display utilities (.d-none, .d-block, .d-md-block, etc.)
   Those are handled by Bootstrap and work with responsive breakpoints.
   Custom overrides here will break the responsive behavior. */

/* Bootstrap Integration */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.bg-success {
    background-color: var(--success-color) !important;
    color: white !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
    color: white !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
    color: white !important;
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.lesson-video,
.lesson-document,
.gallery-image {
    will-change: transform;
}

/* Prevent layout shifts */
.lesson-card,
.quiz-item,
.timer-card {
    contain: layout style paint;
}

/* ==========================================================================
   Loading Spinner Overlay
   ========================================================================== */
#lesson-loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

#lesson-loading-spinner .spinner-container {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    text-align: center;
    min-width: 200px;
}

#lesson-loading-spinner .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

#lesson-loading-spinner .loading-text {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.header-guest-register-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    background: #2b6cb0;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
}
.header-guest-register-btn:hover {
    background: #2c5282;
    color: #fff;
}
.header-guest-register-btn i {
    font-size: 0.85rem;
}
@media (max-width: 480px) {
    .header-guest-register-btn span { display: none; }
    .header-guest-register-btn { padding: 6px 10px; }
}
.guest-mode-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: #1a365d;
    color: #e2e8f0;
    font-size: 0.875rem;
    border-top: 1px solid #2d4a7a;
}

.guest-mode-banner i {
    font-size: 1rem;
    color: #63b3ed;
    flex-shrink: 0;
}

.guest-mode-banner > span {
    flex: 1;
}

.guest-mode-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.guest-banner-btn {
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    color: #e2e8f0;
    border: 1px solid #4a6fa5;
    transition: background 0.15s;
}

.guest-banner-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.guest-banner-btn-primary {
    background: #2b6cb0;
    border-color: #2b6cb0;
    color: #fff;
}

.guest-banner-btn-primary:hover {
    background: #2c5282;
    color: #fff;
}

@media (max-width: 480px) {
    .guest-mode-banner {
        flex-wrap: wrap;
        gap: 8px;
    }

    .guest-mode-banner > span {
        width: 100%;
    }
}

.inline-quiz-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px 16px;
    display: flex;
    justify-content: center;
}
.inline-quiz-card {
    width: 100%;
    max-width: 860px;
    background: #1f2733;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 28px 32px;
    color: #ECEFF1;
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}
.iq-header { margin-bottom: 18px; }
.iq-badge {
    display: inline-block;
    font-size: .7rem;
    letter-spacing: .08em;
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
    font-weight: 700;
}
.iq-badge-pre { background: rgba(67,94,190,0.18); color: #93b4ff; }
.iq-badge-check { background: rgba(74,222,128,0.18); color: #4ade80; }
.iq-title { font-size: 1.4rem; font-weight: 700; margin: 0 0 6px 0; }
.iq-desc { color: rgba(203,213,225,0.65); margin: 0; }
.iq-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    padding: 14px;
    margin: 16px 0;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.05);
}
.iq-meta-cell { text-align: center; }
.iq-meta-label { display: block; font-size: .68rem; color: rgba(203,213,225,0.5); text-transform: uppercase; letter-spacing: .06em; }
.iq-meta-value { display: block; font-size: 1rem; font-weight: 700; margin-top: 2px; }
.iq-instructions {
    background: rgba(67,94,190,0.08);
    border-left: 3px solid #435ebe;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}
.iq-instructions h6 { font-size: .85rem; margin: 0 0 6px 0; color: #93b4ff; }
.iq-instructions p { margin: 0; font-size: .88rem; color: rgba(203,213,225,0.75); }
.iq-questions { list-style: none; padding: 0; margin: 0; counter-reset: iq-q; }
.iq-question {
    counter-increment: iq-q;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 12px;
}
.iq-question::before {
    content: "Soru " counter(iq-q);
    display: inline-block;
    font-size: .7rem;
    background: rgba(67,94,190,0.2);
    color: #93b4ff;
    padding: 2px 8px;
    border-radius: 999px;
    margin-bottom: 8px;
    font-weight: 700;
}
.iq-q-text { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.iq-q-body { display: flex; flex-direction: column; gap: 8px; }
.iq-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.iq-opt:hover { background: rgba(67,94,190,0.08); border-color: rgba(67,94,190,0.3); }
.iq-opt input[type="radio"] { accent-color: #435ebe; }
.iq-q-body input[type="text"] { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: #ECEFF1; }
.iq-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.06);
}
.iq-footer-info { color: rgba(203,213,225,0.6); }
.iq-locked {
    text-align: center;
    padding: 28px 20px;
    background: rgba(220,38,38,0.06);
    border: 1px dashed rgba(220,38,38,0.4);
    border-radius: 10px;
    color: #fca5a5;
}
.iq-locked i { font-size: 2rem; display: block; margin-bottom: 8px; }
.iq-result-banner {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; border-radius: 10px; margin-bottom: 14px;
    font-weight: 600;
}
.iq-result-banner.success { background: rgba(74,222,128,0.1); color: #4ade80; border: 1px solid rgba(74,222,128,0.3); }
.iq-result-banner.fail { background: rgba(251,191,36,0.1); color: #fbbf24; border: 1px solid rgba(251,191,36,0.3); }

