/* ============================================
   COURSE SHOW PAGE — Clean Modern Design
   MES RÉVISIONS — 2025 Edition
   ============================================ */

:root {
    --cs-primary: #4f46e5;
    --cs-primary-dark: #4338ca;
    --cs-primary-light: #818cf8;
    --cs-primary-ultra-light: #eef2ff;
    --cs-accent: #0ea5e9;
    --cs-accent-light: #7dd3fc;
    --cs-success: #10b981;
    --cs-success-light: #6ee7b7;
    --cs-warning: #f59e0b;
    --cs-warning-light: #fcd34d;
    --cs-danger: #ef4444;
    --cs-danger-light: #fca5a5;

    --cs-dark: #111827;
    --cs-dark-lighter: #1f2937;
    --cs-gray-900: #111827;
    --cs-gray-800: #1f2937;
    --cs-gray-700: #374151;
    --cs-gray-600: #4b5563;
    --cs-gray-500: #6b7280;
    --cs-gray-400: #9ca3af;
    --cs-gray-300: #d1d5db;
    --cs-gray-200: #e5e7eb;
    --cs-gray-100: #f3f4f6;
    --cs-gray-50: #f9fafb;
    --cs-white: #ffffff;

    --cs-radius-xl: 20px;
    --cs-radius: 14px;
    --cs-radius-md: 10px;
    --cs-radius-sm: 8px;
    --cs-radius-xs: 4px;

    --cs-shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --cs-shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --cs-shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --cs-shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --cs-shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);

    --cs-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --cs-transition-fast: all 0.15s ease;
}

/* ==========================
   PAGE
   ========================== */
.cs-page {
    background: var(--cs-gray-50);
    min-height: 100vh;
    padding-bottom: 3rem;
}

/* ==========================
   TOP BAR
   ========================== */
.cs-topbar {
    background: var(--cs-white);
    border-bottom: 1px solid var(--cs-gray-200);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--cs-shadow-xs);
}

.cs-topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cs-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--cs-gray-600);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.5rem 0.875rem;
    border-radius: var(--cs-radius-sm);
    transition: var(--cs-transition-fast);
    background: var(--cs-gray-50);
    border: 1px solid var(--cs-gray-200);
    flex-shrink: 0;
}

.cs-back-btn:hover {
    background: var(--cs-primary);
    color: var(--cs-white);
    border-color: var(--cs-primary);
}

.cs-topbar-title {
    flex: 1;
    min-width: 0;
}

.cs-topbar-title .cs-subject {
    font-size: 0.7rem;
    color: var(--cs-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--cs-primary-ultra-light);
    border-radius: var(--cs-radius-xs);
    margin-bottom: 0.15rem;
}

.cs-topbar-title h1 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--cs-dark);
    margin: 0;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cs-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.cs-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cs-badge.free {
    background: #d1fae5;
    color: #065f46;
}

.cs-badge.premium {
    background: #fef3c7;
    color: #92400e;
}

.cs-share-btn {
    background: var(--cs-gray-50);
    border: 1px solid var(--cs-gray-200);
    color: var(--cs-gray-500);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--cs-transition-fast);
    font-size: 0.9rem;
}

.cs-share-btn:hover {
    background: var(--cs-primary);
    color: var(--cs-white);
    border-color: var(--cs-primary);
}

/* ==========================
   MAIN LAYOUT
   ========================== */
.cs-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    align-items: start;
}

.cs-main-col {
    min-width: 0;
}

/* ==========================
   MEDIA PLAYER
   ========================== */
.cs-player-wrap {
    background: #0f172a;
    border-radius: var(--cs-radius);
    overflow: hidden;
    box-shadow: var(--cs-shadow-md);
    margin-bottom: 1.25rem;
}

.cs-player-inner {
    position: relative;
    width: 100%;
    min-height: 360px;
}

.cs-player-inner video,
.cs-player-inner iframe {
    width: 100%;
    display: block;
}

.cs-player-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    color: var(--cs-gray-400);
    text-align: center;
    padding: 2rem;
}

.cs-player-placeholder i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
    color: var(--cs-primary-light);
}

.cs-player-placeholder p {
    font-size: 0.9rem;
    margin: 0;
}

/* ==========================
   CONTENT INFO CARD
   ========================== */
.cs-content-info {
    background: var(--cs-white);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-sm);
    overflow: hidden;
    margin-bottom: 1.25rem;
    border: 1px solid var(--cs-gray-200);
}

.cs-content-info-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--cs-gray-100);
}

.cs-content-info-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cs-dark);
    margin: 0 0 0.6rem;
    line-height: 1.3;
}

