/* ========================================
   LESSON PAGES CSS - Matching Home Page UI
   JavaCraft Modern Theme
   ======================================== */

:root {
    --primary: #ff6b35;
    --secondary: #f7931e;
    --accent: #00d9ff;
    --success: #00ff88;
    --warning: #fbbf24;
    --danger: #ef4444;

    --bg-primary: #050816;
    --bg-secondary: #0a0e27;
    --bg-tertiary: #1a1f3a;
    --text-primary: #f4f4f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --border-color: rgba(255, 107, 53, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(255, 107, 53, 0.2);
    --shadow-lg: 0 10px 25px rgba(255, 107, 53, 0.3);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.5);

    --gradient-primary: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    --gradient-accent: linear-gradient(135deg, #00d9ff 0%, #667eea 100%);

    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border-color: #cbd5e0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* ========================================
   BREADCRUMB
   ======================================== */
.breadcrumb-section {
    background: var(--bg-secondary);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb span:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

/* ========================================
   MOBILE COURSE HEADER
   ======================================== */
.mobile-course-header {
    display: none;
    background: rgba(26, 31, 58, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    padding: 0.875rem 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 1rem 0;
    align-items: center;
    gap: 1rem;
}

.mobile-menu-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.mobile-lesson-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mobile-lesson-number {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.mobile-lesson-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   COURSE LAYOUT
   ======================================== */
.course-layout {
    display: flex;
    min-height: calc(100vh - 200px);
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    gap: 2rem;
    align-items: flex-start;
}

/* ========================================
   MAIN LESSON CONTENT
   ======================================== */
.lesson-content {
    flex: 1;
    min-width: 0; /* prevents sidebar overlap */
}

/* ========================================
   SIDEBAR
   ======================================== */
.course-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: rgba(26, 31, 58, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    height: fit-content;
    position: sticky;
    top: 100px;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.course-sidebar:hover {
    box-shadow: var(--shadow-xl);
    border-color: rgba(255, 107, 53, 0.4);
}

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

.sidebar-header h2 {
    font-size: 0.9rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-close {
    display: none;
    background: rgba(255, 107, 53, 0.1);
    border: none;
    color: var(--primary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    transition: var(--transition);
    align-items: center;
    justify-content: center;
}

.sidebar-close:hover {
    background: rgba(255, 107, 53, 0.2);
}

/* ========================================
   PROGRESS BAR
   ======================================== */
.course-progress {
    background: rgba(255, 107, 53, 0.1);
    padding: 0.875rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 107, 53, 0.2);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.progress-text {
    color: var(--text-secondary);
}

.progress-percentage {
    color: var(--primary);
    font-size: 1rem;
    font-weight: 700;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 107, 53, 0.2);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 999px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.5);
}

.progress-stats {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

/* ========================================
   MODULE & LESSON NAVIGATION
   ======================================== */
.lessons-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.module {
    margin-bottom: 0.35rem;
}

.module-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.75rem;
    background: rgba(255, 107, 53, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.module-header:hover {
    background: rgba(255, 107, 53, 0.1);
    border-color: rgba(255, 107, 53, 0.3);
    transform: translateX(2px);
}

.module-header.active {
    background: rgba(255, 107, 53, 0.15);
    border-color: var(--primary);
}

.module-count {
    margin-left: auto;
    font-size: 0.65rem;
    color: var(--text-muted);
    background: rgba(255, 107, 53, 0.1);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

.module-lessons {
    display: none;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.35rem 0 0.35rem 0.75rem;
}

.module-lessons.active {
    display: flex;
}

.lesson-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(10, 14, 39, 0.5);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: var(--transition);
    position: relative;
    line-height: 1.3;
}

.lesson-item:hover {
    background: rgba(255, 107, 53, 0.1);
    border-color: rgba(255, 107, 53, 0.3);
    color: var(--text-primary);
    transform: translateX(4px);
}

.lesson-item.active {
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.lesson-item.completed {
    color: var(--success);
}

.lesson-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.lesson-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(255, 107, 53, 0.15);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.65rem;
    flex-shrink: 0;
}

.lesson-item.active .lesson-number {
    background: rgba(255, 255, 255, 0.2);
}

.lesson-item.completed .lesson-number {
    background: rgba(0, 255, 136, 0.2);
}

.lesson-title {
    flex: 1;
    font-size: 0.75rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-duration {
    font-size: 0.625rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.lesson-item.active .lesson-duration {
    color: rgba(255, 255, 255, 0.8);
}

/* ========================================
   COURSE SIDEBAR OVERLAY (separate from navbar overlay)
   ======================================== */
.course-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.course-sidebar-overlay.active {
    display: block;
}

/* ========================================
   LESSON HEADER
   ======================================== */
.lesson-header {
    background: rgba(26, 31, 58, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.lesson-badge {
    display: inline-block;
    background: var(--gradient-primary);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.lesson-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.lesson-description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.lesson-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.lesson-meta span {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(255, 107, 53, 0.08);
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 107, 53, 0.2);
}

/* ========================================
   CONTENT SECTIONS
   ======================================== */
.content-section {
    background: rgba(26, 31, 58, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.content-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.65rem;
    border-bottom: 2px solid rgba(255, 107, 53, 0.3);
}

.content-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--accent);
    margin: 1.5rem 0 0.875rem;
}

.content-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.25rem 0 0.65rem;
}

.content-section p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 0.875rem;
    font-size: 0.9375rem;
}

.content-section ul,
.content-section ol {
    margin: 0.875rem 0 0.875rem 1.5rem;
    color: var(--text-secondary);
}

.content-section li {
    margin-bottom: 0.4rem;
    line-height: 1.6;
    font-size: 0.9375rem;
}

.content-section strong {
    color: var(--text-primary);
    font-weight: 600;
}

.content-section code {
    background: none;
    color: #00d9ff;
    padding: 0 0.2rem;
    border-radius: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875em;
    font-weight: 500;
    border: none;
}

/* ========================================
   CODE BLOCKS
   ======================================== */
.code-block {
    background: linear-gradient(135deg, #1a1f2e 0%, #161b28 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    margin: 1.5rem 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    position: relative;
    backdrop-filter: none;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.code-language {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #00d9ff;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.7;
}

.code-copy {
    background: rgba(0, 217, 255, 0.1);
    color: #00d9ff;
    border: 1px solid rgba(0, 217, 255, 0.3);
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition);
    opacity: 0.8;
}

.code-copy:hover {
    background: rgba(0, 217, 255, 0.2);
    opacity: 1;
    transform: translateY(-1px);
}

.code-block pre {
    padding: 1.5rem;
    margin: 0;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    background: transparent;
}

.code-block code,
.code-block code *,
.code-block pre {
    background: none !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    filter: none !important;
    backdrop-filter: none !important;
}

.code-block code {
    color: #abb2bf !important;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    display: block;
}

/* Syntax Highlighting */
.code-block .keyword  { color: #c678dd; font-weight: 500; }
.code-block .type,
.code-block .class-name { color: #e5c07b; }
.code-block .string   { color: #98c379; }
.code-block .comment  { color: #5eead4; font-style: italic; }
.code-block .number   { color: #d19a66; }
.code-block .function,
.code-block .method   { color: #61afef; }
.code-block .operator { color: #56b6c2; }
.code-block .punctuation { color: #abb2bf; }
.code-block .variable { color: #e06c75; }

/* ========================================
   OUTPUT BOX
   ======================================== */
.output-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-left: 4px solid var(--success);
    border-radius: var(--border-radius);
    padding: 1.25rem 1.5rem;
    margin: 1rem 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
}

.output-box strong {
    color: var(--success);
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.output-box pre {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
    white-space: pre-wrap;
}

/* ========================================
   INFO BOXES
   ======================================== */
.info-box {
    background: rgba(0, 217, 255, 0.05);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-left: 4px solid var(--accent);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: 0 4px 16px rgba(0, 217, 255, 0.08);
}

.info-box p {
    margin-bottom: 0.65rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.info-box ul {
    margin-left: 1.5rem;
    color: var(--text-secondary);
}

.info-box li {
    margin-bottom: 0.4rem;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.highlight-box {
    background: rgba(255, 107, 53, 0.05);
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-left: 4px solid var(--primary);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.highlight-box p,
.highlight-box li {
    color: var(--text-secondary);
}

.highlight-box h3,
.highlight-box h4 {
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.exercise-box {
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-left: 4px solid var(--success);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.exercise-box h3 {
    color: var(--success);
    margin-bottom: 0.875rem;
}

/* ========================================
   TABLES
   ======================================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.5rem 0;
    border-radius: var(--border-radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(10, 14, 39, 0.5);
    border-radius: var(--border-radius);
    overflow: hidden;
    min-width: 400px;
}

thead tr {
    background: rgba(255, 107, 53, 0.1);
}

th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--primary);
    border: 1px solid var(--border-color);
    font-size: 0.875rem;
}

td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

tr:hover {
    background: rgba(255, 107, 53, 0.05);
}

td code {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    font-size: 0.85em;
}

/* ========================================
   QUIZ
   ======================================== */
.quiz-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.quiz-question {
    background: rgba(10, 14, 39, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.quiz-question p {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.quiz-question pre {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
    overflow-x: auto;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.quiz-options label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 107, 53, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.quiz-options label:hover {
    background: rgba(255, 107, 53, 0.1);
    border-color: rgba(255, 107, 53, 0.3);
    color: var(--text-primary);
}

.quiz-options input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.btn-check-answer {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-check-answer:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.4);
}

/* ========================================
   PRACTICE / DETAILS
   ======================================== */
details {
    background: rgba(10, 14, 39, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    margin-top: 1rem;
}

details summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.25rem 0;
    user-select: none;
    transition: var(--transition);
}

details summary:hover {
    color: var(--primary);
}

details[open] summary {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* ========================================
   LESSON NAVIGATION
   ======================================== */
.lesson-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
    gap: 1rem;
}

.nav-button {
    background: rgba(26, 31, 58, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: var(--transition);
    min-width: 140px;
}

.nav-button span {
    font-size: 1rem;
}

.nav-button small {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.nav-button:hover {
    background: var(--gradient-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.nav-button:hover small {
    color: rgba(255, 255, 255, 0.8);
}

.nav-button.prev {
    text-align: left;
}

.nav-button.next {
    text-align: right;
    margin-left: auto;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.lesson-header,
.content-section {
    animation: fadeInUp 0.4s ease both;
}

.content-section:nth-child(2) { animation-delay: 0.05s; }
.content-section:nth-child(3) { animation-delay: 0.1s; }
.content-section:nth-child(4) { animation-delay: 0.15s; }

/* ========================================
   RESPONSIVE — TABLET
   ======================================== */
@media (max-width: 1024px) {
    .course-layout {
        gap: 1.5rem;
    }

    .course-sidebar {
        width: 240px;
    }

    .lesson-header h1 {
        font-size: 1.75rem;
    }
}

/* ========================================
   RESPONSIVE — MOBILE
   ======================================== */
@media (max-width: 768px) {

    /* Show mobile header */
    .mobile-course-header {
        display: flex;
    }

    /* Layout stacks vertically */
    .course-layout {
        flex-direction: column;
        padding: 1rem;
        padding-top: 0.5rem;
    }

    /* Sidebar slides in from left */
    .course-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: 78%;
        max-width: 280px;
        height: 100vh;
        z-index: 1000;
        border-radius: 0 var(--border-radius) var(--border-radius) 0;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        padding-top: 1.5rem;
    }

    /* JS adds .active to open */
    .course-sidebar.active {
        left: 0;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar-close {
        display: flex;
    }

    /* Main content fills width */
    .lesson-content {
        width: 100%;
    }

    .lesson-header {
        padding: 1.5rem;
    }

    .lesson-header h1 {
        font-size: 1.5rem;
    }

    .content-section {
        padding: 1.5rem;
    }

    .lesson-navigation {
        flex-wrap: wrap;
    }

    .nav-button {
        flex: 1;
        min-width: 130px;
    }

    .lesson-meta {
        gap: 0.5rem;
    }

    .lesson-meta span {
        font-size: 0.75rem;
    }
}

/* ========================================
   RESPONSIVE — SMALL MOBILE
   ======================================== */
@media (max-width: 480px) {
    .lesson-header {
        padding: 1.25rem;
    }

    .lesson-header h1 {
        font-size: 1.375rem;
    }

    .content-section {
        padding: 1.25rem;
    }

    .content-section h2 {
        font-size: 1.25rem;
    }

    .code-block pre {
        font-size: 0.8rem;
        padding: 1rem;
    }

    .nav-button {
        min-width: 120px;
        padding: 0.875rem 1rem;
    }

    .quiz-options label {
        padding: 0.65rem 0.875rem;
        font-size: 0.85rem;
    }
}

/* ========================================
   LIGHT THEME OVERRIDES
   ======================================== */
[data-theme="light"] .course-sidebar {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #cbd5e0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sidebar-header {
    border-bottom: 1px solid #cbd5e0;
}

[data-theme="light"] .mobile-course-header {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #cbd5e0;
}

[data-theme="light"] .mobile-lesson-title {
    color: #0f172a;
}

[data-theme="light"] .course-progress {
    background: rgba(255, 107, 53, 0.08);
    border: 1px solid rgba(255, 107, 53, 0.25);
}

[data-theme="light"] .module-header {
    background: rgba(255, 107, 53, 0.08);
    color: #0f172a;
}

[data-theme="light"] .module-header:hover {
    background: rgba(255, 107, 53, 0.15);
}

[data-theme="light"] .module-header.active {
    background: rgba(255, 107, 53, 0.2);
}

[data-theme="light"] .lesson-item {
    background: rgba(248, 250, 252, 0.8);
    color: #334155;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .lesson-item:hover {
    background: rgba(255, 107, 53, 0.1);
    color: #0f172a;
    border-color: rgba(255, 107, 53, 0.3);
}

[data-theme="light"] .lesson-item.active {
    background: var(--gradient-primary);
    color: white;
}

[data-theme="light"] .lesson-item.completed {
    color: #059669;
}

[data-theme="light"] .lesson-number {
    background: rgba(255, 107, 53, 0.2);
    color: #c2410c;
}

[data-theme="light"] .lesson-item.active .lesson-number {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

[data-theme="light"] .lesson-header {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #cbd5e0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .content-section {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #cbd5e0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .content-section h2 {
    color: #c2410c;
    border-bottom: 2px solid rgba(255, 107, 53, 0.3);
}

[data-theme="light"] .content-section h3 {
    color: #0891b2;
}

[data-theme="light"] .content-section h4 {
    color: #0f172a;
}

[data-theme="light"] .content-section p,
[data-theme="light"] .content-section li {
    color: #334155;
}

[data-theme="light"] .content-section strong {
    color: #0f172a;
}

[data-theme="light"] .content-section code {
    color: #0e7490;
}

[data-theme="light"] .breadcrumb-section {
    background: #f8fafc;
    border-bottom: 1px solid #cbd5e0;
}

[data-theme="light"] .breadcrumb a {
    color: #64748b;
}

[data-theme="light"] .breadcrumb a:hover {
    color: #0891b2;
}

[data-theme="light"] .breadcrumb span:last-child {
    color: #0f172a;
}

[data-theme="light"] .code-block {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .code-header {
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .code-language {
    color: #0891b2;
}

[data-theme="light"] .code-copy {
    color: #0891b2;
    border-color: rgba(8, 145, 178, 0.3);
    background: rgba(8, 145, 178, 0.05);
}

[data-theme="light"] .code-copy:hover {
    background: rgba(8, 145, 178, 0.15);
}

[data-theme="light"] .code-block code {
    color: #24292f !important;
}

[data-theme="light"] .code-block .keyword  { color: #a626a4; }
[data-theme="light"] .code-block .type,
[data-theme="light"] .code-block .class-name { color: #c18401; }
[data-theme="light"] .code-block .string   { color: #50a14f; }
[data-theme="light"] .code-block .comment  { color: #0d9488; }
[data-theme="light"] .code-block .number   { color: #986801; }
[data-theme="light"] .code-block .function,
[data-theme="light"] .code-block .method   { color: #4078f2; }
[data-theme="light"] .code-block .operator { color: #0184bc; }
[data-theme="light"] .code-block .variable { color: #e45649; }

[data-theme="light"] .output-box {
    background: rgba(240, 253, 244, 0.8);
    border: 1px solid rgba(0, 200, 100, 0.2);
}

[data-theme="light"] .output-box pre {
    color: #334155;
}

[data-theme="light"] .info-box {
    background: rgba(0, 217, 255, 0.06);
    border: 1px solid rgba(0, 217, 255, 0.3);
}

[data-theme="light"] .info-box p,
[data-theme="light"] .info-box li {
    color: #334155;
}

[data-theme="light"] .highlight-box {
    background: rgba(255, 107, 53, 0.06);
    border: 1px solid rgba(255, 107, 53, 0.3);
}

[data-theme="light"] .highlight-box p,
[data-theme="light"] .highlight-box li {
    color: #334155;
}

[data-theme="light"] .quiz-question {
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid #cbd5e0;
}

[data-theme="light"] .quiz-question p {
    color: #0f172a;
}

[data-theme="light"] .quiz-question pre {
    background: rgba(0, 0, 0, 0.05);
    color: #334155;
}

[data-theme="light"] .quiz-options label {
    background: rgba(255, 107, 53, 0.05);
    color: #334155;
    border: 1px solid transparent;
}

[data-theme="light"] .quiz-options label:hover {
    background: rgba(255, 107, 53, 0.12);
    color: #0f172a;
}

[data-theme="light"] table {
    background: rgba(248, 250, 252, 0.9);
}

[data-theme="light"] thead tr {
    background: rgba(255, 107, 53, 0.1);
}

[data-theme="light"] th {
    color: #c2410c;
    border: 1px solid #cbd5e0;
}

[data-theme="light"] td {
    color: #334155;
    border: 1px solid #cbd5e0;
}

[data-theme="light"] td code {
    color: #0e7490;
}

[data-theme="light"] tr:hover {
    background: rgba(255, 107, 53, 0.04);
}

[data-theme="light"] .nav-button {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #cbd5e0;
    color: #0f172a;
}

[data-theme="light"] .nav-button small {
    color: #64748b;
}

[data-theme="light"] .nav-button:hover {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

[data-theme="light"] details {
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid #cbd5e0;
}

[data-theme="light"] details summary {
    color: #0891b2;
}

[data-theme="light"] details[open] summary {
    border-bottom: 1px solid #cbd5e0;
}