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;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.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;
    gap: 30px;
}

.select-row {
    display: flex;
    align-items: center;
    gap: 30px;
}

.toggle-container {
    display: flex;
    border: 1.5px solid #252e6b;
    border-radius: 4px;
    overflow: hidden;
}

.toggle-btn {
    padding: 5px 15px;
    border: none;
    background: #252e6b;
    color: #fff;
    font-family: 'Lekton', monospace;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
}

.toggle-btn.active {
    background: #fff;
    color: #252e6b;
}

.select-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.select-group span {
    color: #252e6b;
    font-size: 18px;
    font-weight: 400;
}

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

.custom-select-trigger {
    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: auto;
    transition: all 150ms ease;
    text-align: center;
    box-sizing: border-box;
    white-space: nowrap;
    display: inline-block;
    line-height: 1.4;
}

.trigger-text {
    position: absolute;
    left: 10px;
    right: 25px;
    /* leave space for chevron */
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    pointer-events: none;
}

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

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 100%;
    width: max-content;
    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;
    max-height: 300px;
    overflow-y: auto;
}

.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;
    color: #252e6b;
}

.chart-wrapper {
    flex-grow: 1;
    position: relative;
    padding: 0;
    display: flex;
    flex-direction: column;
}

#chart {
    width: 100%;
    height: 100%;
}

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

.tooltip {
    position: absolute;
    min-width: 120px;
    background: #ffffff;
    border: none;
    padding: 8px 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::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;
}

.tooltip-bar {
    height: 100%;
    transition: width 0.3s ease;
    margin-right: 5px;
}

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

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

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

.grid path {
    stroke-width: 0;
}

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

.label-connection {
    stroke-width: 1px;
}

.label-text {
    font-size: 14px;
}

/* ========================================== */
/* Mobile Responsiveness                      */
/* ========================================== */
@media (max-width: 768px) {
    .container {
        height: 100dvh;
        /* Fill viewport height exactly on mobile */
        overflow: hidden;
        min-height: unset;
    }

    .map-title {
        padding: 10px 10px 5px 10px;
    }

    .top-controls {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        padding: 5px 10px 10px 10px;
    }

    .toggle-row {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .toggle-container {
        width: auto;
        margin-bottom: 5px;
    }

    .toggle-btn {
        font-size: 15px;
        padding: 5px 12px;
    }

    .select-row {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 15px;
        width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    #year-select-container .custom-select-wrapper {
        z-index: 1010;
    }

    .select-group {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        width: auto;
    }

    .select-group span {
        font-size: 16px;
        white-space: nowrap;
    }

    .custom-select-wrapper {
        width: auto;
        min-width: 130px;
        font-size: 15px;
    }

    .custom-select-trigger {
        width: 100%;
        padding: 2px 25px 2px 10px;
    }

    .chart-wrapper {
        flex: 1;
        min-height: 0;
        height: auto;
        width: 100%;
    }

    /* Make labels smaller to fit */
    .line-label {
        font-size: 10px !important;
    }

    .axis text {
        font-size: 11px !important;
    }

    .map-footer {
        padding: 5px 15px 10px 15px;
        text-align: left;
        font-size: 11px;
        margin-top: 5px;
    }

    .tooltip {
        min-width: 150px;
        padding: 6px;
    }

    .tooltip-label {
        width: 100px;
    }
}