:root {
    --jvd-primary: #3B1C68;
    --jvd-dark: #1D0A7A;
    /* Inner layers */
    --jvd-sidebar-bg: #150061;
    /* Brand Base */
    --jvd-module-header-bg: #220C8F;
    /* Hierarchy */
    --jvd-active: #5E3BBF;
    --jvd-progress: #7B5CF1;
    --jvd-text-light: #EDE9FF;
    --jvd-border: rgba(255, 255, 255, 0.08);
    /* Subtle dividers */
    --jvd-card-bg: #FFFFFF;
    --jvd-text-dark: #333333;
    --jvd-text-muted: #666666;
}

.jvd-wrapper {
    display: flex;
    background: var(--jvd-sidebar-bg);
    /* Fix: Purple background to prevent white gaps */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    font-family: 'DM Sans', 'Inter', sans-serif;
    min-height: 600px;
}

/* Sidebar */
.jvd-sidebar {
    background: var(--jvd-sidebar-bg);
    color: var(--jvd-text-light);
    display: flex;
    flex-direction: column;
    width: 320px;
    flex-shrink: 0;
    border-right: 1px solid var(--jvd-border);
    height: 600px;
    /* Fixed height to prevent layout shift */
    max-height: 80vh;
    /* Responsive constraint */
    position: relative;
    /* For gradient overlay */
}

/* Bottom Fade Gradient */
.jvd-sidebar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(21, 0, 97, 0), #150061);
    pointer-events: none;
    z-index: 5;
}

.jvd-sidebar-header {
    padding: 24px;
    background: var(--jvd-sidebar-bg);
    /* Match base */
    border-bottom: 1px solid var(--jvd-border);
    position: relative;
    z-index: 2;
}

.jvd-sidebar-title {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

/* Progress Bar */
.jvd-progress-container {
    margin-bottom: 20px;
}

.jvd-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 6px;
    opacity: 0.9;
    font-weight: 500;
}

.jvd-progress-bar-bg {
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.jvd-progress-bar-fill {
    background: var(--jvd-progress);
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Search */
.jvd-search-container input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 6px;
    color: #ffffff !important;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    box-shadow: none;
}

.jvd-search-container input:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--jvd-progress) !important;
    color: #ffffff !important;
}

.jvd-search-container input::placeholder {
    color: rgba(237, 233, 255, 0.6) !important;
    opacity: 1;
    /* Firefox fix */
}

/* Modules List - Depth & Separation */
.jvd-modules-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px 0 60px 0;
    /* Extra padding for bottom gradient */
    background: var(--jvd-dark);
    /* Slightly lighter inner layer */
    box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.15);
    /* Soft Inset Shadow */
}

.jvd-modules-list::-webkit-scrollbar {
    width: 6px;
}

.jvd-modules-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Module Header (Accordion Trigger) */
.jvd-module-header {
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    user-select: none;
    background: var(--jvd-module-header-bg);
    /* Hierarchy */
    margin-bottom: 1px;
    /* Divider gap */
    border-bottom: 1px solid var(--jvd-border);
}

.jvd-module-header:hover {
    background: #2A12A6;
    /* Lighten on hover */
    color: #fff;
}

.jvd-module.expanded .jvd-module-header {
    background: #1C086E;
    /* Darker when expanded */
    color: #fff;
    border-left: 3px solid var(--jvd-active);
}

/* Sub-Module Header */
.jvd-submodule-header {
    padding: 10px 24px 6px 24px;
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(237, 233, 255, 0.5);
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-top: 5px;
}

/* Module Videos Container */
.jvd-module-videos {
    padding-left: 0;
    max-height: 280px;
    /* Limit height for internal scrolling */
    overflow-y: auto;
    /* Enable vertical scroll */
    scrollbar-width: thin;
    /* Firefox */
    scrollbar-color: var(--jvd-active) rgba(0, 0, 0, 0.1);
}

/* Custom Scrollbar for Module List */
.jvd-module-videos::-webkit-scrollbar {
    width: 4px;
}

.jvd-module-videos::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.jvd-module-videos::-webkit-scrollbar-thumb {
    background: var(--jvd-active);
    border-radius: 2px;
}

.jvd-module-videos::-webkit-scrollbar-thumb:hover {
    background: var(--jvd-progress);
}

