/* Building Agentic AI Systems - Tutorial CSS */

:root {
    --agent-dark: #0f172a;
    --agent-mid: #1e293b;
    --agent-surface: #1e2d40;
    --agent-accent: #6366f1;
    --agent-accent2: #22d3ee;
    --agent-green: #10b981;
    --agent-yellow: #f59e0b;
    --agent-red: #ef4444;
    --agent-purple: #a855f7;
    --agent-text: #e2e8f0;
    --agent-muted: #94a3b8;
    --agent-border: rgba(99, 102, 241, 0.25);
}

/* ── Tutorial Header ──────────────────────────────── */
.tutorial-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #312e81 100%);
    color: var(--agent-text);
    padding: 3rem 0 2rem;
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.tutorial-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 70% 40%, rgba(99,102,241,0.18) 0%, transparent 65%);
    pointer-events: none;
}

.chapter-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    background: linear-gradient(90deg, #e0e7ff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chapter-subtitle {
    font-size: 1.1rem;
    color: var(--agent-accent2);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
    letter-spacing: 0.04em;
}

.section-label-badge {
    display: inline-block;
    background: rgba(99,102,241,0.2);
    border: 1px solid rgba(99,102,241,0.4);
    color: #a5b4fc;
    padding: 0.2rem 0.75rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}

/* ── Progress Bars ────────────────────────────────── */
.chapter-progress {
    background: rgba(255,255,255,0.1);
    height: 5px;
    border-radius: 3px;
    margin: 1rem auto;
    max-width: 600px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.chapter-progress-fill {
    background: linear-gradient(90deg, var(--agent-accent), var(--agent-accent2));
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.6s ease;
    box-shadow: 0 0 8px rgba(99,102,241,0.5);
}

.section-progress { display: none; }

/* ── Chapter Navigation ───────────────────────────── */
.chapter-navigation {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem;
    margin: 1rem 0;
    position: relative;
    z-index: 1;
}

.chapter-nav-btn {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.75);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.chapter-nav-btn:hover,
.chapter-nav-btn.active {
    background: var(--agent-accent);
    border-color: var(--agent-accent);
    color: #fff;
}

/* ── Section Nav Buttons ──────────────────────────── */
.section-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1rem;
    position: relative;
    z-index: 1;
}

.section-nav-btn {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
}

.section-nav-btn:hover,
.section-nav-btn.active {
    background: var(--agent-accent);
    border-color: var(--agent-accent);
    color: #fff;
}

/* ── Content Sections ─────────────────────────────── */
.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

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

/* ── Main Content Area ────────────────────────────── */
.chapter-main-content {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 1rem 3rem;
    color: #1e293b;
}

/* ── Info Boxes ───────────────────────────────────── */
.info-box {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
}

