@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Color Palette */
    --navy-900: #0f172a;
    --navy-800: #1e293b;
    --navy-700: #334155;
    --navy-100: #f1f5f9;
    
    --primary: #4f46e5;       /* Indigo 600 - Main Brand Color */
    --primary-hover: #4338ca; /* Indigo 700 */
    --accent: #a47e86;        /* Rose 500 */
    --success: #10b981;       /* Emerald 500 */
    --warning: #f59e0b;       /* Amber 500 */
    
    --text-main: #0f172a;     /* Slate 900 */
    --text-muted: #64748b;    /* Slate 500 */
    --text-light: #94a3b8;    /* Slate 400 */
    --white: #ffffff;

    --bg-body: #f8fafc;       /* Slate 50 */
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;

    /* Borders & Shadows */
    --border-color: #e2e8f0;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;

    /* Layout */
    --sidebar-width: 280px;
}


*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Re-enable selection for inputs so forms remain usable */
input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.75; /* Increased line-height for easier reading */
    font-size: 17px;   /* Slightly larger base font size */
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    margin-bottom: 1.2rem;
    color: var(--navy-900);
    letter-spacing: -0.02em; /* Tighten titles slightly for modern look */
}

h1 { font-size: 2.25rem; font-weight: 800; }
h2 { font-size: 1.875rem; font-weight: 700; margin-top: 2.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-color); }
h3 { font-size: 1.5rem; font-weight: 600; margin-top: 2rem; color: var(--primary); }
h4 { font-size: 1.25rem; font-weight: 600; margin-top: 1.5rem; }
h5 { font-size: 1.1rem; font-weight: 600; margin-top: 1.25rem; }

p { margin-bottom: 1.5rem; color: var(--navy-700); max-width: 75ch; /* Optimal reading width */ }

a { color: var(--primary); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 2px; transition: all 0.2s; }
a:hover { color: var(--primary-hover); text-decoration-color: transparent; }

img { max-width: 100%; height: auto; display: block; border-radius: var(--radius-md); box-shadow: var(--shadow-md); margin: 24px 0; }


.layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    padding-top: 0;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 50;
    padding: 0; 
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
}

.sidebar__brand {
    padding: 24px;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.2);
}

.brand__dot {
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--primary);
}

.sidebar__nav {
    padding: 24px;
}

.sidebar__title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    margin-bottom: 16px;
    font-weight: 600;
}

.sidebar__list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar__link {
    display: block;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar__link:hover,
.sidebar__link.is-active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    transform: translateX(4px);
}

.sidebar__link.is-active {
    background: var(--primary);
    color: var(--white);
}

.sidebar__status {
	margin-top: 24px;
	background: rgba(255, 255, 255, 0.05); /* Softer bg */
	padding: 16px;
	border-radius: 14px;
	display: grid;
	gap: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}

.status__badge {
	font-size: 0.85rem;
	color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status__progress {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 1.1rem;
	font-weight: 600;
    color: var(--white);
}

/* Main Content Area */
.content {
    flex: 1;
    margin-left: 0; /* Default for mobile/hidden sidebar */
    padding: 24px 20px;
    width: 100%;
    max-width: 100%;
    transition: margin-left 0.3s ease;
}

/* -------------------------------------------------------------------------- */
/*                            4. UI COMPONENTS                                */
/* -------------------------------------------------------------------------- */

/* Progress Bar */
.progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: transparent;
    z-index: 100;
}

.progress__bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.4s ease;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    gap: 16px;
}

.topbar__info {
    flex-grow: 1;
}

.topbar__label {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
}

.topbar__title {
    font-size: 1.25rem;
    margin: 0;
    color: var(--navy-900);
}

/* Burger Menu */
.burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    gap: 5px;
    padding: 0;
}

.burger span {
    width: 20px;
    height: 2px;
    background: var(--navy-800);
    border-radius: 2px;
    transition: all 0.3s;
}

/* Cards */
.card, .lesson-card, .welcome, .module {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03); /* Subtle shadow */
    padding: 32px; /* More breathing room */
    margin-bottom: 32px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card:hover, .lesson-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    transform: translateY(-2px);
    border-color: var(--primary); /* Highlight on hover */
}

/* Lesson Content specific layout */
.lesson-card__content {
    max-width: 800px;
    margin: 0 auto; /* Center content for better reading experience */
}

/* Buttons */
.cta, .complete-btn, .codepen-btn, button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--navy-900);
    color: var(--white);
    border: 1px solid transparent;
    padding: 12px 24px; /* More padding */
    border-radius: 99px; /* Pill shape */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08); /* Better shadow */
    text-decoration: none;
    line-height: 1.4;
    letter-spacing: 0.025em;
}

