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

:root {
    /* Color Palette - Dark Theme */
    --bg-primary: #0a0e27;
    --bg-secondary: #141b2d;
    --bg-tertiary: #1e2742;
    --bg-glass: rgba(20, 27, 45, 0.7);
    
    /* Accent Colors */
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-purple: #8b5cf6;
    --accent-rose: #f43f5e;
    --accent-amber: #f59e0b;
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    /* Border & Divider */
    --border-color: rgba(148, 163, 184, 0.1);
    --divider-color: rgba(148, 163, 184, 0.15);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1e2742 50%, #0f172a 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Animated Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(16, 185, 129, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Command Center Specific Styles */
.dashboard {
    max-width: 1800px;
    margin: 0 auto;
    padding: var(--space-md); /* Reduced padding for more space */
    position: relative;
    z-index: 1;
}

/* Enhanced Glass Effect */
.glass {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.glass:hover {
    border-color: rgba(59, 130, 246, 0.2);
}

/* Sidebar behavior for large screens */
@media (min-width: 1024px) {
    .lg\:col-span-4 {
        position: sticky;
        top: 1.5rem;
    }
}

/* High Density Table for Strategy Evolution */
#strategy-eval-body tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

#strategy-eval-body td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

/* Scrollbar Customization */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: var(--radius-md);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* Button Enhancements */
button {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::before {
    width: 300px;
    height: 300px;
}

/* Input Focus Effects */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Chart Container Enhancements */
#master-chart-container {
    position: relative;
    background: linear-gradient(135deg, rgba(10, 14, 39, 0.8) 0%, rgba(30, 39, 66, 0.6) 100%);
}

#master-chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
}

/* Stat Cards Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.glass {
    animation: fadeInUp 0.6s ease-out;
}

/* Number Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.font-mono {
    font-variant-numeric: tabular-nums;
}

/* Gradient Text */
.bg-clip-text {
    -webkit-background-clip: text;
    background-clip: text;
}

/* Loading Spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Toggle Switch Enhancement */
input[type="checkbox"]:checked + div {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-cyan) 100%);
}

/* Table Hover Effects */
tbody tr {
    transition: all var(--transition-fast);
}

tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
    transform: translateX(2px);
}

/* Badge Pulse */
@keyframes badge-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Responsive Grid Improvements */
@media (max-width: 768px) {
    .dashboard {
        padding: var(--space-md);
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
}

/* Success/Error States */
.text-success {
    color: var(--accent-emerald);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.text-error {
    color: var(--accent-rose);
    text-shadow: 0 0 10px rgba(244, 63, 94, 0.3);
}

/* Chart Section Collapse Animation */
#master-chart-body {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

#master-chart-body.collapsed {
    max-height: 0;
    opacity: 0;
}

/* Option Chain Item Hover */
.option-chain-item {
    transition: all var(--transition-fast);
    cursor: pointer;
}

.option-chain-item:hover {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--accent-blue);
    padding-left: calc(var(--space-sm) + 3px);
}

.option-chain-item.active {
    background: rgba(59, 130, 246, 0.15);
    border-left: 3px solid var(--accent-blue);
}

/* Logs Section */
.logs {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    padding: var(--space-xl);
}

#log-output {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.4);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    margin-top: var(--space-md);
    border: 1px solid var(--border-color);
}

.log-entry {
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--divider-color);
    transition: background var(--transition-fast);
}

.log-entry:hover {
    background: rgba(59, 130, 246, 0.05);
}

/* Scrollbar Global */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* Utility Classes */
.transition-all {
    transition: all var(--transition-base);
}

.shadow-glow-blue {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.shadow-glow-green {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.shadow-glow-red {
    box-shadow: 0 0 20px rgba(244, 63, 94, 0.4);
}