:root {
    --primary: #3498db;
    --secondary: #2c3e50;
    --accent: #e74c3c;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --success: #2ecc71;
    --warning: #f39c12;
    --code-bg: #1e1e1e;
    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    display: flex;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
    background: white;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 2rem;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 700;
}

.user-controls {
    display: flex;
    gap: 15px;
}

.btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--accent);
}

.btn-primary:hover {
    background: #c0392b;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: var(--secondary);
    color: white;
    height: 100%;
    overflow-y: auto;
    transition: all 0.3s;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.progress-container {
    margin-top: 1rem;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    width: 20%;
    transition: width 0.5s;
}

.progress-text {
    font-size: 0.8rem;
    margin-top: 5px;
    text-align: center;
    opacity: 0.8;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-title {
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-links {
    list-style: none;
}

.nav-item {
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 4px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    border-left: 4px solid var(--primary);
}

.nav-icon {
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: #f9f9f9;
}

.lesson-section {
    display: none;
    animation: fadeIn 0.5s ease;
    max-width: 900px;
    margin: 0 auto;
}

.lesson-section.active {
    display: block;
}

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

.level-badge {
    display: inline-block;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.beginner {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.intermediate {
    background-color: #e3f2fd;
    color: #1565c0;
}

.advanced {
    background-color: #fce4ec;
    color: #c2185b;
}

h1 {
    color: var(--secondary);
    margin-bottom: 1rem;
    font-size: 2.2rem;
}

h2 {
    color: var(--primary);
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

h3 {
    color: var(--secondary);
    margin: 1.5rem 0 0.8rem;
}

p {
    margin-bottom: 1.2rem;
    line-height: 1.7;
}

ul, ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Code Editor Styles */
.code-editor-container {
    background: var(--code-bg);
    border-radius: 8px;
    margin: 1.5rem 0;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.editor-header {
    background: #2d2d2d;
    padding: 0.75rem 1rem;
    color: #ccc;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
}

.editor-actions {
    display: flex;
    gap: 10px;
}

.editor-btn {
    background: #444;
    border: none;
    color: #ccc;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s;
}

.editor-btn:hover {
    background: #555;
}

.editor-btn.run {
    background: var(--success);
    color: white;
}

.editor-btn.run:hover {
    background: #27ae60;
}

.code-editor {
    width: 100%;
    height: 250px;
    background: #1e1e1e;
    color: #d4d4d4;
    border: none;
    padding: 1rem;
    font-family: 'Consolas', 'Monaco', monospace;
    resize: vertical;
    line-height: 1.5;
    font-size: 14px;
    tab-size: 4;
}

/* Output Styles */
.output-container {
    background: white;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    min-height: 150px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

/* Exercise Styles */
.exercise {
    background: #f8f9fa;
    border-left: 4px solid var(--primary);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.exercise h3 {
    margin-top: 0;
    color: var(--primary);
}

.note {
    background: #fffde7;
    border-left: 4px solid #ffd600;
    padding: 1.2rem;
    margin: 1.5rem 0;
    border-radius: 0 5px 5px 0;
}

.tip {
    background: #e8f5e9;
    border-left: 4px solid var(--success);
    padding: 1.2rem;
    margin: 1.5rem 0;
    border-radius: 0 5px 5px 0;
}

.warning {
    background: #ffebee;
    border-left: 4px solid var(--accent);
    padding: 1.2rem;
    margin: 1.5rem 0;
    border-radius: 0 5px 5px 0;
}

/* Quiz Styles */
.quiz-container {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.quiz-question {
    margin-bottom: 1.5rem;
}

.quiz-options {
    list-style: none;
    padding-left: 0;
}

.quiz-option {
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    background: #f5f5f5;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.quiz-option:hover {
    background: #e9e9e9;
}

.quiz-option.selected {
    background: #e1f5fe;
    border: 1px solid var(--primary);
}

.quiz-option.correct {
    background: #e8f5e9;
    border: 1px solid var(--success);
}

.quiz-option.incorrect {
    background: #ffebee;
    border: 1px solid var(--accent);
}

.quiz-result {
    text-align: center;
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 5px;
    font-weight: bold;
}

.quiz-result.correct {
    background: #e8f5e9;
    color: var(--success);
}

.quiz-result.incorrect {
    background: #ffebee;
    color: var(--accent);
}

/* Project Gallery */
.project-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.project-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.project-card:hover {
    transform: translateY(-5px);
}

.project-image {
    height: 150px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

.project-content {
    padding: 1rem;
}

.project-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.project-desc {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.project-btn {
    display: block;
    text-align: center;
    background: var(--primary);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.3s;
}

.project-btn:hover {
    background: #2980b9;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    background: var(--secondary);
    color: white;
    margin-top: 2rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .project-gallery {
        grid-template-columns: 1fr;
    }
}

/* Dark Theme */
.dark-theme {
    background: #1a1a1a;
    color: #e0e0e0;
}

.dark-theme .app-container {
    background: #2d2d2d;
}

.dark-theme .content-area {
    background: #2d2d2d;
    color: #e0e0e0;
}

.dark-theme .exercise,
.dark-theme .note,
.dark-theme .tip,
.dark-theme .warning,
.dark-theme .quiz-container,
.dark-theme .output-container,
.dark-theme .project-card {
    background: #3d3d3d;
    color: #e0e0e0;
}

.dark-theme h1,
.dark-theme h2,
.dark-theme h3 {
    color: #ffffff;
}

.dark-theme .project-desc {
    color: #b0b0b0;
}