/**
 * LMS Course Builder Pro - Frontend Styles
 * Udemy-inspired course navigation UI
 *
 * @package LMS_Course_Builder_Pro
 * @since 1.3.0
 */

/* CSS Variables for theming */
:root {
    --lcbp-primary: #a435f0;
    --lcbp-primary-dark: #7325a8;
    --lcbp-secondary: #1c1d1f;
    --lcbp-accent: #5624d0;
    --lcbp-success: #4caf50;
    --lcbp-warning: #ff9800;
    --lcbp-error: #f44336;
    --lcbp-text: #1c1d1f;
    --lcbp-text-light: #6a6f73;
    --lcbp-border: #d1d7dc;
    --lcbp-bg-light: #f7f9fa;
    --lcbp-bg-white: #ffffff;
    --lcbp-sidebar-width: 320px;
    --lcbp-header-height: 56px;
}

/* =========================================
   Course Layout Container
   ========================================= */
.lcbp-course-container {
    display: flex;
    min-height: calc(100vh - var(--lcbp-header-height));
    background: var(--lcbp-bg-light);
}

/* =========================================
   Course Sidebar
   ========================================= */
.lcbp-sidebar {
    width: var(--lcbp-sidebar-width);
    min-width: var(--lcbp-sidebar-width);
    background: var(--lcbp-bg-white);
    border-right: 1px solid var(--lcbp-border);
    overflow-y: auto;
    position: sticky;
    top: var(--lcbp-header-height);
    height: calc(100vh - var(--lcbp-header-height));
}

.lcbp-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--lcbp-border);
    background: var(--lcbp-bg-white);
    position: sticky;
    top: 0;
    z-index: 10;
}

.lcbp-sidebar-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--lcbp-text);
    margin: 0 0 8px 0;
}

.lcbp-sidebar-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lcbp-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--lcbp-border);
    border-radius: 4px;
    overflow: hidden;
}

.lcbp-progress-fill {
    height: 100%;
    background: var(--lcbp-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.lcbp-progress-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--lcbp-text);
    white-space: nowrap;
}

/* Section list */
.lcbp-sections-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Section */
.lcbp-section {
    border-bottom: 1px solid var(--lcbp-border);
}

.lcbp-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--lcbp-bg-light);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.lcbp-section-header:hover {
    background: #eef0f2;
}

.lcbp-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--lcbp-text);
    margin: 0;
    flex: 1;
}