.cs-content-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.cs-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cs-gray-600);
    background: var(--cs-gray-50);
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    border: 1px solid var(--cs-gray-200);
}

.cs-meta-chip i {
    font-size: 0.8rem;
    color: var(--cs-primary);
}

/* ==========================
   LESSON CONTENT BODY
   ========================== */
.cs-content-body-text {
    padding: 1.5rem;
    line-height: 1.75;
    color: var(--cs-gray-700);
    font-size: 0.95rem;
    min-height: 120px;
    transition: background-color 0.5s ease;
}

.cs-content-body-text h1,
.cs-content-body-text h2,
.cs-content-body-text h3,
.cs-content-body-text h4 {
    color: var(--cs-dark);
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.cs-content-body-text h1 { font-size: 1.5rem; }
.cs-content-body-text h2 { font-size: 1.25rem; }
.cs-content-body-text h3 { font-size: 1.1rem; }

.cs-content-body-text p { margin-bottom: 1rem; }

.cs-content-body-text ul,
.cs-content-body-text ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.cs-content-body-text li { margin-bottom: 0.35rem; }

.cs-content-body-text img {
    max-width: 100%;
    height: auto;
    border-radius: var(--cs-radius-sm);
    margin: 1rem 0;
}

.cs-content-body-text blockquote {
    border-left: 3px solid var(--cs-primary);
    padding: 0.75rem 1rem;
    background: var(--cs-primary-ultra-light);
    border-radius: 0 var(--cs-radius-sm) var(--cs-radius-sm) 0;
    margin: 1rem 0;
    font-style: italic;
    color: var(--cs-gray-700);
}

.cs-content-body-text pre,
.cs-content-body-text code {
    background: var(--cs-gray-100);
    border-radius: var(--cs-radius-xs);
    font-size: 0.85rem;
}

.cs-content-body-text pre {
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.cs-content-body-text code {
    padding: 0.15rem 0.4rem;
}

/* Empty State */
.cs-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--cs-gray-400);
}

.cs-empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0.5;
}

.cs-empty-state p {
    font-size: 0.9rem;
    margin: 0;
}

/* ==========================
   NAVIGATION BUTTONS
   ========================== */
.cs-nav-buttons {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--cs-gray-100);
    background: var(--cs-gray-50);
    align-items: center;
}

.cs-complete-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--cs-radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    border: 2px solid var(--cs-success);
    color: var(--cs-success);
    background: var(--cs-white);
    cursor: pointer;
    transition: var(--cs-transition);
    white-space: nowrap;
}

.cs-complete-btn:hover:not(.completed):not([disabled]) {
    background: var(--cs-success);
    color: var(--cs-white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.cs-complete-btn.completed {
    background: var(--cs-success);
    color: var(--cs-white);
    border-color: var(--cs-success);
    cursor: default;
}

.cs-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: var(--cs-radius-sm);
    border: 1px solid var(--cs-gray-200);
    background: var(--cs-white);
    color: var(--cs-gray-700);
    font-weight: 600;
    cursor: pointer;
    transition: var(--cs-transition-fast);
    max-width: 220px;
    min-width: 0;
}

.cs-nav-btn.next {
    justify-content: flex-end;
    text-align: right;
    margin-left: auto;
}

.cs-nav-btn:not([disabled]):hover {
    border-color: var(--cs-primary);
    color: var(--cs-primary);
    background: var(--cs-primary-ultra-light);
}

.cs-nav-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.cs-nav-btn-label {
    font-size: 0.65rem;
    color: var(--cs-gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.cs-nav-btn-title {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    color: var(--cs-gray-700);
}

/* ==========================
   TABS
   ========================== */
.cs-tabs {
    display: flex;
    gap: 0;
    background: var(--cs-white);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-sm);
    overflow: hidden;
    margin-bottom: 1.25rem;
    border: 1px solid var(--cs-gray-200);
}

.cs-tab-btn {
    flex: 1;
    padding: 0.875rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--cs-gray-500);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--cs-transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.cs-tab-btn:hover {
    color: var(--cs-primary);
    background: var(--cs-primary-ultra-light);
}

.cs-tab-btn.active {
    color: var(--cs-primary);
    border-bottom-color: var(--cs-primary);
    background: var(--cs-primary-ultra-light);
    font-weight: 700;
}

.cs-tab-badge {
    background: var(--cs-primary);
    color: var(--cs-white);
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* ==========================
   TAB PANELS
   ========================== */
.cs-tab-panel {
    display: none;
}

.cs-tab-panel.active {
    display: block;
}

/* Overview Card */
.cs-overview-card {
    background: var(--cs-white);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-sm);
    overflow: hidden;
    border: 1px solid var(--cs-gray-200);
    margin-bottom: 1.25rem;
}

.cs-card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--cs-gray-100);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--cs-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cs-card-header i {
    color: var(--cs-primary);
}

.cs-card-body {
    padding: 1.5rem;
}

/* Course Details */
.cs-course-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.cs-detail-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--cs-radius-sm);
    background: var(--cs-gray-50);
    border: 1px solid var(--cs-gray-100);
}

