/**
 * Modern Video Lesson Layout
 * Layout stile Udemy con video player a sinistra e sidebar a destra
 */

/* ============================================
   Main Layout Container
   ============================================ */
.ulp-lesson-wrapp.ulp-modern-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    min-height: calc(100vh - 80px); /* Adjust based on header height */
    background-color: #1a1a1a;
}

/* ============================================
   Main Video Area (Left Side)
   ============================================ */
.ulp-lesson-main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #000;
    min-width: 0; /* Prevent flex item overflow */
}

.ulp-lesson-main-area .ulp-lesson-video-warpper {
    width: 100%;
    position: relative;
    background-color: #000;
    aspect-ratio: 16 / 9;
}

.ulp-lesson-main-area .ulp-lesson-video-warpper iframe,
.ulp-lesson-main-area .ulp-lesson-video-warpper video,
.ulp-lesson-main-area #ulp_youtube_player,
.ulp-lesson-main-area #ulp_vimeo_player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
}

.ulp-lesson-main-area .ulp-lesson-main-featureimage {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.ulp-lesson-main-area .ulp-lesson-main-featureimage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================
   Sidebar (Right Side)
   ============================================ */
.ulp-lesson-sidebar {
    width: 400px;
    min-width: 400px;
    max-width: 400px;
    background-color: #fff;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px); /* Adjust based on header height */
    position: sticky;
    top: 80px; /* Adjust based on header height */
    overflow: hidden;
}

/* Sidebar Header */
.ulp-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #fff;
    flex-shrink: 0;
}

.ulp-sidebar-title {
    font-size: 16px;
    font-weight: 700;
    color: #1c1d1f;
}

.ulp-sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    color: #6a6f73;
    transition: all 0.2s ease;
}

.ulp-sidebar-toggle:hover {
    background-color: #f5f5f5;
    color: #1c1d1f;
}