.lcbp-section-info {
    font-size: 12px;
    color: var(--lcbp-text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.lcbp-section-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.lcbp-section.collapsed .lcbp-section-toggle {
    transform: rotate(-90deg);
}

/* Lesson list */
.lcbp-lessons-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lcbp-section.collapsed .lcbp-lessons-list {
    display: none;
}

/* Lesson item */
.lcbp-lesson-item {
    display: flex;
    align-items: center;
    padding: 12px 16px 12px 24px;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.lcbp-lesson-item:hover {
    background: var(--lcbp-bg-light);
}

.lcbp-lesson-item.current {
    background: #f3e5f5;
    border-left-color: var(--lcbp-primary);
}

.lcbp-lesson-item.completed {
    opacity: 0.8;
}

/* Lesson status checkbox */
.lcbp-lesson-status {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--lcbp-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.lcbp-lesson-item.completed .lcbp-lesson-status {
    background: var(--lcbp-success);
    border-color: var(--lcbp-success);
}

.lcbp-lesson-item.completed .lcbp-lesson-status::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.lcbp-lesson-item.in-progress .lcbp-lesson-status {
    border-color: var(--lcbp-primary);
    background: rgba(164, 53, 240, 0.1);
}

.lcbp-lesson-item.in-progress .lcbp-lesson-status::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--lcbp-primary);
    border-radius: 50%;
}

/* Lesson content */
.lcbp-lesson-content-info {
    flex: 1;
    min-width: 0;
}

.lcbp-lesson-title {
    font-size: 14px;
    color: var(--lcbp-text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lcbp-lesson-meta {
    font-size: 12px;
    color: var(--lcbp-text-light);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.lcbp-lesson-type {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.lcbp-lesson-type-icon {
    font-size: 14px;
}

.lcbp-lesson-duration {
    color: var(--lcbp-text-light);
}

/* =========================================
   Main Content Area
   ========================================= */
.lcbp-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Course header */
.lcbp-course-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--lcbp-secondary);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.lcbp-course-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lcbp-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.lcbp-toggle-sidebar {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lcbp-toggle-sidebar:hover {
    opacity: 0.8;
}

/* Lesson content */
.lcbp-lesson-wrapper {
    flex: 1;
    padding: 32px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.lcbp-lesson-header {
    margin-bottom: 24px;
}

.lcbp-lesson-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--lcbp-text);
    margin: 0 0 12px 0;
}

.lcbp-lesson-header-meta {
    font-size: 14px;
    color: var(--lcbp-text-light);
    display: flex;
    align-items: center;
    gap: 16px;
}

.lcbp-lesson-body {
    background: var(--lcbp-bg-white);
    border-radius: 8px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.lcbp-lesson-body p {
    font-size: 16px;
    line-height: 1.7;
    color: var(--lcbp-text);
    margin-bottom: 16px;
}

.lcbp-lesson-body h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--lcbp-text);
    margin: 32px 0 16px 0;
}

.lcbp-lesson-body h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--lcbp-text);
    margin: 24px 0 12px 0;
}

.lcbp-lesson-body ul,
.lcbp-lesson-body ol {
    margin: 0 0 16px 24px;
}

.lcbp-lesson-body li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.lcbp-lesson-body code {
    background: var(--lcbp-bg-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}

.lcbp-lesson-body pre {
    background: var(--lcbp-secondary);
    color: #f5f5f5;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.lcbp-lesson-body pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.lcbp-lesson-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}

.lcbp-lesson-body blockquote {
    border-left: 4px solid var(--lcbp-primary);
    padding: 16px 24px;
    margin: 24px 0;
    background: var(--lcbp-bg-light);
    font-style: italic;
}

/* Video player container */
.lcbp-video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    background: var(--lcbp-secondary);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 24px;
}

.lcbp-video-container iframe,
.lcbp-video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* =========================================
   Lesson Navigation
   ========================================= */
.lcbp-lesson-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-top: 1px solid var(--lcbp-border);
    margin-top: 32px;
}

.lcbp-nav-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--lcbp-bg-white);
    border: 1px solid var(--lcbp-border);
    border-radius: 8px;
    color: var(--lcbp-text);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.lcbp-nav-button:hover {
    background: var(--lcbp-bg-light);
    border-color: var(--lcbp-primary);
    color: var(--lcbp-primary);
}

.lcbp-nav-button.primary {
    background: var(--lcbp-primary);
    border-color: var(--lcbp-primary);
    color: white;
}

.lcbp-nav-button.primary:hover {
    background: var(--lcbp-primary-dark);
    border-color: var(--lcbp-primary-dark);
    color: white;
}

.lcbp-nav-button:disabled,
.lcbp-nav-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lcbp-nav-progress {
    text-align: center;
}

.lcbp-nav-progress-text {
    font-size: 14px;
    color: var(--lcbp-text-light);
}

/* Mark complete button */
.lcbp-mark-complete {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--lcbp-success);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.lcbp-mark-complete:hover {
    background: #43a047;
}

.lcbp-mark-complete.completed {
    background: var(--lcbp-bg-light);
    color: var(--lcbp-success);
    cursor: default;
}

/* =========================================
   Course Completion
   ========================================= */
.lcbp-course-complete {
    text-align: center;
    padding: 48px;
    background: linear-gradient(135deg, #a435f0 0%, #5624d0 100%);
    border-radius: 16px;
    color: white;
}

.lcbp-course-complete h2 {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 16px 0;
}

.lcbp-course-complete p {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 24px;
}

.lcbp-certificate-code {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 12px 24px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 18px;
    margin-bottom: 24px;
}

.lcbp-download-certificate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: white;
    border: none;
    border-radius: 8px;
    color: var(--lcbp-primary);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.lcbp-download-certificate:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* =========================================
   Mobile Responsive
   ========================================= */
@media (max-width: 1024px) {
    .lcbp-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .lcbp-sidebar.open {
        left: 0;
    }

    .lcbp-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .lcbp-sidebar.open + .lcbp-sidebar-overlay {
        display: block;
    }

    .lcbp-lesson-wrapper {
        padding: 20px 16px;
    }

    .lcbp-lesson-body {
        padding: 20px;
    }

    .lcbp-toggle-sidebar {
        display: flex;
    }
}

@media (min-width: 1025px) {
    .lcbp-toggle-sidebar {
        display: none;
    }
}

@media (max-width: 640px) {
    .lcbp-lesson-nav {
        flex-direction: column;
        gap: 16px;
    }

    .lcbp-nav-button {
        width: 100%;
        justify-content: center;
    }

    .lcbp-lesson-header h1 {
        font-size: 22px;
    }

    .lcbp-course-complete {
        padding: 32px 20px;
    }

    .lcbp-course-complete h2 {
        font-size: 24px;
    }
}

/* =========================================
   Loading States
   ========================================= */
.lcbp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.lcbp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--lcbp-border);
    border-top-color: var(--lcbp-primary);
    border-radius: 50%;
    animation: lcbp-spin 1s linear infinite;
}