.cta:hover, .complete-btn:hover, .codepen-btn:hover, button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
    background: var(--primary);
    color: var(--white);
}

.cta:active, .complete-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.cta:disabled, button[disabled] {
    background: var(--navy-100);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border-color: var(--border-color);
}

/* Secondary/Outline Button Style (if needed later) */
.cta.secondary {
    background: transparent;
    border: 2px solid var(--navy-900);
    color: var(--navy-900);
}
.cta.secondary:hover {
    background: var(--navy-900);
    color: var(--white);
}

/* Navigation Buttons Container */
.module__actions, .welcome__actions {
    display: flex;
    gap: 20px; 
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px dashed var(--border-color);
    flex-wrap: wrap;
    justify-content: center; /* Center actions */
}

.welcome__actions .cta {
    flex: 0 1 auto; 
    min-width: 200px;
}

/* Enhanced Lists */
ul, ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    max-width: 70ch;
}

li {
    margin-bottom: 0.5rem;
    position: relative;
}

ul { list-style: none; }
ul li::before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

/* Code Blocks & Syntax Highlighting Overrides (for PrismJS) */
pre[class*="language-"], 
pre {
    background: #0f172a !important; /* Force darker background */
    color: #e2e8f0;
    padding: 24px !important;
    border-radius: var(--radius-md) !important;
    overflow-x: auto;
    font-family: 'JetBrains Mono', Consolas, Monaco, monospace !important;
    font-size: 0.95rem;
    margin: 32px 0 !important;
    border: 1px solid #1e293b;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2) !important;
    position: relative;
    line-height: 1.6 !important;
}

code[class*="language-"], 
code {
    font-family: 'JetBrains Mono', monospace !important;
    text-shadow: none !important;
}

/* Enhance PrismJS tokens for better contrast */
.token.comment, 
.token.prolog, 
.token.doctype, 
.token.cdata {
    color: #6a9955 !important;
}

.token.punctuation {
    color: #d4d4d4 !important;
}

.token.property, 
.token.tag, 
.token.boolean, 
.token.number, 
.token.constant, 
.token.symbol, 
.token.deleted {
    color: #b5cea8 !important;
}

.token.selector, 
.token.attr-name, 
.token.string, 
.token.char, 
.token.builtin, 
.token.inserted {
    color: #ce9178 !important;
}

.token.operator, 
.token.entity, 
.token.url, 
.language-css .token.string, 
.style .token.string {
    color: #d4d4d4 !important;
}

.token.atrule, 
.token.attr-value, 
.token.keyword {
    color: #569cd6 !important;
}
.token.function, 
.token.class-name {
    color: #dcdcaa !important;
}
.token.regex, 
.token.important, 
.token.variable {
    color: #d16969 !important;
}

/* Inline Code (not block) */
p > code, li > code {
    background: #f1f5f9;
    color: var(--primary); 
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
    font-weight: 500;
}

/* Console Output Simulation */
.console-output {
    background: #1e1e1e !important; /* VS Code Terminal Dark */
    color: #ececec !important;      /* Brighter text */
    padding: 24px !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid #333 !important;
    border-left: 5px solid #3b8eea !important; /* VS Code Blue for accent */
    font-family: 'JetBrains Mono', Consolas, monospace !important;
    margin: 28px 0 !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    font-size: 0.95rem;
    line-height: 1.6;
}

.console-output div:first-child {
    color: #6a9955 !important; /* Comment green */
    font-style: normal;
    font-weight: bold;
    margin-bottom: 12px;
    font-size: 0.9em;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.console-output div:first-child::before {
    content: "➜";
    color: #3b8eea;
}

.console-output div:not(:first-child) {
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    padding: 6px 0;
    color: #9cdcfe; /* Light Blue for output values */
}


/* Lists formatting in lessons */
/* Lesson content lists */
.lesson-card__content ul li, 
.lesson-card__content ol li {
    margin-bottom: 8px;
}

.lesson-card__content ul li::marker {
    color: var(--primary);
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 24px 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    font-size: 0.9rem;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--navy-100);
    font-weight: 600;
    color: var(--navy-800);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

/* Quiz Styles */
.quiz__item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 32px;
    background: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
}

.quiz__item:hover {
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05);
}

.quiz__item legend {
    font-weight: 700;
    font-size: 1.125rem;
    margin-bottom: 24px;
    color: var(--navy-900);
    line-height: 1.5;
    border-bottom: 2px solid var(--navy-100);
    padding-bottom: 12px;
    display: block;
    width: 100%;
}

.quiz__item label {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    padding: 16px;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    background: var(--bg-body);
    border: 1px solid transparent; /* Prepare for hover border */
    font-size: 1rem;
}

