/**
 * Lesson Page Styling
 * 
 * Styles for Fluent Community lesson pages with improved header
 * and sidebar styling.
 * 
 * Uses FCOM CSS variables for theming/dark mode compatibility.
 */

/* Main container adjustments */
.fcom_lesson_container {
    position: relative;
    min-height: 100vh;
}

/* Sidebar styling - make it appear behind content */
.fcom_lesson_container .fcom_lesson_sidebar {
    position: relative;
    z-index: 1;
    opacity: 0.95;
    transition: opacity 0.3s ease;
    background: var(--fcom-secondary-bg, #f8f8f8);
    border-left: none !important;
    border-right: none !important;
}

/* Set sidebar width */
.fcom_lesson_container .fcom_lesson_sidebar {
    --el-aside-width: 250px !important;
}

/* Sidebar section title */
.fcom_lesson_container .fcom_lesson_sidebar .fcom_section_sidebar_title {
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 9;
    border-bottom: none !important;
    height: auto !important;
    background: transparent !important;
}

.fcom_lesson_container .fcom_lesson_sidebar .fcom_section_sidebar_title h3 {
    margin: 0;
    padding-top: 15px;
    position: sticky;
    top: 0;
    background: transparent;
    height: 60px;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--fcom-primary-text, #19283a);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sidebar primary item styling - section headers */
.fcom_lesson_container .fcom_lesson_sidebar .fcom_section_primary_item {
    border-radius: 6px;
    margin: 2px 8px;
    padding: 5px 7px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.fcom_lesson_container .fcom_lesson_sidebar .fcom_section_primary_item:hover {
    background-color: var(--fcom-active-bg, rgba(255, 255, 255, 0.3));
}

.fcom_lesson_container .fcom_lesson_sidebar .fcom_section_primary_item_title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--fcom-primary-text, #19283a);
}

.fcom_lesson_container .fcom_lesson_sidebar .fcom_section_primary_item_title h4 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--fcom-primary-text, #19283a);
}

/* Sidebar section items styling - lesson tabs */
.fcom_lesson_container .fcom_lesson_sidebar .fcom_section_item {
    border-radius: 6px;
    margin: 2px 8px;
    padding: 8px 8px 8px 22px;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.fcom_lesson_container .fcom_lesson_sidebar .fcom_section_item:hover {
    background-color: var(--fcom-active-bg, rgba(255, 255, 255, 0.5));
}

/* Active/current lesson styling */
.fcom_lesson_container .fcom_lesson_sidebar .fcom_current_lesson {
    background-color: var(--fcom-highlight-bg, rgba(255, 255, 255, 0.7));
    border-radius: 6px;
}

.fcom_lesson_container .fcom_lesson_sidebar .fcom_current_lesson .fcom_section_item {
    background-color: var(--fcom-highlight-bg, rgba(255, 255, 255, 0.7));
}

/* Lesson item text styling */
.fcom_lesson_container .fcom_lesson_sidebar .fcom_section_item p {
    margin: 0;
    padding: 0;
    font-size: 12px;
}

.fcom_lesson_container .fcom_lesson_sidebar .fcom_section_item .fcom_heading_item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--fcom-primary-text, #19283a);
}

/* Complete lesson icon styling - uses currentColor */
.fcom_lesson_container .fcom_lesson_sidebar .fcom_section_item .el-icon svg {
    fill: currentColor;
    width: 16px;
    height: 16px;
}

/* Completed lesson styling */
.fcom_lesson_container .fcom_lesson_sidebar .fcom_section_item[data-completed="true"] .el-icon svg,
.fcom_lesson_container .fcom_lesson_sidebar .fcom_section_item.completed .el-icon svg {
    fill: currentColor;
    color: var(--fcom-success-color, #10b981);
}

/* Main content area - bring to front */
.fcom_lesson_container .fcom_lesson_wrap,
.fcom_lesson_container .el-main {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    min-width: 0;
}

/* Make scrollbar view a flex container for reordering */
.fcom_lesson_container .el-scrollbar__view {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    width: 100%;
}

/* Lesson details container - zero padding */
.fcom_lesson_container .fcom_lesson_details {
    margin: 0 auto;
    padding: 0;
    max-width: 100%;
    width: 100%;
    position: relative;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    order: 1;
    background: var(--fcom-secondary-bg, #f8f8f8);
}

/* Lesson header - make it full-width page header style */
.fcom_lesson_container .fcom_lesson_details .fcom_lesson_header {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: var(--fcom-secondary-bg, #f8f8f8);
    padding: 12px 20px;
    position: relative;
    z-index: 3;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

/* Lesson documents area - styled like lesson body */
.fcom_lesson_container .fcom_lesson_details .fcom_lesson_documents {
    width: 100%;
    max-width: 100%;
    margin: 24px auto;
    margin-right: 2rem;
    background: var(--fcom-primary-bg, #ffffff);
    padding: 20px 20px 40px;
    border-radius: 12px;
    border: 1px solid var(--fcom-primary-border, #e5e7eb);
    position: relative;
    z-index: 3;
    margin-top: 24px !important;
    border-radius: 12px !important;
}

.fcom_lesson_container .fcom_lesson_title {
    flex: 1;
    margin: 0;
}

.fcom_lesson_container .fcom_lesson_title h1 {
    margin: 0 0 8px 0;
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--fcom-primary-text, #19283a);
}

.fcom_lesson_container .fcom_lesson_number {
    font-size: 0.875rem;
    color: var(--fcom-secondary-text, #6b7280);
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fcom_lesson_container .fcom_lesson_number .el-button {
    font-size: 0.75rem;
    padding: 4px 8px;
}

/* Lesson navigation buttons in header */
.fcom_lesson_container .fcom_lesson_details .fcom_lesson_header .fcom_lesson_nav {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

/* Lesson body/content area */
.fcom_lesson_container .fcom_lesson_details .fcom_lesson_body {
    position: relative;
    flex: 1;
    padding: 20px 20px 40px;
    background: var(--fcom-primary-bg, #ffffff);
    margin-right: 2rem;
    border-radius: 12px;
    border: 1px solid var(--fcom-primary-border, #e5e7eb);
    margin-top: 0 !important;
}

/* Ensure proper spacing for content blocks */
.fcom_lesson_container .fcom_lesson_body > * {
    margin-bottom: 24px;
}

.fcom_lesson_container .fcom_lesson_body > *:last-child {
    margin-bottom: 0;
}

/* Comments section - order after lesson content */
.fcom_lesson_container .fcom_lesson_comments {
    order: 2;
    width: 100%;
    margin: 0 auto;
    padding: 20px 20px 100px;
    background: var(--fcom-secondary-bg, #f8f8f8);
}

.fcom_lesson_container .fcom_lesson_comments .fcom_lesson_comment_box {
    margin: 0 auto;
    margin-right: 2rem;
    max-width: none !important;
}

.fcom_lesson_container .fcom_lesson_comments .fcom_lesson_comment_box .comment_text {
    background: var(--fcom-primary-bg, #f8f8f8);
    height: 60px;
}

/* Move back_space to footer position */
.fcom_lesson_container .fcom_back_space {
    position: sticky;
    bottom: 0;
    width: 100%;
    background: var(--fcom-secondary-bg, #f8f8f8);
    border-top: 1px solid var(--fcom-primary-border, #e5e7eb);
    padding: 20px 32px;
    margin-top: auto;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    order: 3;
}

/* Footer navigation styling */
.fcom_lesson_container .fcom_back_space .fcom_lesson_nav {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

/* Ensure sidebar remains functional but visually secondary */
.fcom_lesson_container .fcom_lesson_sidebar:hover {
    opacity: 1;
}

/* Adjust scrollbar styling if needed */
.fcom_lesson_container .fcom_lesson_wrap .el-scrollbar {
    position: relative;
    z-index: 2;
}

/* Course progress footer */
.course_progress_footer_wrap {
    position: absolute;
    bottom: 0;
    padding: 5px 15px 10px;
    left: 0;
    right: 0;
    border-top: 1px solid var(--fcom-primary-border, #e5e7eb);
    z-index: 99;
    background: var(--fcom-primary-bg, #f8f8f8);
    height: 60px;
}

/* Full screen back space styling */
#fluent_comminity_body .feed_layout .fcom_full_screen .fcom_back_space {
    margin: 0;
    padding-top: 15px;
    position: sticky;
    top: 0;
    background: var(--fcom-primary-bg, #ffffff);
    height: 60px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .fcom_lesson_container .fcom_lesson_details .fcom_lesson_body {
        padding: 16px 16px 32px;
        margin-right: 0;
    }
    
    .fcom_lesson_container .fcom_lesson_details .fcom_lesson_header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 16px;
    }
    
    .fcom_lesson_container .fcom_lesson_details .fcom_lesson_documents {
        padding: 16px 16px 32px;
        margin-right: 0;
        margin-top: 16px;
        margin-bottom: 16px;
    }
    
    .fcom_lesson_container .fcom_lesson_title h1 {
        font-size: 1.5rem;
    }
    
    .fcom_lesson_container .fcom_lesson_details .fcom_lesson_header .fcom_lesson_nav {
        width: 100%;
        justify-content: flex-start;
    }
    
    .fcom_lesson_container .fcom_back_space {
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .fcom_lesson_container .fcom_back_space .fcom_lesson_nav {
        width: 100%;
        justify-content: space-between;
    }
    
    .fcom_lesson_container .fcom_lesson_comments .fcom_lesson_comment_box {
        margin-right: 0;
    }
}