@keyframes lcbp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast notifications */
.lcbp-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    background: var(--lcbp-secondary);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.lcbp-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.lcbp-toast.success {
    background: var(--lcbp-success);
}

.lcbp-toast.error {
    background: var(--lcbp-error);
}

/* =========================================
   Enhanced Lesson Navigation
   ========================================= */
.lcbp-lesson-navigation {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--lcbp-border);
}

.lcbp-nav-row {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.lcbp-nav-button.lcbp-nav-prev,
.lcbp-nav-button.lcbp-nav-next {
    flex: 1;
    max-width: 280px;
    padding: 16px 20px;
    text-align: left;
}

.lcbp-nav-button.lcbp-nav-next {
    text-align: right;
    flex-direction: row-reverse;
}

.lcbp-nav-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lcbp-nav-direction {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--lcbp-text-light);
    font-weight: 500;
}

.lcbp-nav-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--lcbp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.lcbp-nav-button:hover .lcbp-nav-title {
    color: var(--lcbp-primary);
}

.lcbp-nav-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.lcbp-continue-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--lcbp-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.lcbp-continue-btn:hover {
    background: var(--lcbp-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(164, 53, 240, 0.3);
}

.lcbp-finish-btn {
    background: linear-gradient(135deg, #a435f0 0%, #5624d0 100%);
}

.lcbp-finish-btn:hover {
    background: linear-gradient(135deg, #8b2dcf 0%, #4a1fb8 100%);
}

.lcbp-nav-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    padding: 12px;
    background: var(--lcbp-bg-light);
    border-radius: 8px;
    font-size: 13px;
    color: var(--lcbp-text-light);
}

.lcbp-nav-hint .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Responsive navigation */
@media (max-width: 768px) {
    .lcbp-nav-row {
        flex-direction: column;
    }

    .lcbp-nav-button.lcbp-nav-prev,
    .lcbp-nav-button.lcbp-nav-next {
        max-width: 100%;
    }

    .lcbp-nav-button.lcbp-nav-next {
        text-align: left;
        flex-direction: row;
    }

    .lcbp-nav-progress {
        order: -1;
    }

    .lcbp-nav-title {
        max-width: 100%;
    }

    .lcbp-nav-actions {
        flex-direction: column;
    }

    .lcbp-continue-btn,
    .lcbp-mark-complete {
        width: 100%;
        justify-content: center;
    }

    .lcbp-nav-hint {
        text-align: center;
    }
}
