/* ============================================================
   LinkedIn Learning Style Course Layout CSS
   Version: 3.12.0

   Two-column responsive layout with:
   - Main content area (video player + tabs)
   - Sidebar (lessons accordion)
   - Mobile drawer for sidebar
   ============================================================ */

:root {
    /* Layout dimensions */
    --ll-sidebar-width: 340px;
    --ll-sidebar-width-tablet: 300px;
    --ll-section-padding: 16px;
    --ll-section-padding-mobile: 12px;

    /* Colors & Design System */
    --ll-bg-primary: #f5f5f5;
    --ll-bg-secondary: #ffffff;
    --ll-border-color: #e1e1e1;
    --ll-text-primary: #333333;
    --ll-text-secondary: #666666;
    --ll-text-muted: #999999;
    --ll-accent-primary: #0073b1;
    --ll-accent-hover: #005885;

    /* Spacing */
    --ll-space-xs: 4px;
    --ll-space-sm: 8px;
    --ll-space-md: 16px;
    --ll-space-lg: 24px;
    --ll-space-xl: 32px;
}

/* ============================================================
   MAIN LAYOUT CONTAINER
   ============================================================ */

.ll-course-layout {
    display: grid;
    grid-template-columns: 1fr var(--ll-sidebar-width);
    gap: var(--ll-space-lg);
    min-height: 100vh;
    background-color: var(--ll-bg-primary);
    padding: var(--ll-space-lg);
    position: relative;
}

/* Desktop layout (>= 1024px) */
@media (min-width: 1024px) {
    .ll-course-layout {
        grid-template-columns: 1fr var(--ll-sidebar-width);
    }
}

/* Tablet layout (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .ll-course-layout {
        grid-template-columns: 1fr var(--ll-sidebar-width-tablet);
        gap: var(--ll-space-md);
        padding: var(--ll-space-md);
    }
}

/* Mobile layout (< 768px) */
@media (max-width: 767px) {
    .ll-course-layout {
        display: block;
        padding: var(--ll-space-md);
    }
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */

.ll-course-main {
    display: flex;
    flex-direction: column;
    gap: var(--ll-space-lg);
    background-color: var(--ll-bg-secondary);
    border-radius: 8px;
    padding: var(--ll-space-lg);
}

@media (max-width: 767px) {
    .ll-course-main {
        padding: var(--ll-space-md);
        border-radius: 4px;
    }
}

/* ============================================================
   VIDEO PLAYER SECTION
   ============================================================ */

.ll-video-section {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000000;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Ensure video player fills container */
.ll-video-section .video-player-container,
.ll-video-section video,
.ll-video-section .ll-video-container {
    width: 100%;
    height: 100%;
}

/* Video placeholder */
.ll-video-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    gap: var(--ll-space-md);
}

.ll-video-placeholder .placeholder-icon {
    font-size: 48px;
    opacity: 0.8;
}

.ll-video-placeholder p {
    font-size: 16px;
    margin: 0;
}

/* ============================================================
   LESSON HEADER
   ============================================================ */

.ll-lesson-header {
    border-bottom: 1px solid var(--ll-border-color);
    padding-bottom: var(--ll-space-md);
}

.ll-lesson-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--ll-text-primary);
    margin: 0 0 var(--ll-space-sm) 0;
    line-height: 1.3;
}

.lesson-description {
    color: var(--ll-text-secondary);
    font-size: 14px;
    margin: 0;
    line-height: 1.6;
}

@media (max-width: 767px) {
    .ll-lesson-header h2 {
        font-size: 22px;
    }
}

/* ============================================================
   TABS SECTION
   ============================================================ */

.ll-tabs-section {
    border-bottom: 2px solid var(--ll-border-color);
}

.ll-tabs-content {
    padding: var(--ll-space-lg) 0;
}

/* ============================================================
   TAB CONTENT - OVERVIEW
   ============================================================ */

.ll-tab-overview {
    display: flex;
    flex-direction: column;
    gap: var(--ll-space-lg);
}

.overview-section {
    padding: var(--ll-space-md) 0;
}

.overview-section h3,
.overview-section h4 {
    font-weight: 600;
    color: var(--ll-text-primary);
    margin: 0 0 var(--ll-space-md) 0;
}

.overview-section h3 {
    font-size: 20px;
}

.overview-section h4 {
    font-size: 16px;
}

.course-description {
    color: var(--ll-text-secondary);
    line-height: 1.8;
    font-size: 15px;
}

.learning-outcomes,
.requirements-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--ll-space-sm);
}

.learning-outcomes li,
.requirements-list li {
    color: var(--ll-text-secondary);
    padding-left: 24px;
    position: relative;
    font-size: 15px;
    line-height: 1.6;
}

