:root {
    --background-color: #f8f9fa;
    --card-background: #fff;
    --text-color: #333;
    --title-color: #2c3e50;
    --subtitle-color: #7f8c8d;
    --border-color: rgba(0, 0, 0, 0.1);
    --chart-line-color: #3498db;
    --chart-area-positive: rgba(52, 152, 219, 0.1);
    --chart-area-negative: rgba(231, 76, 60, 0.1);
    --recession-color: rgba(180, 180, 180, 0.7);
    --zero-line-color: rgba(0, 0, 0, 0.5);
    --grid-line-color: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --value-card-shadow: rgba(0, 0, 0, 0.05);
    --value-card-gradient: linear-gradient(135deg, rgba(52, 152, 219, 0.1), rgba(41, 128, 185, 0.2));
    --value-card-text: var(--title-color);
    --value-card-border: rgba(52, 152, 219, 0.3);
}

@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #121212;
        --card-background: #1e1e1e;
        --text-color: #e0e0e0;
        --title-color: #ecf0f1;
        --subtitle-color: #bdc3c7;
        --border-color: rgba(255, 255, 255, 0.1);
        --chart-line-color: #3498db;
        --chart-area-positive: rgba(52, 152, 219, 0.2);
        --chart-area-negative: rgba(231, 76, 60, 0.2);
        --recession-color: rgba(120, 120, 120, 0.7);
        --zero-line-color: rgba(255, 255, 255, 0.5);
        --grid-line-color: rgba(255, 255, 255, 0.1);
        --shadow-color: rgba(0, 0, 0, 0.3);
        --value-card-shadow: rgba(0, 0, 0, 0.2);
        --value-card-gradient: linear-gradient(135deg, rgba(52, 152, 219, 0.15), rgba(41, 128, 185, 0.25));
        --value-card-text: var(--title-color);
        --value-card-border: rgba(52, 152, 219, 0.3);
    }
}

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

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    padding: 10px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    margin: 0 auto 20px;
    padding: 20px;
    max-width: 100%;
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.header-text {
    flex: 1;
    min-width: 0; /* Prevents flex item from overflowing */
}

h1 {
    text-align: left;
    margin-bottom: 10px;
    color: var(--title-color);
    font-size: 3.6rem;
    line-height: 1.2;
    font-weight: 600;
}

.description {
    text-align: left;
    margin-bottom: 0;
    color: var(--subtitle-color);
    font-size: 0.95rem;
}

.chart-container {
    position: relative;
    height: 60vh;
    width: 100%;
    margin-bottom: 20px;
}

.legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.line-symbol {
    width: 25px;
    height: 3px;
    background-color: var(--chart-line-color);
}

.recession-symbol {
    width: 25px;
    height: 18px;
    background-color: var(--recession-color);
}

/* Medium screens */
@media (min-width: 768px) {
    body {
        padding: 15px;
    }
    
    .container {
        padding: 25px;
    }
}

/* Large screens */
@media (min-width: 1200px) {
    body {
        padding: 20px;
    }
    
    .container,
    .header-container {
        max-width: 95%;
        padding: 10px;
    }
}

/* Extra large screens */
@media (min-width: 1600px) {
    .container,
    .header-container {
        max-width: 75%;
        padding: 20px 50px;
    }
}

/* Mobile screens */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .container,
    .header-container {
        padding: 15px;
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
    }
    
    .header-container {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        margin-bottom: 15px;
        padding: 20px;
    }

    .header-text {
        text-align: center;
        width: 100%;
    }

    h1 {
        text-align: center;
        font-size: 2.4rem;
        margin-bottom: 8px;
    }
    
    .description {
        text-align: center;
        font-size: 0.9rem;
        width: 100%;
    }
    
    .chart-container {
        height: 50vh;
    }
    
    .legend-item {
        font-size: 0.95rem;
    }
    
    .line-symbol {
        width: 22px;
    }
    
    .recession-symbol {
        width: 22px;
        height: 16px;
    }
    
    .current-value-card {
        width: 100%;
        padding: 25px 15px;
        margin: 0;
        border-radius: 8px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .current-value-card .label {
        font-size: 0.9rem;
        text-align: left;
        margin: 0;
    }

    .current-value-card .value {
        font-size: 2rem;
        margin: 0;
        flex-grow: 1;
        text-align: center;
    }

    .current-value-card .date {
        font-size: 0.9rem;
        text-align: right;
    }
}

/* Small mobile screens */
@media (max-width: 480px) {
    .container,
    .header-container {
        padding: 15px;
    }
    
    .header-container {
        gap: 12px;
        margin-bottom: 12px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .description {
        font-size: 0.85rem;
    }
    
    .chart-container {
        height: 45vh;
    }

    .current-value-card {
        padding: 15px;
        flex-direction: column;
        gap: 5px;
    }

    .current-value-card .label,
    .current-value-card .value,
    .current-value-card .date {
        text-align: center;
        width: 100%;
    }

    .current-value-card .value {
        font-size: 2.2rem;
        order: -1;
    }
}

.current-value-card {
    background: var(--value-card-gradient);
    border: 1px solid var(--value-card-border);
    border-radius: 12px;
    padding: 20px;
    flex-shrink: 0;
    text-align: center;
    box-shadow: 0 4px 6px var(--value-card-shadow),
                0 1px 3px var(--value-card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.current-value-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px var(--value-card-shadow),
                0 2px 4px var(--value-card-shadow);
}

.current-value-card .label {
    font-size: 0.9rem;
    color: var(--subtitle-color);
    margin-bottom: 2px;
}

.current-value-card .value {
    font-size: 2.4rem;
    font-weight: 600;
    color: var(--value-card-text);
    line-height: 1.1;
}

.current-value-card .date {
    font-size: 0.9rem;
    color: var(--subtitle-color);
}

.time-range-selector {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
}

.time-button {
    padding: 8px 16px;
    border: 1px solid #3498db;
    background: transparent;
    color: #3498db;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    transition: all 0.2s ease;
}

.time-button:hover {
    background: rgba(52, 152, 219, 0.1);
}

.time-button.active {
    background: #3498db;
    color: white;
}