* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

/* ==================== HEADER ==================== */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* ==================== NAVIGATION ==================== */
.main-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-btn {
    padding: 12px 24px;
    background: rgba(255,255,255,0.15);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.nav-btn:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-1px);
}

.nav-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* ==================== SECTIONS ==================== */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

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

/* ==================== CONCEPT GRID ==================== */
.concept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.concept-grid.two-col {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.concept-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.concept-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.concept-card h3 {
    color: #667eea;
    margin-bottom: 12px;
    font-size: 1.2em;
}

.concept-card h4 {
    color: #764ba2;
    margin-bottom: 8px;
}

.concept-card p {
    margin-bottom: 10px;
    color: #555;
}

.concept-card ul {
    list-style: none;
    padding-left: 0;
    margin-top: 10px;
}

.concept-card ul li {
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
}

.concept-card ul li::before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    position: absolute;
    left: 4px;
}

/* ==================== DIAGRAM CONTAINER ==================== */
.diagram-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.diagram-container h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.diagram-caption {
    text-align: center;
    color: #777;
    margin-top: 15px;
    font-size: 0.9em;
    font-style: italic;
}

/* ==================== MINI DIAGRAMS ==================== */
.mini-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    padding: 15px;
    background: #f8f9ff;
    border-radius: 8px;
    font-weight: 600;
}

.jit-pod, .jit-karpenter, .jit-node {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9em;
}

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

.jit-karpenter {
    background: #fff3e0;
    color: #e65100;
    animation: pulse 2s infinite;
}

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

.jit-arrow {
    font-size: 1.5em;
    color: #667eea;
}

.consolidation-before, .consolidation-after {
    padding: 8px 16px;
    border-radius: 6px;
}

.consolidation-before {
    background: #ffebee;
    color: #c62828;
}

.consolidation-after {
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 1.1em;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(230, 81, 0, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(230, 81, 0, 0); }
}

