:root {
    /* Light Mode Variables (Default) */
    --bg-color: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    --accent-primary: #2563eb;
    --accent-success: #16a34a;
    --accent-warning: #eab308;
    --accent-danger: #dc2626;
    --log-bg: rgba(241, 245, 249, 0.6);
    --log-border: rgba(226, 232, 240, 0.8);
}

body.dark-mode {
    /* Dark Mode Variables */
    --bg-color: #020617;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    --accent-primary: #3b82f6;
    --accent-success: #22c55e;
    --accent-warning: #fbbf24;
    --accent-danger: #ef4444;
    --log-bg: rgba(2, 6, 23, 0.6);
    --log-border: rgba(30, 41, 59, 0.8);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Background Effects for Glassmorphism */
.background-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        linear-gradient(to right, var(--text-secondary) 1px, transparent 1px),
        linear-gradient(to bottom, var(--text-secondary) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.03;
    z-index: -2;
    pointer-events: none;
}

body.dark-mode .ambient-glow {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

/* Glass Panel Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 12px;
}

/* Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    margin: 1rem 2rem;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.badge {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: rgba(148, 163, 184, 0.1);
}

/* Dashboard Layout */
.dashboard {
    flex: 1;
    padding: 1rem 2rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 2rem;
    flex-wrap: wrap;
}

.dashboard-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 600px;
}

/* ROI Summary */
.roi-summary {
    display: flex;
    gap: 2rem;
    padding: 1.5rem 2rem;
}

.highlight-panel {
    border-top: 3px solid var(--accent-primary);
}

.roi-stat {
    display: flex;
    flex-direction: column;
}

.roi-stat .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.roi-stat .value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.text-success { color: var(--accent-success); }
.text-primary { color: var(--accent-primary); }

/* Pipeline Visualization */
.pipeline-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    overflow-x: auto;
}

.pipeline-stage {
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.pipeline-stage.active-stage {
    opacity: 1;
}

.stage-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--text-secondary);
    color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.active-stage .stage-num {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.stage-info {
    display: flex;
    flex-direction: column;
}

.stage-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.stage-info span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.stage-icon {
    color: var(--text-secondary);
    opacity: 0.5;
}

.active-stage .stage-icon {
    color: var(--accent-primary);
    opacity: 1;
}

.pipeline-arrow {
    color: var(--glass-border);
    opacity: 0.5;
}

.section-title {
    margin-bottom: 1rem;
    padding-left: 0.5rem;
    border-left: 3px solid var(--accent-primary);
}

.section-title h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

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

.agent-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.agent-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

body.dark-mode .agent-card:hover {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.agent-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255,255,255, 0.3);
}

body.dark-mode .agent-header {
    background: rgba(0,0,0, 0.2);
}

.agent-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.agent-title h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.status-indicator.active {
    background: var(--accent-success);
    box-shadow: 0 0 8px var(--accent-success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.agent-icon {
    color: var(--accent-primary);
}

.agent-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex: 1;
}

.agent-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.metrics {
    display: flex;
    gap: 1.5rem;
}

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

.metric span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.metric strong {
    font-size: 1.25rem;
    font-variant-numeric: tabular-nums;
}

.log-window {
    background: var(--log-bg);
    border: 1px solid var(--log-border);
    border-radius: 6px;
    padding: 0.75rem;
    height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
}

.log-list {
    list-style: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.log-item {
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    animation: fadeIn 0.3s ease;
}

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

.log-time {
    color: var(--accent-primary);
    margin-right: 0.5rem;
}

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

/* Disclaimer */
.disclaimer {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-left: 4px solid var(--accent-warning);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--glass-border);
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
    }
    .roi-summary {
        width: 100%;
        justify-content: space-between;
    }
}