/* Video Items (Tree structure) */
/* Video Items (Tree structure) */
.jvd-video-item {
    display: flex;
    align-items: center;
    padding: 12px 24px 12px 36px;
    /* Indented */
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    border-left: 3px solid transparent;
    position: relative;
    color: rgba(237, 233, 255, 0.9);
    background: rgba(255, 255, 255, 0.04);
    /* Base background */
    margin-bottom: 1px;
    /* Divider gap */
    border-bottom: 1px solid var(--jvd-border);
}

/* Tree Vertical Line Indicator */
.jvd-video-item::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.05);
}

.jvd-video-item:hover {
    background: rgba(255, 255, 255, 0.08);
    /* Lighter on hover */
    color: #fff;
}

.jvd-video-item.active {
    background: rgba(255, 255, 255, 0.12);
    /* Brighter active state */
    border-left-color: var(--jvd-progress);
    color: #fff;
}

/* Enhance active indicator line */
.jvd-video-item.active::before {
    background: var(--jvd-active);
}

.jvd-video-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.7);
    z-index: 1;
    /* Above tree line */
}

.jvd-video-item.active .jvd-video-icon {
    background: var(--jvd-active);
    color: #fff;
}

.jvd-video-item.completed .jvd-video-icon {
    background: #4CAF50;
    color: #fff;
}

.jvd-video-info {
    flex-grow: 1;
}

.jvd-video-item-title {
    font-size: 13px;
    margin-bottom: 2px;
    line-height: 1.4;
    font-weight: 500;
}

.jvd-video-meta {
    font-size: 11px;
    opacity: 0.6;
}

.jvd-check-icon {
    opacity: 0;
    color: #4CAF50;
    margin-left: 8px;
    transform: scale(0.8);
    transition: all 0.2s;
}

.jvd-video-item.completed .jvd-check-icon {
    opacity: 1;
    transform: scale(1);
}

/* Content Area */
.jvd-content {
    flex-grow: 1;
    padding: 40px;
    background: #F8F9FA;
    display: flex;
    flex-direction: column;
}

.jvd-player-header {
    margin-bottom: 24px;
}

#jvd-current-title {
    font-size: 28px;
    color: var(--jvd-primary);
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.jvd-author {
    display: inline-block;
    font-size: 14px;
    color: #666;
    background: #EAEAEA;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.jvd-player-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    height: 0;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    margin-bottom: 30px;
}

.jvd-player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.jvd-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
}

.jvd-nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background: #fff;
    color: var(--jvd-primary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.2s;
}

.jvd-nav-btn:hover:not(:disabled) {
    background: var(--jvd-primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 28, 104, 0.2);
}

.jvd-nav-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #F0F0F0;
    color: #999;
    box-shadow: none;
}

#jvd-next-btn {
    background: var(--jvd-dark);
    color: #fff;
}

#jvd-next-btn:hover:not(:disabled) {
    background: var(--jvd-primary);
}

.jvd-btn-complete {
    background: #fff;
    color: #4CAF50;
    border: 1px solid #4CAF50;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
}

.jvd-btn-complete:hover {
    background: #4CAF50;
    color: #fff;
}

.jvd-btn-complete.completed {
    background: #4CAF50;
    color: #fff;
    cursor: default;
    opacity: 0.8;
    pointer-events: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {

    /* Fix clipping on mobile */
    .jvd-wrapper {
        flex-direction: column;
        overflow: visible;
        /* Ensure content isn't clipped */
        height: auto !important;
        /* Allow growing */
    }

    .jvd-sidebar {
        width: 100% !important;
        height: auto;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--jvd-border);
    }

    .jvd-modules-list {
        max-height: 300px;
    }

    /* Disable internal scroll on mobile for better UX */
    .jvd-module-videos {
        max-height: none;
        overflow-y: visible;
    }

    .jvd-content {
        padding: 24px 16px;
        min-height: auto;
    }

    .jvd-navigation {
        position: relative;
        z-index: 10;
        /* Ensure active click area */
    }

    /* Add spacing between Complete button and Navigation */
    .jvd-action-area {
        margin-bottom: 25px !important;
    }

    /* Improve touch response */
    .jvd-nav-btn {
        touch-action: manipulation;
        min-height: 48px;
        /* Accessible touch target size */
    }

    #jvd-current-title {
        font-size: 22px;
    }
}