/* ==================== CONTROLS ==================== */
.controls {
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.controls select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.btn-primary {
    padding: 10px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.3s, transform 0.2s;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.btn-secondary {
    padding: 10px 24px;
    background: #f0f0f0;
    color: #555;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.3s, transform 0.2s;
}

.btn-secondary:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.budget-config {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.budget-config input[type="range"] {
    width: 120px;
}

/* ==================== LIFECYCLE FLOW ==================== */
.lifecycle-phase {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-left: auto;
}

.lifecycle-phase.ready { background: #e3f2fd; color: #1565c0; }
.lifecycle-phase.provisioning { background: #fff3e0; color: #e65100; }
.lifecycle-phase.active { background: #e8f5e9; color: #2e7d32; }
.lifecycle-phase.disrupting { background: #fce4ec; color: #c62828; }

.lifecycle-flow {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-height: 280px;
    overflow-x: auto;
    padding: 10px 0;
}

.lifecycle-bucket {
    min-width: 150px;
    flex: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e8e8e8;
    transition: border-color 0.5s, box-shadow 0.5s;
}

.lifecycle-bucket.active-bucket {
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.bucket-header {
    background: #667eea;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9em;
}

.bucket-content {
    padding: 10px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lifecycle-pod, .lifecycle-node {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.lifecycle-pod {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 3px solid #1565c0;
}

.lifecycle-node {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 3px solid #2e7d32;
}

.lifecycle-node.disrupting-node {
    background: #fff3e0;
    color: #e65100;
    border-left-color: #e65100;
    animation: shake 0.5s infinite;
}

.lifecycle-node.terminated-node {
    background: #ffebee;
    color: #c62828;
    border-left-color: #c62828;
    opacity: 0.7;
    text-decoration: line-through;
}

.lifecycle-actor {
    min-width: 100px;
    text-align: center;
    padding: 15px 10px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    align-self: center;
}

.actor-icon {
    font-size: 2em;
}

.actor-label {
    font-weight: 600;
    font-size: 0.85em;
    margin: 5px 0;
}

.actor-status {
    font-size: 0.75em;
    opacity: 0.8;
    margin-top: 5px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* ==================== ARCHITECTURE FLOW ==================== */
.architecture-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 30px 20px;
    flex-wrap: wrap;
}

.arch-block {
    padding: 16px 24px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s;
}

.arch-block:hover {
    transform: scale(1.05);
}

.arch-pod { background: #e3f2fd; color: #1565c0; border: 2px solid #90caf9; }
.arch-karpenter { background: linear-gradient(135deg, #667eea, #764ba2); color: white; }
.arch-nodepool { background: #fff3e0; color: #e65100; border: 2px solid #ffcc80; }
.arch-nodeclass { background: #f3e5f5; color: #6a1b9a; border: 2px solid #ce93d8; }
.arch-node { background: #e8f5e9; color: #2e7d32; border: 2px solid #a5d6a7; }

.arch-arrow {
    color: #667eea;
    font-size: 1.5em;
    font-weight: bold;
}

/* ==================== CODE SNIPPET ==================== */
.code-snippet {
    background: #2c3e50;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
    overflow-x: auto;
}

.code-snippet pre {
    margin: 0;
}

.code-snippet code {
    color: #a8d8a8;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85em;
    line-height: 1.5;
}

.code-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.code-block {
    background: #2c3e50;
    border-radius: 10px;
    padding: 20px;
}

.code-block h4 {
    color: #a8d8a8;
    margin-bottom: 12px;
    font-size: 1em;
}

.code-block pre {
    margin: 0;
    overflow-x: auto;
}

.code-block code {
    color: #c5c8c6;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85em;
    line-height: 1.6;
}

/* ==================== COMPARISON TABLE ==================== */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.comparison-table thead th {
    background: #667eea;
    color: white;
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
}

.comparison-table thead th:first-child {
    border-radius: 8px 0 0 0;
}

.comparison-table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.comparison-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.comparison-table tbody tr:nth-child(even) {
    background: #f8f9ff;
}

.comparison-table tbody tr:hover {
    background: #f0f0ff;
}

.comparison-table code {
    background: #e8e8ff;
    color: #667eea;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* ==================== INTERACTION FLOW ==================== */
.interaction-flow {
    display: flex;
    gap: 30px;
    justify-content: center;
    padding: 20px;
    flex-wrap: wrap;
}

.interaction-col {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.interaction-step {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: 10px;
    border-left: 4px solid;
}

.step-karp {
    background: #f0f0ff;
    border-left-color: #667eea;
}

.step-pdb {
    background: #fff0e0;
    border-left-color: #e65100;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step-pdb .step-number {
    background: #e65100;
}

.step-content p {
    margin: 2px 0;
    color: #555;
    font-size: 0.9em;
}

.interaction-arrow {
    text-align: center;
    color: #999;
    font-size: 1.2em;
}

/* ==================== LEGEND ==================== */
.legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #eee;
}

.legend-badge {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85em;
    color: white;
    flex-shrink: 0;
}

.legend-badge.healthy { background: #4caf50; }
.legend-badge.flagged { background: #ff9800; }
.legend-badge.disrupting { background: #2196f3; }
.legend-badge.terminated { background: #9e9e9e; }

.legend-item span {
    font-weight: 600;
    font-size: 0.9em;
    min-width: 90px;
}

.legend-item small {
    color: #888;
    font-size: 0.8em;
}

/* ==================== BUDGET METER ==================== */
.budget-meter {
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9ff;
    border-radius: 10px;
    border: 1px solid #e0e0ff;
}

.budget-meter-label {
    display: flex;
    gap: 6px;
    align-items: baseline;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.budget-meter-bar {
    height: 12px;
    background: #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
}

.budget-meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #ff9800, #f44336);
    border-radius: 6px;
    transition: width 0.5s ease;
}

/* ==================== DISRUPTION DEMO ==================== */
.disruption-nodes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 16px;
}

.disruption-node {
    width: 110px;
    min-height: 80px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-weight: 600;
    font-size: 0.85em;
    transition: all 0.4s ease;
    border: 2px solid transparent;
    position: relative;
    padding: 10px 6px;
}

.disruption-node .node-icon {
    font-size: 1.4em;
    line-height: 1;
}

.disruption-node .node-name {
    font-size: 0.85em;
    font-weight: 700;
}

.disruption-node .node-status {
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* State: Healthy */
.disruption-node.state-healthy {
    background: #e8f5e9;
    border-color: #a5d6a7;
}
.disruption-node.state-healthy .node-icon { color: #2e7d32; }
.disruption-node.state-healthy .node-name { color: #2e7d32; }
.disruption-node.state-healthy .node-status {
    background: #c8e6c9;
    color: #1b5e20;
}

/* State: Flagged (needs replacement) */
.disruption-node.state-flagged {
    background: #fff8e1;
    border-color: #ffb74d;
    animation: shake 0.6s infinite;
}
.disruption-node.state-flagged .node-icon { color: #e65100; }
.disruption-node.state-flagged .node-name { color: #e65100; }
.disruption-node.state-flagged .node-status {
    background: #ffe0b2;
    color: #bf360c;
}

/* State: Disrupting (being replaced) */
.disruption-node.state-disrupting {
    background: #e3f2fd;
    border-color: #64b5f6;
    animation: pulse 1s infinite;
}
.disruption-node.state-disrupting .node-icon { color: #1565c0; }
.disruption-node.state-disrupting .node-name { color: #1565c0; }
.disruption-node.state-disrupting .node-status {
    background: #bbdefb;
    color: #0d47a1;
}

/* State: Terminated */
.disruption-node.state-terminated {
    background: #f5f5f5;
    border-color: #e0e0e0;
    opacity: 0.6;
}
.disruption-node.state-terminated .node-icon { color: #9e9e9e; }
.disruption-node.state-terminated .node-name {
    color: #9e9e9e;
    text-decoration: line-through;
}
.disruption-node.state-terminated .node-status {
    background: #eeeeee;
    color: #757575;
}

/* ==================== WAITING QUEUE ==================== */
.disruption-queue {
    padding: 16px;
    background: #fff8e1;
    border-radius: 10px;
    border: 2px dashed #ffb74d;
    margin-top: 12px;
}

.queue-label {
    font-weight: 600;
    color: #e65100;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.queue-nodes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==================== STATUS LOG ==================== */
.status-log {
    background: #1e1e2e;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 20px;
}

.log-header {
    background: #2c2c3e;
    color: #a8d8a8;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 0.9em;
    border-bottom: 1px solid #3c3c4e;
}

.log-content {
    padding: 12px 16px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8em;
    color: #c5c8c6;
    line-height: 1.8;
}

.log-content .log-entry {
    padding: 2px 0;
}

.log-content .log-time {
    color: #888;
    margin-right: 8px;
}

.log-content .log-success { color: #4caf50; }
.log-content .log-warning { color: #ff9800; }
.log-content .log-error { color: #f44336; }
.log-content .log-info { color: #64b5f6; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    header h1 { font-size: 1.8em; }
    .lifecycle-flow { flex-direction: column; align-items: stretch; }
    .lifecycle-bucket { min-width: auto; }
    .lifecycle-actor { min-width: auto; }
    .comparison-table { font-size: 0.8em; }
    .interaction-flow { flex-direction: column; }
    .concept-grid.two-col { grid-template-columns: 1fr; }
    .code-comparison { grid-template-columns: 1fr; }
    .controls { flex-direction: column; align-items: stretch; }
    .budget-config { margin-left: 0; }
    .arch-block { font-size: 0.85em; padding: 12px 16px; }
}