.cs-detail-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--cs-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--cs-white);
    flex-shrink: 0;
}

.cs-detail-icon.subject { background: var(--cs-primary); }
.cs-detail-icon.level { background: var(--cs-accent); }
.cs-detail-icon.chapters { background: var(--cs-success); }
.cs-detail-icon.duration { background: var(--cs-warning); }

.cs-detail-label {
    font-size: 0.7rem;
    color: var(--cs-gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.cs-detail-value {
    font-size: 0.9rem;
    color: var(--cs-dark);
    font-weight: 700;
}

/* Objectives */
.cs-objectives-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cs-objectives-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--cs-gray-700);
    line-height: 1.5;
}

.cs-objectives-list li i {
    color: var(--cs-success);
    margin-top: 0.15rem;
    flex-shrink: 0;
}

/* ==========================
   COMMENTS
   ========================== */
.cs-comment-form {
    background: var(--cs-white);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-sm);
    border: 1px solid var(--cs-gray-200);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.cs-comment-form h5 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--cs-dark);
    margin: 0 0 0.75rem;
}

.cs-comment-form textarea {
    width: 100%;
    border: 1px solid var(--cs-gray-200);
    border-radius: var(--cs-radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--cs-gray-700);
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    transition: var(--cs-transition-fast);
    background: var(--cs-gray-50);
}

.cs-comment-form textarea:focus {
    outline: none;
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: var(--cs-white);
}

.cs-comment-submit {
    margin-top: 0.75rem;
    padding: 0.55rem 1.25rem;
    background: var(--cs-primary);
    color: var(--cs-white);
    border: none;
    border-radius: var(--cs-radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--cs-transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.cs-comment-submit:hover {
    background: var(--cs-primary-dark);
}

.cs-comment-item {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--cs-gray-100);
}

.cs-comment-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cs-comment-item:first-child {
    padding-top: 0;
}

.cs-comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cs-primary-ultra-light);
    color: var(--cs-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.cs-comment-author {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--cs-dark);
}

.cs-comment-date {
    font-size: 0.75rem;
    color: var(--cs-gray-400);
    margin-top: 0.1rem;
}

.cs-comment-text {
    font-size: 0.875rem;
    color: var(--cs-gray-600);
    margin-top: 0.35rem;
    line-height: 1.6;
}

/* ==========================
   PREMIUM LOCK
   ========================== */
.cs-premium-lock {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--cs-white);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-sm);
    border: 1px solid var(--cs-gray-200);
}

.cs-premium-lock .lock-icon {
    font-size: 3rem;
    color: var(--cs-warning);
    margin-bottom: 1rem;
}

.cs-premium-lock h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cs-dark);
    margin-bottom: 0.5rem;
}

.cs-premium-lock p {
    color: var(--cs-gray-500);
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto 1.5rem;
}

.cs-premium-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.5rem;
    background: var(--cs-warning);
    color: var(--cs-white);
    border: none;
    border-radius: var(--cs-radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--cs-transition-fast);
}

.cs-premium-btn:hover {
    background: #d97706;
    color: var(--cs-white);
    transform: translateY(-1px);
}

/* ==========================
   SIDEBAR
   ========================== */
.cs-sidebar {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    background: var(--cs-white);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-sm);
    border: 1px solid var(--cs-gray-200);
}

.cs-sidebar::-webkit-scrollbar {
    width: 4px;
}

.cs-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.cs-sidebar::-webkit-scrollbar-thumb {
    background: var(--cs-gray-300);
    border-radius: 2px;
}

.cs-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--cs-gray-400);
}

/* Progress Box */
.cs-progress-box {
    padding: 1.25rem;
    border-bottom: 1px solid var(--cs-gray-100);
    background: var(--cs-gray-50);
}

.cs-progress-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.cs-progress-top h5 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--cs-dark);
    margin: 0;
}

.cs-progress-count {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--cs-primary);
    background: var(--cs-primary-ultra-light);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

.cs-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--cs-gray-200);
    border-radius: 8px;
    overflow: hidden;
}

