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

:root {
    --primary-color: #1f2937;
    --secondary-color: #3b82f6;
    --accent-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-color: #374151;
    --light-text: #6b7280;
    --bg-color: #f9fafb;
    --white: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --spy-color: #10b981;
    --vix-color: #ef4444;
    --grid-color: #f3f4f6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.dashboard-container {
    min-height: 100vh;
}

.dashboard-header {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary-color);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--secondary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: var(--transition);
}

.back-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.dashboard-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.controls-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    background: var(--white);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.time-controls h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}

.time-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.time-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background: var(--white);
    color: var(--text-color);
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.time-btn:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.time-btn.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--white);
}

.refresh-controls {
    text-align: right;
}

.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--accent-color);
    color: var(--white);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 0.5rem;
}

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

.refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.last-updated {
    font-size: 0.875rem;
    color: var(--light-text);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    text-align: center;
}

.metric-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--light-text);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.metric-change {
    font-size: 0.875rem;
    font-weight: 500;
}

.metric-change.positive {
    color: var(--accent-color);
}

.metric-change.negative {
    color: var(--danger-color);
}

.metric-subtitle {
    font-size: 0.75rem;
    color: var(--light-text);
    margin-top: 0.25rem;
}

.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    height: 400px;
    min-height: 400px;
    max-height: 400px;
}

.chart-container canvas {
    max-height: 300px !important;
    height: 300px !important;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.chart-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

.chart-legend {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-color);
}

.legend-color {
    width: 1rem;
    height: 0.25rem;
    border-radius: 0.125rem;
}

.spy-color {
    background: var(--spy-color);
}

.vix-color {
    background: var(--vix-color);
}

.chart-info {
    font-size: 0.875rem;
    color: var(--light-text);
}

.insights-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.insight-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.insight-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.insight-item {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.insight-item:last-child {
    margin-bottom: 0;
}

.insight-item ul {
    margin-top: 0.5rem;
    margin-left: 1.5rem;
}

.insight-item li {
    margin-bottom: 0.25rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-color);
    font-weight: 500;
}

.stat-value {
    color: var(--primary-color);
    font-weight: 600;
}

.technical-note {
    background: var(--grid-color);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border-left: 4px solid var(--secondary-color);
}

.technical-note h4 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.technical-note p {
    color: var(--text-color);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.technical-note p:last-child {
    margin-bottom: 0;
}

.disclaimer {
    color: var(--light-text);
    font-style: italic;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--text-color);
    font-weight: 500;
}

.volatility-low {
    color: var(--accent-color);
}

.volatility-normal {
    color: var(--secondary-color);
}

.volatility-elevated {
    color: var(--warning-color);
}

.volatility-high {
    color: var(--danger-color);
}

@media (max-width: 1024px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .insights-section {
        grid-template-columns: 1fr;
    }
    
    .controls-section {
        flex-direction: column;
        gap: 1.5rem;
        align-items: flex-start;
    }
    
    .refresh-controls {
        text-align: left;
    }
}

@media (max-width: 768px) {
    .dashboard-content {
        padding: 1rem;
    }
    
    .header-content {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .time-buttons {
        justify-content: center;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .chart-legend {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .time-buttons {
        width: 100%;
    }
    
    .time-btn {
        flex: 1;
        min-width: 0;
    }
    
    .stat-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}