/* ── Hide theme chrome on learning pages ─────────────────────────────────── */
body.single-cmp_lesson .kca-sticky-header,
body.single-cmp_lesson .kca-footer,
body.single-cmp_lesson .kca-sticky-cta,
body.single-cmp_course .kca-sticky-header,
body.single-cmp_course .kca-footer,
body.single-cmp_course .kca-sticky-cta {
    display: none !important;
}

body.single-cmp_lesson,
body.single-cmp_course {
    background: #fff;
}

/* ── Lesson page layout ──────────────────────────────────────────────────── */
.cmp-lesson-page {
    max-width: 100%;
    overflow-x: hidden;
}

/* ── Lesson topbar (replaces breadcrumb) ─────────────────────────────────── */
.cmp-lesson-topbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 var(--cmp-gap, 1.5rem);
    height: 52px;
    background: #fff;
    border-bottom: 1px solid var(--cmp-border, #e5e7eb);
    position: sticky;
    top: 0;
    z-index: 100;
}

.cmp-lesson-topbar__back {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    font-size: .875rem;
    font-weight: 600;
    color: var(--cmp-text-muted, #6b7280);
    text-decoration: none;
    flex-shrink: 0;
    padding: .25rem .5rem;
    border-radius: 6px;
    transition: background .12s, color .12s;
}
.cmp-lesson-topbar__back:hover { background: var(--cmp-bg-alt, #f9fafb); color: var(--cmp-text, #111827); }

.cmp-lesson-topbar__course {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--cmp-text, #111827);
    text-align: center;
}
.cmp-lesson-topbar__course a { color: inherit; text-decoration: none; }
.cmp-lesson-topbar__course a:hover { color: var(--cmp-primary, #FF4D1C); }

.cmp-lesson-topbar__right {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}

.cmp-sidebar-toggle {
    display: none;
    align-items: center;
    gap: .375rem;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--cmp-text-muted, #6b7280);
    background: none;
    border: 1px solid var(--cmp-border, #e5e7eb);
    border-radius: 6px;
    padding: .3rem .625rem;
    cursor: pointer;
    transition: background .12s;
}
.cmp-sidebar-toggle:hover { background: var(--cmp-bg-alt, #f9fafb); color: var(--cmp-text, #111827); }

.cmp-lesson-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    min-height: calc(100vh - 120px);
    align-items: start;
}

@media (max-width: 1024px) {
    .cmp-lesson-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .cmp-lesson-layout {
        grid-template-columns: 1fr;
    }
    .cmp-sidebar-toggle { display: inline-flex; }
    .cmp-lesson-sidebar {
        position: fixed !important;
        right: 0;
        top: 0;
        height: 100vh;
        max-height: 100vh;
        width: min(300px, 85vw);
        transform: translateX(100%);
        transition: transform .25s ease;
        z-index: 200;
        box-shadow: -4px 0 24px rgba(0,0,0,.15);
        border-left: 1px solid var(--cmp-border, #e5e7eb) !important;
        border-top: none !important;
    }
    .cmp-lesson-sidebar--open { transform: translateX(0) !important; }
    .cmp-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 199;
    }
    .cmp-sidebar-backdrop--open { display: block; }
}

/* ── Main content ────────────────────────────────────────────────────────── */
.cmp-lesson-main {
    padding: 1.5rem;
    min-width: 0;
}

.cmp-lesson-description {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--cmp-border, #e5e7eb);
    line-height: 1.7;
}

/* ── Mark complete / nav ─────────────────────────────────────────────────── */
.cmp-lesson-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--cmp-border, #e5e7eb);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.cmp-lesson-nav {
    display: flex;
    gap: .75rem;
    margin-left: auto;
    flex-wrap: wrap;
}

.cmp-complete-btn--done {
    background: var(--cmp-success, #10b981) !important;
    cursor: default;
}

/* ── Text content ────────────────────────────────────────────────────────── */
.cmp-lesson-text-content {
    line-height: 1.8;
    font-size: 1.0625rem;
}

.cmp-lesson-text-content img { max-width: 100%; height: auto; border-radius: .5rem; }
.cmp-lesson-text-content h2,
.cmp-lesson-text-content h3 { margin-top: 1.75rem; }

/* ── Video player (Plyr wrapper) ────────────────────────────────────────── */
.cmp-video-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: .75rem;
    overflow: hidden;
}

.cmp-video-player .plyr {
    width: 100%;
    height: 100%;
    border-radius: .75rem;
}

/* ── PDF viewer ──────────────────────────────────────────────────────────── */
.cmp-pdf-viewer {
    border: 1px solid var(--cmp-border, #e5e7eb);
    border-radius: .75rem;
    overflow: hidden;
    background: #fff;
}

.cmp-pdf-viewer__toolbar {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    background: var(--cmp-bg-alt, #f9fafb);
    border-bottom: 1px solid var(--cmp-border, #e5e7eb);
    flex-wrap: wrap;
}

.cmp-pdf-viewer__pages {
    font-size: .875rem;
    color: var(--cmp-text-muted, #6b7280);
    min-width: 80px;
    text-align: center;
}

.cmp-pdf-viewer__canvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
}

/* ── PPTX / iframe viewer ────────────────────────────────────────────────── */
.cmp-pptx-viewer {
    border-radius: .75rem;
    overflow: hidden;
    border: 1px solid var(--cmp-border, #e5e7eb);
}

.cmp-pptx-viewer__frame {
    width: 100%;
    height: 540px;
    border: none;
    display: block;
}

@media (max-width: 768px) {
    .cmp-pptx-viewer__frame { height: 320px; }
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.cmp-lesson-sidebar {
    border-left: 1px solid var(--cmp-border, #e5e7eb);
    background: var(--cmp-bg-alt, #f9fafb);
    overflow-y: auto;
    max-height: calc(100vh - 120px);
    position: sticky;
    top: 0;
}

@media (max-width: 1024px) {
    .cmp-lesson-sidebar {
        position: static;
        max-height: none;
        border-left: none;
        border-top: 1px solid var(--cmp-border, #e5e7eb);
    }
}

.cmp-lesson-sidebar__title {
    font-size: .875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--cmp-text-muted, #6b7280);
    padding: 1rem 1rem .5rem;
    margin: 0;
}

.cmp-sidebar-section { padding: .25rem 0; }

.cmp-sidebar-section__title {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--cmp-text-muted, #6b7280);
    padding: .5rem 1rem .25rem;
}

.cmp-sidebar-lessons {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cmp-sidebar-lesson a {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1rem;
    font-size: .875rem;
    color: var(--cmp-text, #111827);
    text-decoration: none;
    transition: background .15s;
    line-height: 1.3;
}

.cmp-sidebar-lesson a:hover {
    background: var(--cmp-border, #e5e7eb);
}

.cmp-sidebar-lesson--current a {
    background: var(--cmp-primary-light, #ede9fe);
    color: var(--cmp-primary, #7c3aed);
    font-weight: 600;
}

.cmp-sidebar-lesson--done .cmp-sidebar-lesson__check { color: var(--cmp-success, #10b981); }

.cmp-sidebar-lesson__check {
    flex-shrink: 0;
    width: 1.125rem;
    text-align: center;
    font-size: .75rem;
    color: #d1d5db;
}

/* ── Lock overlay ────────────────────────────────────────────────────────── */
.cmp-lock-overlay {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--cmp-bg-alt, #f9fafb);
    border-radius: .75rem;
    border: 2px dashed var(--cmp-border, #e5e7eb);
}

.cmp-lock-overlay__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.cmp-lock-overlay__title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: .5rem;
}

.cmp-lock-overlay__desc {
    color: var(--cmp-text-muted, #6b7280);
    margin-bottom: 1.5rem;
}

/* ── Course single ───────────────────────────────────────────────────────── */
.cmp-course-single { overflow: hidden; }

.cmp-course-hero {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    color: #fff;
    padding: 3rem 0 2.5rem;
}

.cmp-course-hero__inner {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .cmp-course-hero__inner { grid-template-columns: 1fr; }
}

.cmp-course-hero__cats { margin-bottom: .75rem; }

.cmp-course-hero__title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 1rem;
    color: #fff;
}

.cmp-course-hero__excerpt {
    font-size: 1.0625rem;
    color: rgba(255,255,255,.8);
    margin: 0 0 1.25rem;
    line-height: 1.6;
}

.cmp-course-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem .75rem;
    align-items: center;
    font-size: .875rem;
    color: rgba(255,255,255,.75);
}

.cmp-course-meta__item { display: flex; align-items: center; gap: .25rem; }

/* Enroll card */
.cmp-enroll-card {
    background: #fff;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    color: var(--cmp-text, #111827);
}

.cmp-enroll-card__thumbnail img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.cmp-enroll-card .cmp-card__body { padding: 1.25rem; }

.cmp-enroll-card__price {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.cmp-price--sale {
    color: var(--cmp-primary, #7c3aed);
    margin-right: .5rem;
}

.cmp-price--original {
    font-size: 1rem;
    color: var(--cmp-text-muted, #6b7280);
}

.cmp-enroll-card__enrolled .cmp-progress-bar { margin-bottom: .5rem; }
.cmp-enroll-card__progress-label {
    font-size: .875rem;
    color: var(--cmp-text-muted, #6b7280);
    margin-bottom: 1rem;
}

.cmp-enroll-card__preview-link {
    display: block;
    text-align: center;
    margin-top: .75rem;
    font-size: .875rem;
    color: var(--cmp-primary, #7c3aed);
    text-decoration: none;
}

.cmp-enroll-card__preview-link:hover { text-decoration: underline; }

/* Course body */
.cmp-course-body { padding: 2.5rem 0; }

.cmp-course-body__inner { max-width: 860px; }

.cmp-course-section { margin-bottom: 2.5rem; }

.cmp-section-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--cmp-border, #e5e7eb);
}

/* Curriculum list */
.cmp-curriculum { border: 1px solid var(--cmp-border, #e5e7eb); border-radius: .75rem; overflow: hidden; }

.cmp-curriculum__section { border-bottom: 1px solid var(--cmp-border, #e5e7eb); }
.cmp-curriculum__section:last-child { border-bottom: none; }

.cmp-curriculum__section-title {
    font-size: .875rem;
    font-weight: 700;
    background: var(--cmp-bg-alt, #f9fafb);
    padding: .75rem 1rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--cmp-text-muted, #6b7280);
}

.cmp-curriculum__lessons {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cmp-curriculum__lesson a,
.cmp-curriculum__lesson > * {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .625rem 1rem;
    font-size: .9375rem;
    color: var(--cmp-text, #111827);
    text-decoration: none;
    transition: background .15s;
}

.cmp-curriculum__lesson:not(.cmp-curriculum__lesson--locked) a:hover {
    background: var(--cmp-bg-alt, #f9fafb);
}

.cmp-curriculum__lesson + .cmp-curriculum__lesson {
    border-top: 1px solid var(--cmp-border, #e5e7eb);
}

.cmp-curriculum__lesson--done .cmp-curriculum__lesson-icon { color: var(--cmp-success, #10b981); }
.cmp-curriculum__lesson--locked { opacity: .6; }

.cmp-curriculum__lesson-icon { flex-shrink: 0; width: 1.25rem; text-align: center; }

.cmp-curriculum__lesson-dur {
    margin-left: auto;
    font-size: .8125rem;
    color: var(--cmp-text-muted, #6b7280);
    flex-shrink: 0;
}

.cmp-curriculum__lesson-title { flex: 1; }

/* Container helper (if not defined globally) */
.cmp-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--cmp-gap, 1.5rem);
}

/* ── Rating form (Phase 8) ───────────────────────────────────────────────── */
.cmp-rating-form {
    background: var(--cmp-bg-alt, #f9fafb);
    border: 1px solid var(--cmp-border, #e5e7eb);
    border-radius: .75rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.cmp-rating-form__title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 .875rem;
}

.cmp-star-picker {
    display: flex;
    gap: .125rem;
    margin-bottom: .875rem;
}

.cmp-star-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: #d1d5db;
    padding: 0;
    line-height: 1;
    transition: color .1s, transform .1s;
}

.cmp-star-btn--active,
.cmp-star-btn:hover { color: #f59e0b; transform: scale(1.15); }

.cmp-rating-form__text {
    width: 100%;
    box-sizing: border-box;
    padding: .5rem .75rem;
    border: 1px solid var(--cmp-border, #e5e7eb);
    border-radius: .5rem;
    font-size: .9375rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: .875rem;
}

.cmp-rating-form__result { margin-top: .75rem; }

/* Reviews list */
.cmp-reviews-list { display: flex; flex-direction: column; gap: 1rem; }

.cmp-review-item {
    padding: 1rem 1.25rem;
    background: #fff;
    border: 1px solid var(--cmp-border, #e5e7eb);
    border-radius: .75rem;
}

.cmp-review-item__header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .5rem;
}

.cmp-review-item__stars { color: #f59e0b; letter-spacing: .05em; }

.cmp-review-item__author {
    font-weight: 600;
    font-size: .9375rem;
}

.cmp-review-item__date {
    font-size: .8125rem;
    color: var(--cmp-text-muted, #6b7280);
    margin-left: auto;
}

.cmp-review-item__body {
    font-size: .9375rem;
    line-height: 1.6;
    color: var(--cmp-text, #111827);
    margin: 0;
}

.cmp-no-reviews {
    color: var(--cmp-text-muted, #6b7280);
    font-style: italic;
}

/* ── Course breadcrumb ───────────────────────────────────────────────────── */
.cmp-course-breadcrumb {
    display: flex;
    align-items: center;
    gap: .375rem;
    font-size: .8125rem;
    color: rgba(255,255,255,.6);
    padding: .875rem 0 0;
    flex-wrap: wrap;
}
.cmp-course-breadcrumb a { color: rgba(255,255,255,.75); text-decoration: none; }
.cmp-course-breadcrumb a:hover { color: #fff; text-decoration: underline; }
.cmp-course-breadcrumb__sep { opacity: .5; }

/* Override breadcrumb color outside hero (if placed before hero) */
.cmp-course-single > .cmp-container:first-child .cmp-course-breadcrumb {
    color: var(--cmp-text-muted, #6b7280);
    padding: .875rem 0;
    border-bottom: 1px solid var(--cmp-border, #e5e7eb);
    margin-bottom: 0;
}
.cmp-course-single > .cmp-container:first-child .cmp-course-breadcrumb a { color: var(--cmp-text-muted, #6b7280); }
.cmp-course-single > .cmp-container:first-child .cmp-course-breadcrumb a:hover { color: var(--cmp-primary, #FF4D1C); }

/* ── Hero progress (enrolled) ────────────────────────────────────────────── */
.cmp-hero-progress {
    margin-top: 1.25rem;
    display: flex;
    align-items: center;
    gap: .75rem;
}
.cmp-hero-progress__bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,.2);
    border-radius: 3px;
    overflow: hidden;
    max-width: 240px;
}
.cmp-hero-progress__fill {
    height: 100%;
    background: #fff;
    border-radius: 3px;
    transition: width .4s ease;
}
.cmp-hero-progress__label {
    font-size: .8125rem;
    color: rgba(255,255,255,.75);
    white-space: nowrap;
}

/* ── Lock overlay price ──────────────────────────────────────────────────── */
.cmp-lock-overlay__price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cmp-text, #111827);
    margin: 0 0 1.25rem;
}

/* ── Curriculum accordion ────────────────────────────────────────────────── */
.cmp-curriculum__section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1rem;
    background: var(--cmp-bg-alt, #f9fafb);
    border: none;
    border-bottom: 1px solid var(--cmp-border, #e5e7eb);
    font-size: .875rem;
    font-weight: 700;
    color: var(--cmp-text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: .04em;
    cursor: pointer;
    text-align: left;
    transition: background .12s;
}
.cmp-curriculum__section-toggle:hover { background: #eef2ff; }
.cmp-curriculum__section-chevron { flex-shrink: 0; font-size: .75rem; transition: transform .2s; }
.cmp-curriculum__section-name { flex: 1; }
.cmp-curriculum__section-count { font-weight: 400; font-size: .8125rem; color: #9ca3af; margin-left: auto; }

.cmp-curriculum__lessons--body { display: block; }
.cmp-curriculum__section:not(.cmp-curriculum__section--open) .cmp-curriculum__lessons--body { display: none; }
