/**
 * Styles for Ray Dalio Economic Risk Dashboard
 */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
    border-bottom: 2px solid #1a1a1a;
}

h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #00ff88 0%, #0088ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
}

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* Risk cards */
.risk-card {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
}

.risk-card:hover {
    border-color: #3a3a3a;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.risk-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    font-weight: 500;
}

.probability-display {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    transition: all 0.5s ease;
}

.probability-change {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 20px;
}

/* Risk level colors */
.risk-low {
    color: #00ff88;
}

.risk-moderate {
    color: #ffaa00;
}

.risk-high {
    color: #ff4444;
}

.risk-critical {
    color: #ff0044;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Indicators section */
.indicators-section {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 40px;
}

.indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.indicator {
    background: #0a0a0a;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #2a2a2a;
    transition: border-color 0.3s ease;
}

.indicator:hover {
    border-color: #3a3a3a;
}

.indicator-name {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 8px;
}

.indicator-value {
    font-size: 1.4rem;
    font-weight: 600;
    color: #e0e0e0;
}

.indicator-threshold {
    font-size: 0.8rem;
    color: #666;
    margin-top: 4px;
}

/* Alert banner */
.alert-banner {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    display: none;
}

.alert-yellow {
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid rgba(255, 170, 0, 0.3);
    color: #ffaa00;
}

.alert-orange {
    background: rgba(255, 136, 0, 0.1);
    border: 1px solid rgba(255, 136, 0, 0.3);
    color: #ff8800;
}

.alert-red {
    background: rgba(255, 0, 68, 0.1);
    border: 1px solid rgba(255, 0, 68, 0.3);
    color: #ff0044;
}

/* Update time */
.update-time {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-top: 20px;
}

/* Loading indicator */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-top-color: #00ff88;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-left: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Data source */
.data-source {
    font-size: 0.8rem;
    color: #555;
    margin-top: 8px;
}

/* Error state */
.error-state {
    color: #ff4444;
    font-size: 0.8rem;
}

/* Refresh button */
.refresh-button {
    float: right;
    background: #1a1a1a;
    border: 1px solid #00ff88;
    color: #00ff88;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.refresh-button:hover {
    background: #00ff88;
    color: #0a0a0a;
}

.refresh-button:active {
    transform: scale(0.98);
}

.refresh-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Setup details */
details {
    margin-top: 40px;
    padding: 20px;
    background: #1a1a1a;
    border-radius: 8px;
    border: 1px solid #2a2a2a;
}

summary {
    cursor: pointer;
    color: #00ff88;
    font-weight: 500;
    user-select: none;
}

summary:hover {
    color: #00ffaa;
}

details > div {
    margin-top: 20px;
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.8;
}

details h3 {
    color: #fff;
    margin: 20px 0 10px;
}

details h3:first-of-type {
    margin-top: 0;
}

details code {
    background: #0a0a0a;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #00ff88;
}

details pre {
    background: #0a0a0a;
    padding: 10px;
    overflow-x: auto;
    border-radius: 4px;
    margin: 10px 0;
}

details ul {
    margin-left: 20px;
}

details li {
    margin: 5px 0;
}

/* Responsive design */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

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

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

    .probability-display {
        font-size: 2.5rem;
    }

    .refresh-button {
        float: none;
        display: block;
        width: 100%;
        margin-top: 10px;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for keyboard navigation */
button:focus,
summary:focus {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .refresh-button {
        display: none;
    }

    .alert-banner {
        border: 1px solid #000;
    }

    details {
        display: none;
    }
}