/* Sidebar Content */
.ulp-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Sidebar Sections */
.ulp-sidebar-lesson-info,
.ulp-sidebar-navigation,
.ulp-sidebar-actions,
.ulp-sidebar-course-link {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.ulp-sidebar-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #6a6f73;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Lesson Title in Sidebar */
.ulp-sidebar-current-lesson .ulp-lesson-main-title {
    font-size: 18px;
    font-weight: 700;
    color: #1c1d1f;
    line-height: 1.4;
    margin: 0;
    padding: 0;
    text-align: start;
}

/* Lesson Description */
.ulp-sidebar-description {
    margin-top: 16px;
}

.ulp-sidebar-description .ulp-lesson-main-content {
    font-size: 14px;
    color: #3e4143;
    line-height: 1.6;
}

.ulp-sidebar-description .ulp-lesson-main-content p {
    margin: 0;
}

/* Navigation Section */
.ulp-sidebar-navigation .ulp-lesson-navigation-wrapper {
    margin: 0;
    padding: 0;
}

.ulp-sidebar-navigation .ulp-lesson-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ulp-sidebar-navigation .ulp-lesson-nav-prev,
.ulp-sidebar-navigation .ulp-lesson-nav-next {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    background-color: #f7f9fa !important;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.ulp-sidebar-navigation .ulp-lesson-nav-prev:hover,
.ulp-sidebar-navigation .ulp-lesson-nav-next:hover {
    background-color: #e8f0fe;
}

.ulp-sidebar-navigation .ulp-lesson-nav-prev-label,
.ulp-sidebar-navigation .ulp-lesson-nav-next-label {
    font-size: 11px;
    font-weight: 600;
    color: #6a6f73;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ulp-sidebar-navigation .ulp-lesson-nav-prev a,
.ulp-sidebar-navigation .ulp-lesson-nav-next a {
    font-size: 14px;
    font-weight: 600;
    color: #5624d0;
    text-decoration: none;
    transition: color 0.2s ease;
}

.ulp-sidebar-navigation .ulp-lesson-nav-prev a:hover,
.ulp-sidebar-navigation .ulp-lesson-nav-next a:hover {
    color: #401b9c;
    text-decoration: underline;
}

.ulp-sidebar-navigation .ulp-clear {
    display: none;
}

/* Complete Button */
.ulp-sidebar-actions .ulp-lesson-complete-button-wrapper {
    margin: 0;
}

.ulp-sidebar-actions .ulp-lesson-complete-wrapp {
    margin: 0;
}

/* Hide the empty span that appears before the complete button */
.ulp-sidebar-actions .ulp-js-lesson-complete-bttn {
    display: none !important;
}

/* Style for the completed lesson button */
.ulp-sidebar-actions .ulp-lesson-completed {
    display: block;
    width: 100%;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #2d7a2d;
    color: #fff;
    border: none;
}

.ulp-sidebar-actions .ulp-lesson-completed:hover {
    background-color: #236b23;
}

/* Course Link */
.ulp-sidebar-course-link .ulp-lesson-course-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 10px;
    background-color: #f7f7f7 !important;
    border-radius: 8px;
}

.ulp-sidebar-course-link .ulp-lesson-course-link > div {
    font-size: 12px;
    color: #6a6f73;
}

.ulp-sidebar-course-link .ulp-lesson-course-link a {
    font-size: 14px;
    font-weight: 600;
    color: #5624d0;
    text-decoration: none;
    transition: color 0.2s ease;
}

.ulp-sidebar-course-link .ulp-lesson-course-link a:hover {
    color: #401b9c;
    text-decoration: underline;
}

/* ============================================
   Sidebar Collapsed State
   ============================================ */
.ulp-lesson-wrapp.ulp-modern-layout.sidebar-collapsed .ulp-lesson-sidebar {
    width: 0;
    min-width: 0;
    max-width: 0;
    padding: 0;
    border-left: none;
    overflow: hidden;
}

.ulp-lesson-wrapp.ulp-modern-layout.sidebar-collapsed .ulp-lesson-main-area {
    flex: 1;
}

/* Toggle button when sidebar is collapsed */
.ulp-sidebar-expand-btn {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 48px;
    height: 48px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 100;
    transition: all 0.2s ease;
}

.ulp-sidebar-expand-btn:hover {
    background-color: #f5f5f5;
    transform: scale(1.05);
}

.ulp-lesson-wrapp.ulp-modern-layout.sidebar-collapsed .ulp-sidebar-expand-btn {
    display: flex;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .ulp-lesson-sidebar {
        width: 350px;
        min-width: 350px;
        max-width: 350px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .ulp-lesson-wrapp.ulp-modern-layout {
        flex-direction: column;
        min-height: auto;
    }
    
    .ulp-lesson-main-area {
        width: 100%;
    }
    
    .ulp-lesson-sidebar {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        height: auto;
        position: relative;
        top: 0;
        border-left: none;
        border-top: 1px solid #e0e0e0;
    }
    
    .ulp-sidebar-header {
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .ulp-sidebar-toggle {
        display: block;
    }
    
    /* Mobile collapsed state */
    .ulp-lesson-wrapp.ulp-modern-layout.sidebar-collapsed-mobile .ulp-sidebar-content {
        display: none;
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */
.ulp-sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.ulp-sidebar-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ulp-sidebar-content::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 3px;
}

.ulp-sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* ============================================
   Animation & Transitions
   ============================================ */
.ulp-lesson-sidebar {
    transition: width 0.3s ease, min-width 0.3s ease, max-width 0.3s ease;
}

.ulp-lesson-main-area {
    transition: flex 0.3s ease;
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    .ulp-lesson-sidebar {
        background-color: #1c1d1f;
        border-left-color: #3e4143;
    }
    
    .ulp-sidebar-header {
        background-color: #1c1d1f;
        border-bottom-color: #3e4143;
    }
    
    .ulp-sidebar-title {
        color: #fff;
    }
    
    .ulp-sidebar-toggle {
        color: #a0a0a0;
    }
    
    .ulp-sidebar-toggle:hover {
        background-color: #2d2f31;
        color: #fff;
    }
    
    .ulp-sidebar-label {
        color: #a0a0a0;
    }
    
    .ulp-sidebar-current-lesson .ulp-lesson-main-title {
        color: #fff;
    }
    
    .ulp-sidebar-description .ulp-lesson-main-content {
        color: #c0c0c0;
    }
    
    .ulp-sidebar-navigation .ulp-lesson-nav-prev,
    .ulp-sidebar-navigation .ulp-lesson-nav-next {
        background-color: #2d2f31;
    }
    
    .ulp-sidebar-navigation .ulp-lesson-nav-prev:hover,
    .ulp-sidebar-navigation .ulp-lesson-nav-next:hover {
        background-color: #3e4143;
    }
    
    .ulp-sidebar-navigation .ulp-lesson-nav-prev-label,
    .ulp-sidebar-navigation .ulp-lesson-nav-next-label {
        color: #a0a0a0;
    }
    
    .ulp-sidebar-course-link .ulp-lesson-course-link > div {
        color: #a0a0a0;
    }
    
    .ulp-sidebar-lesson-info,
    .ulp-sidebar-navigation,
    .ulp-sidebar-actions,
    .ulp-sidebar-course-link {
        border-bottom-color: #3e4143;
    }
}

/* ============================================
   Full Width Override (Remove any theme constraints)
   ============================================ */
.ulp-lesson-wrapp.ulp-modern-layout {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Prevent horizontal scroll on body */
body:has(.ulp-modern-layout) {
    overflow-x: hidden;
}

/* Ensure video fills the space properly */
.ulp-lesson-main-area .ulp-lesson-video-warpper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: calc(100vh - 80px);
}