.learning-outcomes li::before,
.requirements-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--ll-accent-primary);
    font-weight: bold;
}

/* ============================================================
   TRANSCRIPT TAB
   ============================================================ */

.ll-transcript-container {
    max-height: 600px;
    overflow-y: auto;
}

.transcript-search {
    margin-bottom: var(--ll-space-md);
}

.transcript-search input {
    border: 1px solid var(--ll-border-color);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
}

.transcript-content {
    display: flex;
    flex-direction: column;
    gap: var(--ll-space-md);
}

.transcript-segment {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: var(--ll-space-md);
    padding: var(--ll-space-md);
    background-color: var(--ll-bg-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.transcript-segment:hover {
    background-color: #eeeeee;
}

.transcript-segment.highlighted {
    background-color: #fff3cd;
    border-left-color: var(--ll-accent-primary);
}

.segment-timestamp {
    display: flex;
    align-items: flex-start;
}

.time-badge {
    background-color: var(--ll-accent-primary);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Monaco', 'Courier New', monospace;
    white-space: nowrap;
}

.segment-content {
    display: flex;
    flex-direction: column;
    gap: var(--ll-space-xs);
}

.segment-speaker {
    font-size: 12px;
    color: var(--ll-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.segment-text {
    font-size: 14px;
    color: var(--ll-text-primary);
    line-height: 1.6;
}

.segment-confidence {
    font-size: 11px;
    color: var(--ll-text-muted);
}

.transcript-metadata {
    padding-top: var(--ll-space-md);
    border-top: 1px solid var(--ll-border-color);
    color: var(--ll-text-muted);
    display: flex;
    gap: var(--ll-space-md);
}

.transcript-metadata .separator {
    color: var(--ll-border-color);
}

/* ============================================================
   GLOSSARY TAB
   ============================================================ */

.ll-glossary-container {
    display: flex;
    flex-direction: column;
    gap: var(--ll-space-lg);
}

.glossary-controls {
    display: flex;
    flex-direction: column;
    gap: var(--ll-space-md);
}

.glossary-search {
    position: relative;
}

.glossary-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ll-text-muted);
}

.glossary-search input {
    width: 100%;
    padding: 10px 10px 10px 36px;
    border: 1px solid var(--ll-border-color);
    border-radius: 4px;
    font-size: 14px;
}

.glossary-categories {
    display: flex;
    gap: var(--ll-space-sm);
    flex-wrap: wrap;
}

.category-btn {
    padding: 6px 12px;
    background-color: var(--ll-bg-primary);
    border: 1px solid var(--ll-border-color);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--ll-text-secondary);
}

.category-btn:hover {
    border-color: var(--ll-accent-primary);
    color: var(--ll-accent-primary);
}

.category-btn.active {
    background-color: var(--ll-accent-primary);
    color: white;
    border-color: var(--ll-accent-primary);
}

.glossary-terms {
    display: flex;
    flex-direction: column;
    gap: var(--ll-space-md);
}

.glossary-term {
    border: 1px solid var(--ll-border-color);
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.glossary-term.expanded {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.term-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--ll-space-md);
    background-color: var(--ll-bg-primary);
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.term-header:hover {
    background-color: #eeeeee;
}

.term-title {
    display: flex;
    align-items: center;
    gap: var(--ll-space-sm);
    text-align: left;
}

.term-title strong {
    color: var(--ll-text-primary);
    font-weight: 600;
}

.term-category-badge {
    background-color: var(--ll-accent-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.term-toggle {
    color: var(--ll-text-secondary);
    transition: transform 0.2s ease;
}

.glossary-term.expanded .term-toggle {
    transform: rotate(180deg);
}

.term-content {
    padding: var(--ll-space-md);
    background-color: var(--ll-bg-secondary);
    border-top: 1px solid var(--ll-border-color);
    display: flex;
    flex-direction: column;
    gap: var(--ll-space-md);
}

.term-definition {
    color: var(--ll-text-secondary);
    font-size: 14px;
    line-height: 1.8;
}

.term-example {
    background-color: var(--ll-bg-primary);
    padding: var(--ll-space-md);
    border-radius: 4px;
    font-size: 13px;
}

.term-example strong {
    color: var(--ll-text-primary);
}

.term-example p {
    margin: var(--ll-space-sm) 0 0 0;
    color: var(--ll-text-secondary);
    line-height: 1.6;
}

.term-related strong {
    display: block;
    margin-bottom: var(--ll-space-sm);
    color: var(--ll-text-primary);
    font-size: 14px;
}

.related-terms-list {
    display: flex;
    gap: var(--ll-space-sm);
    flex-wrap: wrap;
}

.related-term-btn {
    padding: 6px 12px;
    background-color: var(--ll-bg-primary);
    border: 1px solid var(--ll-accent-primary);
    border-radius: 20px;
    color: var(--ll-accent-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.related-term-btn:hover {
    background-color: var(--ll-accent-primary);
    color: white;
}

/* Empty states */
.transcript-empty,
.glossary-empty-state,
.glossary-loading,
.transcript-loading,
.transcript-error,
.glossary-error {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: var(--ll-space-xl);
    color: var(--ll-text-muted);
    gap: var(--ll-space-md);
}

.transcript-empty i,
.glossary-empty-state i,
.glossary-loading i,
.transcript-loading i {
    font-size: 48px;
    opacity: 0.5;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.ll-course-sidebar {
    background-color: var(--ll-bg-secondary);
    border-radius: 8px;
    padding: var(--ll-space-lg);
    height: fit-content;
    position: sticky;
    top: var(--ll-space-lg);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

@media (max-width: 767px) {
    .ll-course-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: var(--z-modal);
        border-radius: 0;
        max-height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 90%;
        max-width: 340px;
    }

    .ll-course-layout.sidebar-visible .ll-course-sidebar {
        transform: translateX(0);
    }
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--ll-space-md);
    padding-bottom: var(--ll-space-md);
    border-bottom: 1px solid var(--ll-border-color);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--ll-text-primary);
}

.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--ll-text-secondary);
    padding: 0;
}

@media (max-width: 767px) {
    .sidebar-close-btn {
        display: block;
    }
}

/* ============================================================
   LESSONS SIDEBAR
   ============================================================ */

.ll-lessons-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--ll-space-sm);
}

.ll-empty-state {
    text-align: center;
    padding: var(--ll-space-lg);
    color: var(--ll-text-muted);
}

.ll-empty-state i {
    font-size: 32px;
    margin-bottom: var(--ll-space-md);
    opacity: 0.5;
}

/* Section Accordion */
.ll-section {
    border: 1px solid var(--ll-border-color);
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.ll-section.expanded {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.ll-section-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--ll-space-sm);
    padding: var(--ll-section-padding);
    background-color: var(--ll-bg-primary);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: var(--ll-text-primary);
    text-align: left;
}

.ll-section-header:hover {
    background-color: #eeeeee;
}

.ll-section-expand {
    display: flex;
    align-items: center;
    color: var(--ll-text-secondary);
    transition: transform 0.2s ease;
    min-width: 20px;
}

.ll-section-header.expanded .ll-section-expand {
    transform: rotate(90deg);
}

.ll-section-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ll-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ll-text-primary);
}

