/* ===================================================================
   LESSON VIEWER STYLES
   Course navigation sidebar + main content layout
   =================================================================== */

/* ===== MAIN LAYOUT ===== */
.lesson-viewer {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 100vh;
    background: #f5f7fa;
}

@media (max-width: 992px) {
    .lesson-viewer {
        grid-template-columns: 1fr;
    }

    .course-nav-sidebar {
        display: none;
    }
}

/* ===== COURSE NAVIGATION SIDEBAR ===== */
.course-nav-sidebar {
    background: #fff;
    border-right: 1px solid #e0e0e0;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0;
    margin-bottom: 0.75rem;
}

.back-btn:hover {
    color: #0d6efd;
}

.course-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 0.75rem 0;
    line-height: 1.4;
}

.progress-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-info .progress {
    background: #e9ecef;
    border-radius: 3px;
}

.progress-info small {
    font-size: 0.75rem;
}

/* ===== MODULES NAVIGATION ===== */
.modules-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.module-section {
    border-bottom: 1px solid #f0f0f0;
}

.module-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s;
}

.module-header:hover {
    background: #f8f9fa;
}

.module-icon {
    font-size: 1rem;
    color: #6c757d;
}

.module-title {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 600;
    color: #333;
}

.expand-icon {
    color: #adb5bd;
    font-size: 0.75rem;
}

/* ===== LESSONS LIST ===== */
.lessons-list {
    list-style: none;
    margin: 0;
    padding: 0 0 0.5rem 0;
    background: #fafafa;
}

.lesson-item {
    border-left: 3px solid transparent;
}

.lesson-item.current {
    background: #e7f1ff;
    border-left-color: #0d6efd;
}

.lesson-item.completed .lesson-link {
    color: #6c757d;
}

.lesson-link {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 1rem 0.625rem 1.5rem;
    color: #333;
    text-decoration: none;
    font-size: 0.8125rem;
    line-height: 1.4;
    transition: background-color 0.15s;
}

.lesson-link:hover {
    background: #f0f0f0;
    color: #0d6efd;
}

.lesson-status {
    flex-shrink: 0;
    font-size: 0.875rem;
    margin-top: 0.1rem;
}

.lesson-title-nav {
    flex: 1;
}

/* ===== SIDEBAR SIMULATION BUTTON ===== */
.sidebar-simulation {
    padding: 1rem;
    border-top: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
}

.btn-simulation-sidebar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-simulation-sidebar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    color: #fff;
}

.btn-simulation-sidebar i {
    font-size: 1.25rem;
}

/* ===== MAIN CONTENT AREA ===== */
.lesson-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #fff;
}

.lesson-header {
    padding: 2rem 2.5rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.lesson-header .header-content {
    max-width: 900px;
}

.lesson-header .lesson-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
    color: #fff;
}

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

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    opacity: 0.9;
}

.completed-badge {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ===== LESSON CONTENT AREA ===== */
.lesson-content-area {
    flex: 1;
    padding: 2rem 2.5rem;
    max-width: 100%;
    overflow-x: hidden;
}

.lesson-content-area .sanitized-content {
    max-width: 900px;
}

.empty-content {
    text-align: center;
    padding: 4rem 2rem;
}

/* ===== LESSON IFRAME (for HTML file lessons) ===== */
.lesson-iframe {
    width: 100%;
    min-height: calc(100vh - 250px);
    border: none;
    border-radius: 8px;
    background: #fff;
}

/* Hide header for iframe lessons - content has its own header */
.lesson-content-area:has(.lesson-iframe) {
    padding: 0;
}

/* ===== SIMULATION SECTION ===== */
.simulation-section {
    padding: 0 2.5rem 2rem;
}

.simulation-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    color: #fff;
    max-width: 900px;
}

.simulation-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.simulation-info {
    flex: 1;
}

.simulation-info h5 {
    margin: 0 0 0.25rem 0;
    font-weight: 600;
}

.simulation-info p {
    margin: 0 0 0.75rem 0;
    opacity: 0.8;
    font-size: 0.875rem;
}

.simulation-badges {
    display: flex;
    gap: 0.5rem;
}

.btn-simulation {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-simulation:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    color: #fff;
}

/* ===== FOOTER NAVIGATION ===== */
.lesson-footer {
    padding: 1.5rem 2.5rem;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.footer-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
}

.nav-left, .nav-center, .nav-right {
    display: flex;
    align-items: center;
}

.nav-left {
    min-width: 120px;
}

.nav-right {
    min-width: 120px;
    justify-content: flex-end;
}

/* ===== IMAGE LIGHTBOX ===== */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 1.25rem;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    cursor: default;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ===== INTERACTIVE IMAGES IN CONTENT ===== */
.lesson-content-area img,
.sanitized-content img {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 8px;
    max-width: 100%;
    height: auto;
}

.lesson-content-area img:hover,
.sanitized-content img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Image in model viewer should not have hover effect */
model-viewer img,
.model-viewer-container img {
    cursor: default;
    transform: none !important;
    box-shadow: none !important;
}

/* ===== DARK THEME (DOGGING COURSES) ===== */
.lesson-viewer.dogging-dark-theme {
    background: #1a1a2e;
}

.dogging-dark-theme .course-nav-sidebar {
    background: #16213e;
    border-right-color: #2a2a4a;
}

.dogging-dark-theme .sidebar-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-bottom-color: #2a2a4a;
}

.dogging-dark-theme .course-title,
.dogging-dark-theme .module-title {
    color: #e0e0e0;
}

.dogging-dark-theme .back-btn {
    color: #adb5bd;
}

.dogging-dark-theme .module-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dogging-dark-theme .lessons-list {
    background: rgba(0, 0, 0, 0.2);
}

.dogging-dark-theme .lesson-item.current {
    background: rgba(245, 158, 11, 0.2);
    border-left-color: #f59e0b;
}

.dogging-dark-theme .lesson-link {
    color: #e0e0e0;
}

.dogging-dark-theme .lesson-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f59e0b;
}

.dogging-dark-theme .module-section {
    border-bottom-color: #2a2a4a;
}

.dogging-dark-theme .lesson-main {
    background: #1a1a2e;
}

.dogging-dark-theme .lesson-header {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.dogging-dark-theme .lesson-content-area {
    color: #e0e0e0;
}

.dogging-dark-theme .lesson-footer {
    background: #16213e;
    border-top-color: #2a2a4a;
}

.dogging-dark-theme .sidebar-simulation {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-top-color: #2a2a4a;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    .lesson-header {
        padding: 1.5rem;
    }

    .lesson-header .lesson-title {
        font-size: 1.5rem;
    }

    .lesson-content-area {
        padding: 1.5rem;
    }

    .simulation-section {
        padding: 0 1.5rem 1.5rem;
    }

    .simulation-card {
        flex-direction: column;
        text-align: center;
    }

    .simulation-badges {
        justify-content: center;
    }

    .lesson-footer {
        padding: 1rem 1.5rem;
    }

    .footer-nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-left, .nav-center, .nav-right {
        width: 100%;
        justify-content: center;
    }
}
