:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-hover: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --nav-bg: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] {
    --primary: #34d399;
    --primary-dark: #10b981;
    --bg: #0f172a;
    --surface: #1e293b;
    --text-main: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-hover: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --nav-bg: rgba(15, 23, 42, 0.8);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    margin: 0;
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--nav-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s;
    color: var(--text-main);
}

#theme-toggle:hover {
    background-color: var(--border);
}

header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 6rem 0 4rem;
    margin-bottom: 3rem;
    text-align: center;
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.025em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header p {
    font-size: 1.25rem;
    opacity: 0.9;
    margin: 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 4rem 0 1.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 24px;
    background-color: var(--primary);
    margin-right: 12px;
    border-radius: 3px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.lesson-card {
    background-color: var(--surface);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
}

.lesson-card:nth-child(1) { animation-delay: 0.1s; }
.lesson-card:nth-child(2) { animation-delay: 0.2s; }
.lesson-card:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.lesson-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.lesson-card h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-main);
}

.badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.new {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.lesson-card p {
    margin: 0 0 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.btn {
    display: inline-block;
    background-color: var(--bg);
    color: var(--primary);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

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

.empty-state {
    grid-column: 1 / -1;
    padding: 3rem;
    text-align: center;
    background-color: var(--surface);
    border-radius: 12px;
    border: 2px dashed var(--border);
    color: var(--text-secondary);
}

footer {
    text-align: center;
    padding: 3rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border);
}

/* Lesson Page Styles */
.lesson-container {
    max-width: 1400px; /* Wider container for lesson pages */
    padding-top: 2rem;
    padding-bottom: 4rem;
}

.lesson-header, .description {
    max-width: 800px; /* Keep text readable */
    margin-left: auto;
    margin-right: auto;
}

.lesson-header {
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 2rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary);
}

.lesson-header h1 {
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    color: var(--text-main);
}

.lesson-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin: 0 0 1.5rem 0;
}

.lesson-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.description {
    margin-bottom: 3rem;
    line-height: 1.7;
}

.description h2, .exercises h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.exercises h2, .exercises p {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Code Browser */
.code-browser {
    display: grid;
    grid-template-columns: 300px 1fr; /* Slightly wider file list */
    gap: 0; /* Remove gap, use border instead */
    margin-top: 1.5rem;
    height: 75vh; /* Use viewport height */
    min-height: 600px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--surface);
    box-shadow: var(--shadow);
}

.file-list {
    background-color: var(--bg);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 0; /* Remove padding for full-width buttons */
    display: flex;
    flex-direction: column;
    gap: 1px; /* Small gap for separator effect */
}

.file-btn {
    text-align: left;
    background: none;
    border: none;
    padding: 1rem 1.5rem; /* Larger touch target */
    border-radius: 0; /* Remove radius */
    cursor: pointer;
    color: var(--text-secondary);
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 3px solid transparent; /* Indicator */
}

.file-btn:hover {
    background-color: rgba(99, 102, 241, 0.05);
    color: var(--primary);
}

.file-btn.active {
    background-color: var(--surface);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.code-viewer {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #2d2d2d; /* Match Prism Tomorrow theme bg */
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: #1e1e1e;
    border-bottom: 1px solid #333;
    color: #e0e0e0;
}

#current-filename {
    font-family: monospace;
    font-weight: 600;
}

.copy-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.code-viewer pre {
    margin: 0 !important;
    height: 100%;
    overflow: auto !important;
    border-radius: 0 !important;
    padding: 1.5rem !important;
}

@media (max-width: 640px) {
    header {
        padding: 4rem 0 3rem;
        clip-path: none;
    }
    
    header h1 {
        font-size: 2rem;
    }

    .nav-links {
        display: none; /* Simple mobile hide for now, or could be a hamburger */
    }
    
    /* Show theme toggle on mobile */
    .nav-content {
        position: relative;
    }
    
    #theme-toggle {
        display: block;
        position: absolute;
        right: 0;
    }
}

@media (max-width: 768px) {
    .code-browser {
        grid-template-columns: 1fr;
        height: auto;
        max-height: 800px;
    }

    .file-list {
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    
    .code-viewer {
        height: 400px;
    }
}