.ll-section-meta {
    font-size: 12px;
    color: var(--ll-text-muted);
}

.ll-section-separator {
    margin: 0 4px;
}

.ll-section-complete-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: #4caf50;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    flex-shrink: 0;
}

/* Section Content */
.ll-section-content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease;
    overflow: hidden;
}

.ll-section-content.expanded {
    grid-template-rows: 1fr;
}

.ll-section-content > * {
    overflow: hidden;
}

/* Lesson Item */
.ll-lesson-item {
    display: grid;
    grid-template-columns: 32px 1fr 24px;
    gap: var(--ll-space-sm);
    align-items: center;
    padding: var(--ll-space-md);
    background-color: var(--ll-bg-secondary);
    border-bottom: 1px solid var(--ll-border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: var(--ll-text-secondary);
}

.ll-lesson-item:last-child {
    border-bottom: none;
}

.ll-lesson-item:hover {
    background-color: #fafafa;
}

.ll-lesson-item.active {
    background-color: #f0f7ff;
    border-left: 3px solid var(--ll-accent-primary);
    padding-left: calc(var(--ll-space-md) - 3px);
}

.ll-lesson-item.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Progress Circle */
.ll-progress-circle {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ll-progress-svg {
    width: 100%;
    height: 100%;
}

.ll-progress-circle-bg {
    fill: none;
    stroke: var(--ll-border-color);
    stroke-width: 2;
}

.ll-progress-circle-fill {
    fill: none;
    stroke: var(--ll-accent-primary);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 0;
}

.ll-progress-circle.active .ll-progress-circle-indicator {
    width: 8px;
    height: 8px;
    background-color: var(--ll-accent-primary);
    border-radius: 50%;
}

.ll-progress-circle.completed {
    background-color: #4caf50;
    color: white;
    border-radius: 50%;
}

.ll-progress-circle-check {
    font-size: 14px;
    font-weight: bold;
}

/* Lesson Lock */
.ll-lesson-lock {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--ll-text-muted);
    font-size: 12px;
}

/* Lesson Info */
.ll-lesson-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ll-lesson-title {
    font-weight: 500;
    color: var(--ll-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ll-lesson-item.active .ll-lesson-title {
    color: var(--ll-accent-primary);
    font-weight: 600;
}

.ll-lesson-duration {
    font-size: 12px;
    color: var(--ll-text-muted);
}

/* Lesson Type Badge */
.ll-lesson-type-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--ll-accent-primary);
    font-size: 14px;
    flex-shrink: 0;
}

/* ============================================================
   SIDEBAR OVERLAY (Mobile)
   ============================================================ */

.ll-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: calc(var(--z-modal) - 1);
}