.cs-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cs-primary), var(--cs-accent));
    border-radius: 8px;
    transition: width 0.6s ease;
}

.cs-progress-label {
    font-size: 0.75rem;
    color: var(--cs-gray-500);
    font-weight: 600;
    margin-top: 0.35rem;
    text-align: right;
}

/* ==========================
   CHAPTER LIST
   ========================== */
.cs-chapter-list {
    padding: 0.5rem 0;
}

.cs-chapter {
    border-bottom: 1px solid var(--cs-gray-100);
}

.cs-chapter:last-child {
    border-bottom: none;
}

.cs-chapter-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: var(--cs-transition-fast);
}

.cs-chapter-toggle:hover {
    background: var(--cs-gray-50);
}

.cs-chapter-num {
    width: 30px;
    height: 30px;
    border-radius: var(--cs-radius-sm);
    background: var(--cs-gray-100);
    color: var(--cs-gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    transition: var(--cs-transition-fast);
}

.cs-chapter-toggle.open .cs-chapter-num {
    background: var(--cs-primary);
    color: var(--cs-white);
}

.cs-chapter-detail {
    flex: 1;
    min-width: 0;
}

.cs-chapter-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cs-dark);
    line-height: 1.3;
}

.cs-chapter-count {
    font-size: 0.7rem;
    color: var(--cs-gray-400);
    font-weight: 600;
    margin-top: 0.1rem;
}

.cs-chapter-chevron {
    color: var(--cs-gray-400);
    font-size: 0.85rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.cs-chapter-toggle.open .cs-chapter-chevron {
    transform: rotate(180deg);
    color: var(--cs-primary);
}

/* ==========================
   CONTENT LIST
   ========================== */
.cs-content-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.cs-content-list.open {
    max-height: 5000px;
}

.cs-content-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.625rem 1.25rem 0.625rem 1.5rem;
    cursor: pointer;
    transition: var(--cs-transition-fast);
    position: relative;
    border-left: 3px solid transparent;
}

.cs-content-item:hover:not(.locked) {
    background: var(--cs-primary-ultra-light);
    border-left-color: var(--cs-primary-light);
}

.cs-content-item.active {
    background: rgba(79, 70, 229, 0.06);
    border-left-color: var(--cs-primary);
}

.cs-content-item.active .cs-content-title {
    color: var(--cs-primary);
    font-weight: 700;
}

.cs-content-item.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Completion Check */
.cs-content-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--cs-gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.6rem;
    background: var(--cs-white);
    transition: var(--cs-transition-fast);
}

.cs-content-item.completed .cs-content-check {
    background: var(--cs-success);
    border-color: var(--cs-success);
    color: var(--cs-white);
}

/* Content Type Icon */
.cs-content-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
    color: var(--cs-white);
}

