/* =========================================
   Modern Player (Learning Mode)
   ========================================= */

.lms-modern-player {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    background: #ffffff;
    position: fixed;
    top: 0; left: 0;
    z-index: 99995; /* On top of wrapper, below admin bar */
}

/* Handle Admin Bar Spacing for Modern Player */
body.admin-bar .lms-modern-player {
    top: 32px !important;
    height: calc(100vh - 32px) !important;
}
@media screen and (max-width: 782px) {
    body.admin-bar .lms-modern-player {
        top: 46px !important;
        height: calc(100vh - 46px) !important;
    }
}

/* --- Header --- */
.lms-modern-header {
    height: 64px;
    background: #111827; /* Dark header like Udemy/Teachable */
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
    z-index: 20;
}

.lms-header-left { display: flex; align-items: center; gap: 16px; overflow: hidden; max-width: 250px; }
.lms-modern-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: #fff;
    text-decoration: none !important; /* Force no underline */
    transition: background 0.2s;
}
.lms-modern-back-btn:hover { background: rgba(255,255,255,0.2); }
.lms-modern-course-title {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 1px solid rgba(255,255,255,0.2);
    padding-left: 16px;
}

.lms-header-right { display: flex; align-items: center; gap: 20px; }

/* Circular Progress */
.lms-modern-progress { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: #d1d5db; }
.lms-circular-progress {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: conic-gradient(#10b981 var(--progress), #374151 0deg);
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.lms-circular-progress::before {
    content: ""; position: absolute;
    width: 26px; height: 26px;
    background: #111827;
    border-radius: 50%;
}
.progress-value { position: relative; z-index: 1; font-size: 0.65rem; font-weight: 700; color: #fff; }

.lms-modern-sidebar-toggle {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex; align-items: center; gap: 6px;
    transition: all 0.2s;
}
.lms-modern-sidebar-toggle:hover { background: rgba(255,255,255,0.1); border-color: #fff; }

/* --- Body Layout --- */
.lms-modern-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* --- Content Area --- */
.lms-modern-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    position: relative;
}

.lms-content-scrollable {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 80px; /* Space for footer */
}

/* Video Stage */
.lms-media-stage {
    background: #000;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    /* Ensure flex centering even when constrained */
    flex-direction: column; 
}
.lms-video-responsive {
    width: 100%;
    display: flex;
    justify-content: center;
    background: #000;
}
.lms-video-responsive .plyr {
    width: 100%;
    max-height: 75vh; /* Constrain height to viewport */
    aspect-ratio: 16 / 9; /* Default aspect ratio */
}

/* Ensure video content is contained, not cropped/zoomed */
.plyr__video-embed iframe,
.plyr__video-wrapper video {
    object-fit: contain !important;
}

/* Text Header (if no video) */
.lms-text-header {
    background: #f9fafb;
    padding: 40px 20px;
    border-bottom: 1px solid #e5e7eb;
    width: 100%;
    text-align: center;
}
.lms-text-header h1 { margin: 0; font-size: 1.75rem; color: #111827; }

/* Lesson Body */
.lms-lesson-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
}
.lms-lesson-title-below {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: #111827;
}
.lms-lesson-body {
    font-size: 1rem;
    line-height: 1.7;
    color: #374151;
}
.lms-lesson-body img { max-width: 100%; height: auto; border-radius: 8px; }

/* Sticky Footer Nav */
.lms-modern-footer {
    height: 50px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
    /* Ensure sticky behavior if parent scrolls, otherwise fixed within flex item */
    margin-top: auto; 
}

.lms-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none !important; /* Force no underline */
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    border: 1px solid #d1d5db;
    color: #374151;
}
.lms-nav-btn:hover { background: #f9fafb; border-color: #9ca3af; }
.lms-btn-primary.lms-complete-btn {
    background: #111827; /* Dark black/blue */
    border-color: #111827;
    color: #fff;
}
.lms-btn-primary.lms-complete-btn:hover { background: #000; }
.lms-btn-completed {
    background: #ecfdf5;
    border-color: #10b981;
    color: #047857;
    cursor: default;
}

/* --- Sidebar (Curriculum) - LEFT SIDE --- */
.lms-modern-sidebar {
    width: 350px;
    background: #f9fafb;
    /* Border on the RIGHT only */
    border-right: 1px solid #e5e7eb; 
    border-left: none; 
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease, transform 0.3s ease;
    flex-shrink: 0;
    /* Ensure it sits to the left in flex order */
    order: 0;
}
.lms-modern-player.sidebar-collapsed .lms-modern-sidebar {
    width: 0;
    border-right: none;
}
.lms-modern-player.sidebar-collapsed .lms-sidebar-inner { display: none; }

.lms-sidebar-inner {
    flex: 1;
    overflow-y: auto;
}

.lms-sidebar-course-header {
    background: var(--lms-bg-hover);
    border-bottom: 1px solid var(--lms-border-color);
    padding: 15px;
}
.lms-sidebar-course-title {
    color: var(--lms-text-primary);
    margin: 0;
    font-size: 1rem;
}

.lms-sidebar-header-mobile {
    display: none;
    padding: 16px;
    background: var(--lms-bg-surface);
    border-bottom: 1px solid var(--lms-border-color);
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

/* Sidebar Header (Mobile Only) */
.lms-sidebar-header-mobile {
    display: none;
    padding: 16px;
    background: var(--lms-bg-surface);
    border-bottom: 1px solid var(--lms-border-color);
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.lms-accordion-item {
    border-bottom: 1px solid var(--lms-border-color);
    background: var(--lms-bg-surface);
}
.lms-accordion-header {
    background: var(--lms-bg-surface);
    color: var(--lms-text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
}
.lms-accordion-header:hover {
    background: #f3f4f6;
}
.lms-accordion-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--lms-text-primary);
}

/* Icon Styling */
.lms-accordion-icon {
    transition: transform 0.2s; 
    color: var(--lms-text-secondary);
    font-size: 14px !important; /* Smaller icon font size */
    width: 20px !important;    /* Larger container width for alignment */
    height: 20px !important;   /* Larger container height for alignment */
    display: flex;
    align-items: center;
    justify-content: center;
}
.lms-accordion-item.open .lms-accordion-icon { /* No rotate needed for plus/minus switch logic */ }

.lms-accordion-body {
    background: var(--lms-bg-app); /* Darker inner list */
}

/* Items inside Player Sidebar */
.lms-curriculum-item {
    display: flex;
    padding: 12px 16px 12px 12px;
    text-decoration: none;
    color: var(--lms-text-secondary);
    transition: background 0.2s;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    justify-content: space-between;
    align-items: center;
}
.lms-curriculum-item:hover {
    background: #e5e7eb;
}
.lms-curriculum-item.active {
    background: #e0e7ff; /* Light indigo */
    border-left-color: #4f46e5; /* Indigo 600 */
    color: var(--lms-text-primary);
    font-weight: 500;
}

.lms-item-status {
    width: auto;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    margin-left: 10px;
}
/* Custom Checkbox/Circle Icon */
.lms-status-icon {
    width: 18px; height: 18px;
    border: 2px solid #9ca3af;
    border-radius: 50%;
    display: inline-block;
}
.lms-status-icon.completed {
    background: #10b981;
    border-color: #10b981;
    position: relative;
}
.lms-status-icon.completed::after {
    content: ""; /* CSS shape for checkmark */
    display: block;
    width: 5px; height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    position: absolute;
    left: 5px; top: 1px;
}
.lms-item-details { flex: 1; }
.lms-item-title { display: block; line-height: 1.4; margin-bottom: 2px; }
.lms-item-meta { display: block; font-size: 0.75rem; color: #6b7280; }

.lms-topic-group { padding-left: 0; }
.lms-topic-item { padding-left: 30px; font-size: 0.85rem; }

.lms-btn-completed {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #10b981;
}