.quiz__item label:hover {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transform: translateX(4px);
}

.quiz__item input[type="radio"] {
    accent-color: var(--primary);
    width: 20px;
    height: 20px;
}

.quiz__explanation {
    margin-top: 16px;
    padding: 16px;
    background: #eff6ff;
    border-left: 4px solid var(--primary);
    border-radius: 4px;
    color: var(--navy-800);
    display: none; /* Hidden by default */
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Quiz Status specific overrides */
.quiz__explanation.is-error {
	background: #fff1f2;
	border-left-color: #e11d48;
	color: #be123c;
}

.quiz__explanation.is-correct {
	background: #f0fdf4;
	border-left-color: var(--success);
	color: var(--success);
}


.is-hidden {
    display: none !important;
}

/* -------------------------------------------------------------------------- */
/*                           6. RESPONSIVE DESIGN                             */
/* -------------------------------------------------------------------------- */

/* Large Screens (Desktop First in mind, adapting down) */
@media (min-width: 1025px) {
    .layout {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(0); /* Always show sidebar by default */
        position: fixed;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .sidebar.is-hidden {
        transform: translateX(-100%);
    }
    
    .content {
        margin-left: var(--sidebar-width);
        padding: 40px;
        max-width: 1400px; 
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .content.is-full {
        margin-left: 0;
    }
    
    /* Show burger on desktop too now */
    .burger {
        display: flex; 
    }
    
    .topbar {
        padding: 24px 32px;
    }
    
    .overlay {
        display: none !important;
    }
}

/* Tablet (Portrait) and Mobile */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%); /* Hidden by default */
    }
    
    .sidebar.is-open {
        transform: translateX(0); /* Slide in */
        box-shadow: 0 0 50px rgba(0,0,0,0.5);
    }
    
    .content {
        margin-left: 0;
        width: 100%;
    }
    
    .overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 45;
        backdrop-filter: blur(2px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }

    .overlay.is-active {
        opacity: 1;
        visibility: visible;
    }
}

/* Mobile specific tweaks */
@media (max-width: 600px) {
    :root {
        --sidebar-width: 260px; /* Slightly smaller sidebar */
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.2rem; }
    
    .topbar {
        flex-direction: row; /* Keep row */
        padding: 12px 16px;
        margin-bottom: 24px;
    }
    
    .topbar__title {
        font-size: 1rem;
        line-height: 1.3;
    }
    
    .content {
        padding: 16px;
    }
    
    .card, .lesson-card, .module {
        padding: 20px;
        border-radius: 12px;
    }
    
    .module__actions {
        flex-direction: column;
        width: 100%;
    }
    
    .cta, .complete-btn, button {
        width: 100%;
    }
    
    pre {
        font-size: 0.8rem; /* Smaller code font */
        padding: 12px;
    }
    
    .console-output {
        font-size: 0.8rem;
    }
}

.lesson-card .cta[data-target^='module-'] {
    display: none !important; /* Hide duplicate buttons from old code */
}
.lesson-card .module__actions {
    display: none !important; /* Hide duplicate actions */
}

/* Floating contact button */
.contact-float {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    text-decoration: none;
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 60;
}

.contact-float:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 15px 30px rgba(79, 70, 229, 0.5);
}

/* Footer structure */
.main-footer {
	text-align: center;
	padding: 40px 20px;
	color: var(--text-light);
	font-size: 0.85rem;
	border-top: 1px solid var(--border-color);
	margin-top: 48px;
	display: flex;
	flex-direction: column;
    align-items: center; /* Ensures flex children are centered */
    justify-content: center;
	gap: 8px;
}

/* === Locked Module Overlay === */
.module {
    position: relative; /* Ensure overlay positions relative to module container */
}

.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95); /* Slight transparency */
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    backdrop-filter: blur(4px); /* Nice blur effect */
    border-radius: inherit; /* Match parent border radius */
}

.lock-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: lock-bounce 2s infinite;
}

.lock-message {
    font-size: 1.25rem;
    color: var(--navy-800);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.lock-timer {
    font-family: var(--font-mono);
    font-size: 2rem;
    color: var(--primary);
    background: var(--navy-100);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    box-shadow: var(--shadow-sm);
}

@keyframes lock-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* === Sidebar Locked State === */
.sidebar__link.is-locked {
    color: var(--text-light); /* Gray out text */
    cursor: not-allowed;
    opacity: 0.7;
}

.sidebar__link.is-locked:hover {
    background-color: transparent;
    color: var(--text-light);
}

.sidebar__lock {
    margin-left: auto;
    font-size: 0.9em;
}