.cs-content-icon.video   { background: #ef4444; }
.cs-content-icon.audio   { background: #8b5cf6; }
.cs-content-icon.pdf     { background: #f59e0b; }
.cs-content-icon.document { background: #3b82f6; }
.cs-content-icon.text    { background: #10b981; }
.cs-content-icon.quiz    { background: #7c3aed; }

/* Content Info in sidebar */
.cs-content-item .cs-content-info {
    flex: 1;
    min-width: 0;
    border: none;
    box-shadow: none;
    background: transparent;
    border-radius: 0;
    margin: 0;
    overflow: visible;
}

.cs-content-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cs-gray-700);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cs-content-duration {
    font-size: 0.7rem;
    color: var(--cs-gray-400);
    font-weight: 600;
    background: var(--cs-gray-100);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ==========================
   SUB-CHAPTERS — arborescence à profondeur illimitée
   Chaque niveau imbriqué (sous-chapitre, sous-sous-chapitre, ...) est
   rattaché visuellement à son parent par un guide vertical + une
   indentation cumulative, et s'affiche avec un poids typographique
   légèrement plus discret que le niveau au-dessus.
   ========================== */
.cs-sub-chapter {
    border-top: 1px solid var(--cs-gray-100);
}

.cs-sub-chapter:first-child {
    border-top: none;
}

.cs-sub-chapter-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.7rem 1.25rem;
    background: var(--cs-gray-50);
    border: none;
    cursor: pointer;
    text-align: left;
    transition: var(--cs-transition-fast);
}

.cs-sub-chapter-toggle:hover {
    background: var(--cs-gray-100);
}

.cs-sub-chapter-toggle.open {
    background: rgba(79, 70, 229, 0.05);
}

.cs-sub-chapter-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--cs-gray-200);
    color: var(--cs-gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: var(--cs-transition-fast);
}

.cs-sub-chapter-toggle.open .cs-sub-chapter-icon {
    background: var(--cs-primary-ultra-light);
    color: var(--cs-primary);
}

.cs-sub-chapter-detail {
    flex: 1;
    min-width: 0;
}

.cs-sub-chapter-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--cs-dark);
}

.cs-sub-chapter-count {
    font-size: 0.7rem;
    color: var(--cs-gray-400);
    margin-top: 0.1rem;
    font-weight: 600;
}

.cs-sub-chapter-chevron {
    color: var(--cs-gray-400);
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.cs-sub-chapter-toggle.open .cs-sub-chapter-chevron {
    transform: rotate(180deg);
    color: var(--cs-primary);
}

/* Conteneur des enfants d'un sous-chapitre : contenus directs + niveaux
   plus profonds. Le retrait + la ligne de gauche matérialisent le
   rattachement au parent et s'accumulent naturellement à chaque niveau
   d'imbrication, sans limite de profondeur. */
.cs-sub-content-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    margin-left: 1.5rem;
    padding-left: 0.5rem;
    border-left: 2px solid var(--cs-gray-200);
    background: var(--cs-white);
}

.cs-sub-content-list.open {
    max-height: 4000px;
}

/* À partir du 2ème niveau imbriqué (sous-sous-chapitre et au-delà),
   le libellé est un cran plus discret que son parent direct. */
.cs-sub-content-list .cs-sub-chapter-toggle {
    background: transparent;
    padding-left: 0.75rem;
}

.cs-sub-content-list .cs-sub-chapter-toggle:hover {
    background: var(--cs-gray-50);
}

.cs-sub-content-list .cs-sub-chapter-name {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--cs-gray-700);
}

.cs-sub-content-list .cs-sub-chapter-icon {
    width: 20px;
    height: 20px;
    font-size: 0.65rem;
}

.cs-content-item.sub-content {
    padding-left: 1.25rem;
    background: var(--cs-white);
}

.cs-content-item.sub-content:hover:not(.locked) {
    background: var(--cs-primary-ultra-light);
}

/* ==========================
   NOTIFICATIONS
   ========================== */
.cs-notification {
    position: fixed;
    top: 80px;
    right: 1.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--cs-radius-sm);
    box-shadow: var(--cs-shadow-lg);
    z-index: 10000;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--cs-white);
    animation: csSlideIn 0.35s ease;
    max-width: 400px;
}

.cs-notification.success { background: var(--cs-success); }
.cs-notification.warning { background: var(--cs-warning); color: #1f2937; }
.cs-notification.error   { background: var(--cs-danger); }
.cs-notification.info    { background: var(--cs-primary); }

/* ==========================
   LOADING
   ========================== */
.cs-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 2rem;
    color: var(--cs-gray-400);
}

.cs-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--cs-gray-200);
    border-top-color: var(--cs-primary);
    border-radius: 50%;
    animation: csSpin 0.7s linear infinite;
    margin-bottom: 1rem;
}

/* ==========================
   ANIMATIONS
   ========================== */
@keyframes csSpin {
    to { transform: rotate(360deg); }
}

@keyframes csSlideIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes csSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}

@keyframes csHighlight {
    0%   { background-color: rgba(79, 70, 229, 0.08); }
    100% { background-color: transparent; }
}

.cs-content-body-text.cs-highlight {
    animation: csHighlight 1.5s ease-out;
}

/* ==========================
   RESPONSIVE
   ========================== */
@media (max-width: 1200px) {
    .cs-layout {
        grid-template-columns: 1fr 340px;
    }
}

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

    .cs-sidebar {
        position: relative;
        top: 0;
        max-height: none;
        order: -1;
        overflow: visible;
    }
}

@media (max-width: 768px) {
    .cs-topbar-inner {
        padding: 0 0.75rem;
    }

    .cs-topbar-title h1 {
        font-size: 0.9rem;
    }

    .cs-layout {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .cs-player-inner {
        min-height: 200px;
    }

    .cs-nav-buttons {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
    }

    .cs-nav-btn {
        max-width: none;
        flex: 1;
    }

    .cs-complete-btn {
        width: 100%;
        justify-content: center;
        order: -1;
    }

    .cs-content-info-header {
        padding: 1rem;
    }

    .cs-content-body-text {
        padding: 1rem;
    }

    .cs-card-body {
        padding: 1rem;
    }

    .cs-course-details {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .cs-topbar-title .cs-subject {
        display: none;
    }

    .cs-course-details {
        grid-template-columns: 1fr;
    }

    .cs-nav-btn-title {
        max-width: 100px;
    }

    .cs-detail-item {
        padding: 0.5rem;
    }
}
