body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Lekton', sans-serif;
    background-color: #ffffff;
    color: #252E6B;
}

.container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    /* Exactly fill viewport */
    box-sizing: border-box;
    overflow: hidden;
    /* Prevent scrolling */
}

.map-title {
    pointer-events: none;
    text-align: center;
    margin: 0;
    padding: 16px 0 9px 0;
    font-family: "Lekton", sans-serif;
    font-weight: 400;
    font-size: clamp(18px, 4vw, 24px);
    letter-spacing: 0.5px;
    background: #fff;
    color: #252E6B;
    z-index: 1000;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transform: translateZ(0);
    position: relative;
    text-transform: uppercase;
    line-height: normal;
}

.top-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    z-index: 10;
    background: #fff;
    padding-bottom: 10px;
}

.top-controls span {
    color: #252e6b;
    font-size: 18px;
    margin-right: 15px;
    font-weight: 400;
}

/* Custom Dropdown Styles */
.custom-select-wrapper {
    position: relative;
    display: inline-block;
    font-family: 'Lekton', monospace;
    font-size: 20px;
    color: #252e6b;
    z-index: 1000;
}

.custom-select-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 25px 2px 10px;
    font-weight: 400;
    cursor: pointer;
    border-bottom: 2px solid #252e6b;
    background: url("data:image/svg+xml;utf8,<svg viewBox='0 0 140 140' width='20' height='20' xmlns='http://www.w3.org/2000/svg'><g><polyline points='0,40 50,100 100,40' fill='none' stroke='rgb(37,46,107)' stroke-width='12px'/></g></svg>") no-repeat right 5px center;
    background-size: 14px;
    min-width: 320px;
    transition: all 150ms ease;
    text-align: center;
    box-sizing: border-box;
    white-space: nowrap;
    line-height: 1.4;
}

.trigger-text {
    position: absolute;
    left: 10px;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
}

.longest-option-ghost {
    visibility: hidden;
    pointer-events: none;
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    margin-top: 5px;
    background: #ffffff;
    border: 2px solid #252e6b;
    display: none;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    box-sizing: border-box;
}

.custom-select-wrapper.open .custom-select-options {
    display: flex;
}

.custom-option {
    padding: 10px 20px;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
    background: #ffffff;
    white-space: nowrap;
}

.custom-option:hover {
    background: #e6e6e6;
}

.custom-option.selected {
    background: #f0f0f0;
}

/* Subtitle removed as title is now all-caps and comprehensive */
.map-subtitle {
    display: none;
}

.chart-wrapper {
    flex-grow: 1;
    position: relative;
    padding: 0;
    /* Wall-to-wall */
    display: flex;
    flex-direction: column;
}

#chart {
    width: 100%;
    height: 100%;
    /* Removed min-height to ensure it fits in 100vh */
}

.map-footer {
    margin-top: 0;
    padding: 10px 40px 20px 40px;
    /* Reduced vertical spacing */
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: normal;
    color: #888;
    text-align: justify;
    flex-shrink: 0;
}

.tooltip {
    position: absolute;
    min-width: 280px;
    background: #ffffff;
    border: none;
    padding: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    pointer-events: none;
    z-index: 10000;
    font-family: 'Lekton', monospace;
    color: #252e6b;
    transition: opacity 0.15s ease-out;
}

/* Tooltip pointer (triangle at bottom) */
.tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: var(--pointer-left, 50%);
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffff;
}

.tooltip.flipped::after {
    top: -8px;
    bottom: auto;
    border-top: none;
    border-bottom: 8px solid #ffffff;
}

.tooltip-header {
    margin-bottom: 10px;
}

.tooltip-year {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 2px;
}

.tooltip-date,
.tooltip-total {
    font-size: 12px;
    margin-bottom: 3px;
    font-weight: 400;
}

.tooltip-date strong,
.tooltip-total strong {
    font-weight: 700;
}

.tooltip-chart {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.tooltip-row {
    display: flex;
    align-items: center;
    font-size: 11px;
}

.tooltip-label {
    width: 155px;
    color: #7277a0;
    white-space: nowrap;
}

.tooltip-bar-container {
    flex-grow: 1;
    height: 10px;
    background: transparent;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Start bars from left */
}

.tooltip-bar {
    height: 100%;
    transition: width 0.3s ease;
    margin-right: 5px;
    /* Fixed 5px distance to the value */
}

.tooltip-value {
    font-size: 11px;
    color: #252e6b;
    white-space: nowrap;
}

.y-axis .domain {
    display: none;
}

.tooltip strong {
    color: #252E6B;
}

/* D3 Styles */
.line {
    fill: none;
    stroke: #dbdbdb;
    stroke-width: 1.5px;
    transition: stroke-width 0.2s, opacity 0.2s;
}

.line:hover {
    stroke-width: 2.5px;
}

.area {
    fill: #dbdbdb;
    fill-opacity: 0.4;
    pointer-events: none;
}

.axis-label {
    font-family: 'Lekton', sans-serif;
    font-size: 12px;
    fill: #252E6B;
}

.grid line {
    stroke: #E6E6E6;
    stroke-opacity: 0.7;
    shape-rendering: crispEdges;
}

.grid path {
    stroke-width: 0;
}

/* Range-specific axis text styling */
.axis text {
    font-size: 14px !important;
    font-family: 'Lekton', sans-serif !important;
}

/* ========================================== */
/* Mobile Responsiveness                      */
/* ========================================== */
@media (max-width: 768px) {
    .top-controls span {
        font-size: 16px !important;
    }

    .custom-select-wrapper {
        font-size: 15px !important;
        min-width: 0 !important;
    }

    .custom-select-trigger {
        min-width: 0 !important;
        padding: 2px 25px 2px 10px;
    }

    .custom-option {
        font-size: 15px !important;
    }
}