/* --- THEME VARIABLES (Dark & Light Mode) --- */
:root[data-theme="dark"] {
    --bg-main: #000000;
    --bg-card: #0a0a0a;
    --bg-sidebar: #050505;
    --text-main: #ffffff;
    --text-muted: #cccccc;
    --border-color: #330000;
    --neon-red: #ff3333;
    --btn-hover: #d21010;
    --code-bg: #111111;
    --locked-bg: #0a0a0a;
    --locked-text: #555555;
    --shadow-neon: rgba(255, 51, 51, 0.3);
}

:root[data-theme="light"] {
    --bg-main: #f4f6f8;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --text-main: #111111;
    --text-muted: #444444;
    --border-color: #e0e0e0;
    --neon-red: #e60000; /* ටිකක් තද රතු Light mode එකට */
    --btn-hover: #cc0000;
    --code-bg: #2d2d2d;
    --locked-bg: #eeeeee;
    --locked-text: #999999;
    --shadow-neon: rgba(230, 0, 0, 0.2);
}

/* Allow text selection only in lessons */
.allow-select {
    user-select: text !important;
    -webkit-user-select: text !important;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    transition: background-color 0.4s, color 0.4s;
}

/* Theme Toggle Button */
.theme-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 20px;
    transition: 0.3s;
}
.theme-btn:hover { color: var(--neon-red); }

/* Course Layout */
.course-layout {
    display: absolute;
    margin-top: 80px;
    min-height: calc(100vh - 80px);
}

/* Sidebar ekai content ekai dekkama thiyena container eka */
.course-layout {
    display: flex; /* 'absolute' venuvata 'flex' danna */
    margin-top: 80px;
    min-height: calc(100vh - 80px);
}

.course-sidebar {
    width: 320px;
    background: var(--bg-sidebar);
    border-right: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    
    /* Position eka sticky karanna, ethakota scroll karaddi nathi venne ne */
    position: sticky; 
    top: 80px; 
    
    /* Meka thibunoth thama content eka uda yanne naththe */
    flex-shrink: 0; 
}

/* Content eka thiyena div ekata meka danna */
.course-content {
    flex-grow: 1;
    padding: 20px;
}

.sidebar-header h3 { color: var(--neon-red); margin-bottom: 10px; }

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--neon-red);
    width: 0%;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px var(--shadow-neon);
}

#lesson-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}
/* Scrollbar styling */
#lesson-list::-webkit-scrollbar { width: 6px; }
#lesson-list::-webkit-scrollbar-thumb { background: var(--neon-red); border-radius: 10px; }

.sidebar-lesson-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
}

.sidebar-lesson-btn:hover:not(.locked) {
    border-color: var(--neon-red);
    transform: translateX(5px);
}

.sidebar-lesson-btn.active {
    background: rgba(255, 51, 51, 0.1);
    border-left: 4px solid var(--neon-red);
    box-shadow: 0 0 10px var(--shadow-neon);
}

.sidebar-lesson-btn.locked {
    background: var(--locked-bg);
    color: var(--locked-text);
    cursor: not-allowed;
    border-color: transparent;
}

.course-content {
    flex: 1;
    padding: 40px 5%;
    max-width: 1100px;
}

.lesson-title {
    color: var(--neon-red);
    font-size: 2.5rem;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.lesson-desc {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* Syntax Highlighting Container overrides */
pre[class*="language-"] {
    border-radius: 10px;
    border-left: 4px solid var(--neon-red);
    background: var(--code-bg) !important;
    margin-bottom: 30px;
}

/* Live Editor Area */
.live-editor-container {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
}

.editor-split {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.editor-split textarea {
    flex: 1;
    height: 300px;
    background: #1e1e1e; /* Always dark for code */
    color: #d4d4d4;
    font-family: monospace;
    padding: 15px;
    border: 1px solid #555;
    border-radius: 8px;
    resize: vertical;
}
.editor-split iframe {
    flex: 1;
    height: 300px;
    background: #fff; /* Always white for HTML output */
    border: 2px solid #555;
    border-radius: 8px;
}

.action-btn {
    background: var(--neon-red);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    font-size: 1rem;
}
.action-btn:hover { background: var(--btn-hover); box-shadow: 0 0 15px var(--shadow-neon); }

.complete-btn-area {
    margin-top: 40px;
    text-align: right;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

/* Quiz Section */
.quiz-question {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
.quiz-option {
    display: block;
    background: var(--bg-sidebar);
    padding: 15px;
    margin-top: 10px;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: 0.3s;
}
.quiz-option:hover { border-color: var(--neon-red); }

@media (max-width: 900px) {
    .course-layout { flex-direction: column; }
    .course-sidebar { width: 100%; height: auto; max-height: 350px; }
    .editor-split { flex-direction: column; }
}

:root {
    --bg-color: #ffffff;
    --text-color: #000000;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #ffffff;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: 0.3s;
}

/* බොත්තමේ පෙනුම */
.theme-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 10px;
}
.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a1a1a;
    padding: 12px 15px;
    border-radius: 8px 8px 0 0;
    border: 1px solid #333;
    margin-top: 25px;
}

.copy-btn {
    background: #ff3333;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
}

.copy-btn:hover {
    background: #cc0000;
    transform: scale(1.05);
}

.code-wrapper pre {
    margin-top: 0 !important;
    border-top: none !important;
    border-radius: 0 0 8px 8px !important;
}
/* Prism Code Block Styles */
pre[class*="language-"] {
    background: #1a1a1a !important; /* කළු පසුබිම */
    margin: 0 !important;
    padding: 1.5em !important;
    overflow: auto;
    border-radius: 0 0 8px 8px !important;
    border-left: 5px solid var(--neon-red) !important;
}

code[class*="language-"] {
    font-family: 'Consolas', 'Monaco', 'Andale Mono', monospace !important;
    font-size: 0.95rem !important;
    text-shadow: none !important;
    color: #f8f8f2 !important; /* අකුරු වල සාමාන්‍ය වර්ණය */
}

/* Syntax Colors (Prism Overrides) */
.token.comment { color: #6272a4; }
.token.tag { color: #ff79c6; } /* HTML Tags */
.token.attr-name { color: #50fa7b; } /* Attributes */
.token.attr-value { color: #f1fa8c; } /* Values */
.token.selector { color: #ff3333; } /* CSS Selectors */
.token.property { color: #8be9fd; } /* CSS Properties */
.token.punctuation { color: #f8f8f2; }