.info-box h3, .info-box h4 { color: #1d4ed8; margin-bottom: 0.5rem; }

.tip-box {
    background: #f0fdf4;
    border-left: 4px solid var(--agent-green);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
}

.tip-box h4 { color: #065f46; margin-bottom: 0.5rem; }

.warning-box {
    background: #fffbeb;
    border-left: 4px solid var(--agent-yellow);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
}

.warning-box h4 { color: #92400e; margin-bottom: 0.5rem; }

.danger-box {
    background: #fef2f2;
    border-left: 4px solid var(--agent-red);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
}

.danger-box h4 { color: #991b1b; margin-bottom: 0.5rem; }

/* ── Diagrams ─────────────────────────────────────── */

/* Flow Diagram - horizontal steps connected by arrows */
.flow-diagram {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.flow-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    border: 2px solid #6366f1;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    min-width: 100px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(99,102,241,0.12);
}

.flow-node .flow-icon {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}

.flow-node strong {
    font-size: 0.85rem;
    color: #1e293b;
    display: block;
}

.flow-node p {
    font-size: 0.72rem;
    color: #64748b;
    margin: 0.2rem 0 0;
}

.flow-arrow {
    font-size: 1.4rem;
    color: #6366f1;
    font-weight: 700;
    padding: 0 0.2rem;
}

/* Circular / Loop Diagram */
.loop-diagram {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0.5rem;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0f4ff, #fdf4ff);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    max-width: 500px;
}

.loop-node {
    background: #fff;
    border: 2px solid #6366f1;
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
}

.loop-node .loop-num {
    display: inline-block;
    background: #6366f1;
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 22px;
    margin-bottom: 0.3rem;
}

.loop-node strong {
    display: block;
    font-size: 0.88rem;
    color: #1e293b;
}

.loop-node p {
    font-size: 0.72rem;
    color: #64748b;
    margin: 0.2rem 0 0;
}

.loop-center {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.loop-arrows {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0.5rem;
    margin: 0.25rem 0 1.25rem;
}

.loop-arrow-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #6366f1;
    font-weight: 700;
}

/* Architecture Diagram */
.arch-diagram {
    margin: 1.5rem 0;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.arch-layer {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #e2e8f0;
}

.arch-layer:last-child { border-bottom: none; }

.arch-label {
    background: #1e293b;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    padding: 0.5rem 0.4rem;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arch-cells {
    display: flex;
    flex: 1;
    gap: 1px;
    background: #e2e8f0;
}

.arch-cell {
    flex: 1;
    background: #f8fafc;
    padding: 0.75rem;
    text-align: center;
    font-size: 0.82rem;
}

.arch-cell strong { display: block; color: #1e293b; margin-bottom: 0.25rem; }
.arch-cell span { color: #64748b; font-size: 0.72rem; }

.arch-cell.primary { background: #eff6ff; }
.arch-cell.accent  { background: #f5f3ff; }
.arch-cell.green   { background: #f0fdf4; }
.arch-cell.yellow  { background: #fffbeb; }

/* Comparison Grid */
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.comparison-col {
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 1rem;
}

.comparison-col h4 {
    color: #1e293b;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #6366f1;
}

.comparison-col ul {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.82rem;
    color: #374151;
}

.comparison-col ul li { margin-bottom: 0.3rem; }

/* Layer Stack Diagram */
.layer-stack {
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.layer-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    gap: 0.75rem;
}

.layer-item:last-child { border-bottom: none; }

.layer-item .layer-num {
    background: #6366f1;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.layer-item .layer-content { flex: 1; }
.layer-item .layer-content strong { display: block; font-size: 0.88rem; color: #1e293b; }
.layer-item .layer-content span { font-size: 0.78rem; color: #64748b; }

.layer-item.l0 { background: #faf5ff; }
.layer-item.l1 { background: #eff6ff; }
.layer-item.l2 { background: #f0fdf4; }
.layer-item.l3 { background: #fffbeb; }
.layer-item.l4 { background: #fef2f2; }
.layer-item.l5 { background: #f0f9ff; }
.layer-item.l6 { background: #fdf4ff; }

/* Decision Matrix / Table */
.decision-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.decision-matrix th {
    background: #1e293b;
    color: #e2e8f0;
    padding: 0.6rem 0.8rem;
    text-align: left;
    font-size: 0.8rem;
}

.decision-matrix td {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.decision-matrix tr:nth-child(even) td { background: #f8fafc; }
.decision-matrix tr:hover td { background: #eff6ff; }

/* Multi-agent Network Diagram */
.network-diagram {
    background: #0f172a;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.network-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.net-node {
    background: #1e2d40;
    border: 2px solid #6366f1;
    border-radius: 10px;
    padding: 0.5rem 0.9rem;
    text-align: center;
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 600;
}

.net-node.orchestrator {
    border-color: var(--agent-accent2);
    background: #0c2a36;
    color: var(--agent-accent2);
}

.net-node.specialist {
    border-color: #a855f7;
    background: #1a0a2e;
    color: #d8b4fe;
}

.net-node.tool {
    border-color: var(--agent-green);
    background: #052e16;
    color: #86efac;
    font-size: 0.72rem;
    padding: 0.35rem 0.7rem;
}

.net-arrow {
    color: #6366f1;
    font-size: 1rem;
    font-weight: 700;
}

.net-arrow.down { display: block; text-align: center; color: #6366f1; font-size: 1.2rem; }

/* Pattern Cards */
.pattern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.pattern-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    border-top: 3px solid #6366f1;
}

.pattern-card.green-top  { border-top-color: var(--agent-green); }
.pattern-card.yellow-top { border-top-color: var(--agent-yellow); }
.pattern-card.purple-top { border-top-color: var(--agent-purple); }
.pattern-card.cyan-top   { border-top-color: var(--agent-accent2); }

.pattern-card h4 { font-size: 0.88rem; color: #1e293b; margin-bottom: 0.4rem; }
.pattern-card p  { font-size: 0.78rem; color: #64748b; margin: 0 0 0.5rem; }

.pattern-card .use-when {
    font-size: 0.72rem;
    color: #374151;
    background: #fff;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    border: 1px solid #e2e8f0;
}

/* Timeline */
.timeline {
    position: relative;
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.6rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #6366f1, #22d3ee);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.25rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.65rem;
    top: 0.5rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6366f1;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #6366f1;
}

.timeline-item h4 { font-size: 0.88rem; color: #1e293b; margin-bottom: 0.25rem; }
.timeline-item p  { font-size: 0.8rem; color: #64748b; margin: 0; }

/* Benchmark / Badge Grid */
.badge-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1rem 0;
}

.badge-item {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    padding: 0.3rem 0.8rem;
    font-size: 0.78rem;
    color: #1e40af;
    font-weight: 600;
}

.badge-item.green  { background: #f0fdf4; border-color: #86efac; color: #065f46; }
.badge-item.yellow { background: #fffbeb; border-color: #fcd34d; color: #78350f; }
.badge-item.red    { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.badge-item.purple { background: #faf5ff; border-color: #d8b4fe; color: #6b21a8; }

/* Code block styling */
.code-block {
    background: #0f172a;
    border-radius: 10px;
    border: 1px solid #1e293b;
    overflow: hidden;
    margin: 1.25rem 0;
}

.code-block-header {
    background: #1e293b;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.code-block-header span {
    color: #94a3b8;
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.code-block pre {
    margin: 0;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.6;
    background: none;
    border: none;
}

/* Quiz Styles */
.quiz-container {
    background: #f0f4ff;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.25rem 0;
    border: 1px solid #c7d2fe;
}

.quiz-question {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #c7d2fe;
}

.quiz-question:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.quiz-question p {
    font-weight: 600;
    color: #1e1b4b;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.quiz-options { display: flex; flex-direction: column; gap: 0.4rem; }

.quiz-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    color: #374151;
}

.quiz-option:hover { background: #eff6ff; border-color: #6366f1; }
.quiz-option input[type="radio"] { accent-color: #6366f1; }
.quiz-option.correct { background: #f0fdf4; border-color: var(--agent-green); }
.quiz-option.incorrect { background: #fef2f2; border-color: var(--agent-red); }

.quiz-feedback {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    display: none;
}

.quiz-feedback.show { display: block; }
.quiz-feedback.correct  { background: #d1fae5; color: #065f46; }
.quiz-feedback.incorrect { background: #fee2e2; color: #991b1b; }

/* Responsive */
@media (max-width: 640px) {
    .chapter-title { font-size: 1.6rem; }
    .flow-diagram { flex-direction: column; }
    .flow-arrow { transform: rotate(90deg); }
    .loop-diagram { grid-template-columns: 1fr 1fr; }
    .comparison-grid { grid-template-columns: 1fr; }
    .pattern-grid { grid-template-columns: 1fr; }
    .network-row { flex-wrap: wrap; }
}
