/* ─── Base Reset & Variables ─────────────────────────────────────────────── */
:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #222633;
    --bg-hover: #2a2f3d;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --text-muted: #6b7280;
    --accent-orange: #ff6b00;
    --accent-blue: #4a9eff;
    --accent-green: #34d399;
    --accent-red: #ef4444;
    --accent-yellow: #fbbf24;
    --accent-purple: #a78bfa;
    --border: #2d3348;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.logo-text .accent {
    color: var(--accent-orange);
    margin: 0 0.25rem;
}

.nav {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--accent-orange);
    background: rgba(255, 107, 0, 0.1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.customer-badge {
    padding: 0.25rem 0.75rem;
    background: rgba(74, 158, 255, 0.1);
    color: var(--accent-blue);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-indicator {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-indicator.live {
    color: var(--accent-green);
}

/* ─── Main Content ───────────────────────────────────────────────────────── */
.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ─── Panels ─────────────────────────────────────────────────────────────── */
.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-primary {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: #fff;
}

.btn-primary:hover {
    background: #e55f00;
    border-color: #e55f00;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
}

.input {
    padding: 0.6rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font);
}

.input:focus {
    outline: none;
    border-color: var(--accent-orange);
}

.textarea {
    resize: vertical;
    min-height: 80px;
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    padding: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(45, 51, 72, 0.5);
}

.data-table tr:hover td {
    background: var(--bg-hover);
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-healthy { background: rgba(52, 211, 153, 0.15); color: var(--accent-green); }
.badge-degraded { background: rgba(251, 191, 36, 0.15); color: var(--accent-yellow); }
.badge-critical { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* ─── Scenario Cards ─────────────────────────────────────────────────────── */
.scenario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.scenario-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: border-color 0.2s;
}

.scenario-card:hover {
    border-color: var(--accent-orange);
}

.scenario-card h3 {
    font-size: 1rem;
    margin: 0.75rem 0 0.5rem;
}

.scenario-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.scenario-severity {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

.scenario-severity.high { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.scenario-severity.medium { background: rgba(251, 191, 36, 0.15); color: var(--accent-yellow); }

.scenario-services {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.service-tag {
    padding: 0.2rem 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--accent-purple);
}

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

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding: 1rem 0;
    padding-left: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.55rem;
    top: 1.4rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-orange);
    border: 2px solid var(--bg-secondary);
}

.timeline-item .time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.timeline-item .action {
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0.25rem 0;
}

.timeline-item .detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.timeline-item .tool-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: rgba(167, 139, 250, 0.15);
    color: var(--accent-purple);
    border-radius: 3px;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    margin-top: 0.25rem;
}

/* ─── Simulation Output ──────────────────────────────────────────────────── */
.simulation-output {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.8;
}

.sim-step {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(45, 51, 72, 0.3);
}

.sim-step .step-icon {
    margin-right: 0.5rem;
}

.sim-step.complete .step-icon { color: var(--accent-green); }
.sim-step.pending .step-icon { color: var(--text-muted); }
.sim-step.active .step-icon { color: var(--accent-orange); }

/* ─── Architecture ───────────────────────────────────────────────────────── */
.architecture-diagram {
    overflow-x: auto;
}

.arch-ascii {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--text-secondary);
    white-space: pre;
    padding: 1rem;
}

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

.integration-card {
    padding: 1.25rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.integration-card h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--accent-orange);
}

.integration-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.integration-card code {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-purple);
    background: var(--bg-primary);
    padding: 0.5rem;
    border-radius: 4px;
}

/* ─── Investigations List ────────────────────────────────────────────────── */
.investigations-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.investigation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.investigation-item .inv-title {
    font-weight: 500;
    font-size: 0.9rem;
}

.investigation-item .inv-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    .header-left {
        flex-direction: column;
        gap: 0.75rem;
    }
    .main {
        padding: 1rem;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .scenario-grid {
        grid-template-columns: 1fr;
    }
}
