/* Course Sidebar Styles - Modern Design */
/* Complete custom styling for the course navigation drawer/sidebar */

/* Sidebar Container */
.drawer.drawer-left,
.theme_remui-drawers-courseindex {
    width: 380px !important;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1) !important;
}

/* Sidebar Header - Gradient Background */
.drawer .drawer-header {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: #ffffff !important;
    padding: 1.25rem !important;
    border-bottom: none !important;
}

.drawer .drawer-header .drawer-title {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    margin: 0 !important;
}

.drawer .drawer-header .drawer-toggle {
    color: #ffffff !important;
    transition: transform 0.3s ease !important;
}

.drawer .drawer-header .drawer-toggle:hover {
    transform: rotate(90deg) !important;
}

/* Course Index Container */
.courseindex {
    padding: 0 !important;
    background: transparent !important;
    /* Prevent inner scrollbars: allow drawer-content to be the only scroller */
    overflow: visible !important;
    max-height: none !important;
}

/* Keep only one vertical scrollbar (drawer-content) */
.drawer .drawer-content,
.theme_remui-drawers-courseindex .drawer-content {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

#courseindex,
#courseindex-content {
    overflow: visible !important;
    max-height: none !important;
}

/* Flatten the core container so it doesn't behave like an extra wrapper */
nav#courseindex.courseindex {
    display: contents !important;
}

/* Course Index Items */
.courseindex .courseindex-item {
    padding: 0.75rem 1rem !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    transition: all 0.2s ease !important;
    border-left: 3px solid transparent !important;
}

.courseindex .courseindex-item:hover {
    background: linear-gradient(90deg, #eff6ff 0%, #dbeafe 100%) !important;
    border-left-color: #3b82f6 !important;
}

/* Active/Current Item */
.courseindex .courseindex-item.active,
.courseindex .courseindex-item[aria-current="true"],
.courseindex .courseindex-item.current {
    background: linear-gradient(90deg, #dbeafe 0%, #bfdbfe 100%) !important;
    border-left-color: #2563eb !important;
    font-weight: 600 !important;
}

.courseindex .courseindex-item.active .courseindex-link,
.courseindex .courseindex-item[aria-current="true"] .courseindex-link {
    color: #1e40af !important;
}

/* Course Index Links */
.courseindex .courseindex-item .courseindex-link {
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    color: #374151 !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    transition: color 0.2s ease !important;
    min-width: 0 !important; /* allow text truncation inside flex */
    width: 100% !important;
}

.courseindex .courseindex-item .courseindex-link:hover {
    color: #1e40af !important;
}

/* Prevent long titles from overflowing their containers */
.courseindex .courseindex-item .courseindex-link [data-for="cm_name"],
.courseindex .courseindex-item .courseindex-link .text-truncate,
.courseindex .courseindex-item .courseindex-link span,
.courseindex .courseindex-item .courseindex-link div {
    min-width: 0 !important;
}

/* Two-line clamp for activity names (mobile-friendly, avoids overflow) */
.courseindex .courseindex-item .courseindex-link [data-for="cm_name"],
.courseindex .courseindex-item .courseindex-link .courseindex-name,
.courseindex .courseindex-item .courseindex-link .courseindex-link-text {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    white-space: normal !important;
    word-break: break-word !important;
}

/* Flatten “extra containers” (remove unintended inset boxes/padding) */
.courseindex .courseindex-sectioncontent,
.courseindex .courseindex-item-content,
.courseindex .courseindex-item-content.collapse,
.courseindex .courseindex-item-content.show,
.courseindex .courseindex-sectioncontent.unlist {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

/* Completion Status Icons */
.courseindex .courseindex-item .completion-icon {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

/* Completed - Green Gradient */
.courseindex .courseindex-item .completion-icon.completed {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
}

/* In Progress - Orange Gradient */
.courseindex .courseindex-item .completion-icon.in-progress {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #ffffff !important;
}

/* Not Started - Gray */
.courseindex .courseindex-item .completion-icon.not-started {
    background: #e5e7eb !important;
    color: #9ca3af !important;
}

/* Custom Scrollbar */
.drawer .drawer-content::-webkit-scrollbar {
    width: 8px !important;
}

.drawer .drawer-content::-webkit-scrollbar-track {
    background: #f1f5f9 !important;
    border-radius: 4px !important;
}

.drawer .drawer-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%) !important;
    border-radius: 4px !important;
    transition: background 0.2s ease !important;
}

.drawer .drawer-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%) !important;
}

/* Floating Toggle Button */
.custom-sidebar-toggle {
    position: fixed !important;
    bottom: 20px !important;
    left: 20px !important;
    width: 56px !important;
    height: 56px !important;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    border-radius: 50% !important;
    border: none !important;
    color: #ffffff !important;
    font-size: 1.5rem !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
    z-index: 1000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
}

.custom-sidebar-toggle:hover {
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5) !important;
}

.custom-sidebar-toggle:active {
    transform: translateY(0) scale(0.98) !important;
}

/* Drawer Animation */
.drawer {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.drawer.drawer-left.show {
    transform: translateX(0) !important;
}

.drawer.drawer-left:not(.show) {
    transform: translateX(-100%) !important;
}

/* Backdrop */
.drawer-backdrop {
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(4px) !important;
    transition: opacity 0.3s ease !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .drawer.drawer-left,
    .theme_remui-drawers-courseindex {
        width: 320px !important;
    }
    
    .courseindex .courseindex-item {
        padding: 0.875rem 1rem !important;
    }
    
    .courseindex .courseindex-item .courseindex-link {
        font-size: 0.82rem !important;
    }
}

@media (max-width: 480px) {
    .drawer.drawer-left,
    .theme_remui-drawers-courseindex {
        width: 100% !important;
        max-width: 340px !important;
    }
    
    .custom-sidebar-toggle {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.25rem !important;
    }
}

/* Section Headers */
.courseindex .courseindex-section {
    padding: 0.6rem 1rem !important;
    font-weight: 600 !important;
    font-size: 0.78rem !important;
    color: #6b7280 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    background: #f8fafc !important;
    border-bottom: 1px solid #e5e7eb !important;
}

/* Section title row needs to be shrinkable inside the drawer */
.courseindex .courseindex-section .courseindex-section-title,
.courseindex .courseindex-section .courseindex-item {
    min-width: 0 !important;
}

.courseindex .courseindex-section .courseindex-section-title .courseindex-link {
    min-width: 0 !important;
}

/* Clamp section names too (some courses have very long section titles) */
.courseindex .courseindex-section .courseindex-section-title .courseindex-link [data-for="section_name"],
.courseindex .courseindex-section .courseindex-section-title .courseindex-link span {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    white-space: normal !important;
    word-break: break-word !important;
}

/* Nested Items */
.courseindex .courseindex-sectioncontent .courseindex-item {
    padding-left: 1.5rem !important;
}

/* Keep chevrons/lock icons from squashing text */
.courseindex .courseindex-chevron,
.courseindex .courseindex-locked,
.courseindex .courseindex-itemicon,
.courseindex .courseindex-item-action {
    flex: 0 0 auto !important;
}

/* Ensure the list itself doesn't create horizontal scroll */
.drawer .drawer-content,
.theme_remui-drawers-courseindex .drawer-content,
.courseindex,
#courseindex,
#courseindex-content {
    overflow-x: hidden !important;
}

/* Icons */
.courseindex .courseindex-item .courseindex-link i {
    font-size: 0.95rem !important;
    width: 20px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
}
