/* ===== CSS Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #f74c00; /* Rust orange */
    --secondary: #2e2e2e;
    --bg: #1a1a1a;
    --text: #e0e0e0;
    --border: #444;
    --success: #4caf50;
    --error: #f44336;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== Header ===== */
header {
    text-align: center;
    padding: 40px 20px;
    border-bottom: 2px solid var(--primary);
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    color: #888;
}

.ai-notice {
    margin-top: 10px;
    padding: 8px 16px;
    background: rgba(247, 76, 0, 0.1);
    border-left: 3px solid var(--primary);
    display: inline-block;
    font-size: 0.9rem;
}

/* ===== Navigation ===== */
.phases {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 12px 24px;
    background: var(--secondary);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.nav-btn:hover {
    border-color: var(--primary);
    background: #333;
}

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

/* ===== Main Content ===== */
.phase-content {
    padding: 30px 0;
}

.phase-content.hidden {
    display: none;
}

.phase-content h2 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 20px;
}

.phase-content p {
    font-size: 1.1rem;
    margin-bottom: 15px;
    line-height: 1.8;
}

.phase-content ul {
    margin: 20px 0;
    padding-left: 20px;
}

.phase-content li {
    margin: 10px 0;
    font-size: 1.05rem;
}

/* ===== Concept Card ===== */
.concept-card {
    background: var(--secondary);
    padding: 30px;
    border-radius: 12px;
    margin: 30px 0;
    border: 1px solid var(--border);
}

.concept-card h3 {
    color: var(--primary);
    margin-bottom: 20px;
}

/* ===== Memory Diagram ===== */
.memory-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.stack, .heap {
    padding: 20px;
    border-radius: 8px;
}

.stack {
    background: rgba(76, 175, 80, 0.1);
    border: 2px solid var(--success);
}

.heap {
    background: rgba(247, 76, 0, 0.1);
    border: 2px solid var(--primary);
}

.stack h4, .heap h4 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.stack-item, .heap-item {
    padding: 12px;
    margin: 8px 0;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
    font-family: monospace;
}

/* ===== Example Box ===== */
.example-box {
    background: #2a2a2a;
    padding: 25px;
    border-radius: 8px;
    margin: 30px 0;
    border-left: 4px solid var(--primary);
}

.example-box h3 {
    color: var(--success);
    margin-bottom: 15px;
}

.example-box pre {
    background: #1a1a1a;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
}

.example-box code {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.95rem;
    color: #a5d6ff;
}

/* ===== Quiz Section ===== */
.quiz {
    background: var(--secondary);
    padding: 30px;
    border-radius: 12px;
    margin: 40px 0;
    border: 1px solid var(--border);
}

.quiz h2 {
    color: var(--primary);
    margin-bottom: 20px;
}

.quiz-question {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-btn {
    padding: 15px 20px;
    background: #333;
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 1rem;
    transition: all 0.3s;
}

.quiz-btn:hover {
    background: #444;
    border-color: var(--primary);
}

.quiz-btn.correct {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.quiz-btn.incorrect {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

/* ===== Progress Section ===== */

.progress {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    margin: 30px 0;
}

.progress h2 {
    color: var(--primary);
    margin: 0 0 20px 0;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #2d2d2d;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #ff9800);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s;
}

.progress-fill span {
    color: white;
    font-weight: 600;
    font-size: 0.9em;
}

.progress-note {
    margin-top: 10px;
    opacity: 0.8;
    font-size: 0.9em;
}

/* ===== Footer ===== */
footer {
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid var(--border);
    margin-top: 60px;
}

.ai-attribution {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 10px;
}

.ai-attribution a {
    color: var(--primary);
    text-decoration: none;
}

.ai-attribution a:hover {
    text-decoration: underline;
}

.license {
    font-size: 0.85rem;
    color: #666;
}

.license a {
    color: #888;
    text-decoration: none;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .memory-view {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .phases {
        flex-direction: column;
    }
}