@media (max-width: 767px) {
    .ll-sidebar-overlay {
        display: block;
    }
}

/* ============================================================
   SIDEBAR TOGGLE BUTTON (Mobile)
   ============================================================ */

.ll-sidebar-toggle-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--ll-accent-primary);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 18px;
    z-index: var(--z-fab);
    box-shadow: 0 4px 12px rgba(0, 115, 177, 0.3);
    transition: all 0.2s ease;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.ll-sidebar-toggle-btn:hover {
    background-color: var(--ll-accent-hover);
    box-shadow: 0 6px 16px rgba(0, 115, 177, 0.4);
}

.ll-sidebar-toggle-btn:active {
    transform: scale(0.95);
}

.ll-sidebar-toggle-btn span {
    font-size: 10px;
    font-weight: 600;
}

@media (max-width: 767px) {
    .ll-sidebar-toggle-btn {
        display: flex;
    }
}

/* ============================================================
   RESPONSIVE UTILITIES
   ============================================================ */

@media (max-width: 1023px) {
    .ll-course-layout {
        gap: var(--ll-space-md);
    }

    .ll-course-main {
        gap: var(--ll-space-md);
        padding: var(--ll-space-md);
    }

    .ll-course-sidebar {
        padding: var(--ll-space-md);
        top: var(--ll-space-md);
    }
}

@media (max-width: 767px) {
    .ll-course-main {
        margin-bottom: 80px; /* Space for mobile FAB */
    }

    .ll-video-section {
        aspect-ratio: 16 / 9;
    }

    .ll-lesson-header h2 {
        font-size: 20px;
    }

    .ll-section-header {
        padding: var(--ll-section-padding-mobile);
    }

    .ll-lesson-item {
        padding: var(--ll-section-padding-mobile);
    }

    .glossary-categories {
        gap: 8px;
    }

    .category-btn {
        padding: 4px 10px;
        font-size: 12px;
    }
}

/* ============================================================
   SCROLLBAR CUSTOMIZATION
   ============================================================ */

.ll-transcript-container::-webkit-scrollbar,
.ll-lessons-sidebar::-webkit-scrollbar,
.ll-course-sidebar::-webkit-scrollbar {
    width: 8px;
}

.ll-transcript-container::-webkit-scrollbar-track,
.ll-lessons-sidebar::-webkit-scrollbar-track,
.ll-course-sidebar::-webkit-scrollbar-track {
    background-color: transparent;
}

.ll-transcript-container::-webkit-scrollbar-thumb,
.ll-lessons-sidebar::-webkit-scrollbar-thumb,
.ll-course-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--ll-border-color);
    border-radius: 4px;
}

.ll-transcript-container::-webkit-scrollbar-thumb:hover,
.ll-lessons-sidebar::-webkit-scrollbar-thumb:hover,
.ll-course-sidebar::-webkit-scrollbar-thumb:hover {
    background-color: var(--ll-text-muted);
}

/* ============================================================
   ANIMATION - Stagger children for progressive reveal
   ============================================================ */

.ll-stagger-children > * {
    animation: fadeInSlideUp 0.4s ease forwards;
}

.ll-stagger-children > :nth-child(1) { animation-delay: 0ms; }
.ll-stagger-children > :nth-child(2) { animation-delay: 40ms; }
.ll-stagger-children > :nth-child(3) { animation-delay: 80ms; }
.ll-stagger-children > :nth-child(4) { animation-delay: 120ms; }
.ll-stagger-children > :nth-child(n+5) { animation-delay: 150ms; }

@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Print styles */
@media print {
    .ll-course-layout {
        grid-template-columns: 1fr;
    }

    .ll-course-sidebar,
    .ll-sidebar-toggle-btn,
    .ll-sidebar-overlay {
        display: none;
    }

    .ll-tabs-section {
        display: none;
    }

    .ll-course-main {
        padding: 0;
        background: none;
    }
}
