/* Fear & Greed Index Dashboard Styles */

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

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

/* Dashboard */
.dashboard {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Metrics Cards */
.metrics-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem;
    border-left: 4px solid #e2e8f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.metric-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.metric-label {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.metric-date {
    font-size: 0.875rem;
    color: #64748b;
}

/* Charts Container */
.charts-container {
    margin-bottom: 2rem;
}

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

.chart-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.chart-wrapper {
    position: relative;
    height: 400px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
}

/* Legend Section */
.legend-section {
    margin-bottom: 2rem;
}

.legend-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
}

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

.legend-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 6px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.legend-text {
    display: flex;
    flex-direction: column;
}

.legend-text strong {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
}

.legend-text span {
    font-size: 0.75rem;
    color: #64748b;
}

/* Legend Colors */
.extreme-fear .legend-color {
    background-color: #dc2626;
}

.fear .legend-color {
    background-color: #ea580c;
}

.neutral .legend-color {
    background-color: #ca8a04;
}

.greed .legend-color {
    background-color: #16a34a;
}

.extreme-greed .legend-color {
    background-color: #15803d;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2rem;
    color: white;
    opacity: 0.8;
    font-size: 0.875rem;
}

footer p {
    margin-bottom: 0.25rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem 0.5rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .dashboard {
        padding: 1rem;
    }

    .metrics-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .metric-card {
        padding: 1rem;
    }

    .metric-value {
        font-size: 2rem;
    }

    .chart-wrapper {
        height: 300px;
        padding: 0.5rem;
    }

    .legend-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .metric-value {
        font-size: 1.75rem;
    }

    .chart-wrapper {
        height: 250px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error States */
.error {
    color: #dc2626;
    text-align: center;
    padding: 2rem;
    background: #fee2e2;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

/* Chart Controls */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.chart-header h3 {
    margin: 0;
    color: #1e293b;
    font-size: 1.25rem;
}

.chart-controls {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

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

.period-controls label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
}

.period-controls select {
    padding: 0.25rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    background: white;
    color: #374151;
    cursor: pointer;
}

.period-controls select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.data-toggles {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.data-toggles > label:first-child {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    margin-right: 0.5rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
    background-color: #ccc;
    border-radius: 34px;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

.toggle-switch input:checked + .slider {
    background-color: #3b82f6;
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(14px);
}

/* Responsive Chart Controls */
@media (max-width: 768px) {
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        width: 100%;
    }

    .data-toggles {
        gap: 0.75rem;
    }
}