@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap');

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: visible;
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Map page specific styles */
body.map-page {
    overflow-y: hidden;
}

/* About page specific styles */
body.about-page {
    overflow-y: auto;
}

#hero-bar {
    background: #08519c; /* This matches COST_BENEFIT_CONFIG highest benefit bucket */
    color: #fff;
    padding: 12px 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#hero-bar h1 {
    margin: 0;
    font-weight: 700;
    font-size: 24px;
    letter-spacing: -0.5px;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

#container {
    height: calc(100vh - 48px);
    position: relative;
    margin-top: 48px;
}

#controls {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 330px !important;
    max-width: 330px !important;
    z-index: 1000;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    /* Enable smooth scrolling */
    scroll-behavior: smooth;
    /* Ensure scrollable area is interactive */
    pointer-events: auto;
}


.control-group {
    margin: 0;
    padding: 6px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
    backdrop-filter: blur(12px);
}

.control-group h3 {
    margin: 0 0 6px 0;
    color: #1a202c;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.3px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    border-bottom: 2px solid rgba(26, 152, 80, 0.2);
    padding-bottom: 3px;
}

.opacity-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.opacity-control .label-text {
    min-width: 80px;
}

.opacity-control input[type="range"] {
    flex: 1;
    appearance: none;
    height: 6px;
    background: linear-gradient(to right, #e2e8f0, #08519c);
    border-radius: 3px;
    outline: none;
}

.opacity-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: #08519c;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.opacity-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #08519c;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.opacity-value {
    font-size: 12px;
    font-weight: 600;
    color: #08519c;
    min-width: 35px;
    text-align: right;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    color: #4a5568;
    font-weight: 500;
    font-size: 13px;
    gap: 4px;
}

/* Custom Tooltip Styles */
.label-text {
    cursor: help;
    position: relative;
}

.label-text:hover {
    color: #2d3748;
}

.control-group .label-text {
    cursor: help;
    position: relative;
}

.control-group .label-text:hover {
    color: #2d3748;
}

.label-text[data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 0px;
    background: rgba(26, 32, 44, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    width: 220px;
    text-align: left;
    z-index: 5000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: tooltipFadeIn 0.2s ease-out;
    margin-bottom: 5px;
}

/* Tooltip Arrow */
.label-text[data-tooltip]:hover::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 10px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(26, 32, 44, 0.95);
    z-index: 5000;
    animation: tooltipFadeIn 0.2s ease-out;
}

.control-group .label-text[data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 0px;
    background: rgba(26, 32, 44, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    width: 220px;
    text-align: left;
    z-index: 5000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: tooltipFadeIn 0.2s ease-out;
    margin-bottom: 5px;
}

/* Tooltip Arrow */
.control-group .label-text[data-tooltip]:hover::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 10px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(26, 32, 44, 0.95);
    z-index: 5000;
    animation: tooltipFadeIn 0.2s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.control-group input,
.control-group select {
    width: 140px;
    flex-shrink: 0;
    padding: 4px 6px;
    box-sizing: border-box;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    background: white;
    transition: all 0.2s ease;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #1a9850;
    box-shadow: 0 0 0 3px rgba(26, 152, 80, 0.1);
}

#analyzeBtn {
    width: 100%;
    padding: 10px 12px;
    background: linear-gradient(135deg, #1a9850 0%, #238b45 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    margin-top: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(26, 152, 80, 0.3);
    letter-spacing: 0.2px;
}

#analyzeBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(26, 152, 80, 0.4);
}

#analyzeBtn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#status {
    padding: 16px 20px;
    margin: 24px 0;
    border-radius: 12px;
    display: none !important; /* Always hidden */
    font-weight: 500;
    font-size: 14px;
}

#status.loading {
    display: block;
    background: rgba(255, 243, 205, 0.95);
    color: #856404;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

#status.error {
    display: block;
    background: rgba(248, 215, 218, 0.95);
    color: #721c24;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

#status.success {
    display: block;
    background: rgba(212, 237, 218, 0.95);
    color: #155724;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

#results p {
    margin: 6px 0;
    color: #4a5568;
    font-weight: 500;
    font-size: 16px;
    line-height: 1.4;
}

#results .label-text {
    font-weight: 600;
    color: #2d3748;
}

#map {
    width: 100%;
    height: 100%;
    position: relative;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 5px 0;
}

.legend-color {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 1px solid #ccc;
}

#map-legend {
    position: fixed;
    bottom: 20px;
    left: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    z-index: 1500;
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    align-items: center;
    gap: 20px;
}

#map-legend h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    letter-spacing: -0.3px;
    white-space: nowrap;
}

#map-legend .legend-item {
    display: flex;
    align-items: center;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    line-height: 1.5;
    white-space: nowrap;
}

#map-legend .legend-color {
    width: 20px;
    height: 20px;
    margin-right: 6px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

.legend-items {
    display: flex;
    gap: 16px;
}

/* Visualization toggle styles */
.visualization-toggle {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-label {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    margin-bottom: 0 !important;
}

.radio-label:hover {
    background-color: rgba(26, 152, 80, 0.05);
}

.radio-label input[type="radio"] {
    width: auto !important;
    margin-right: 8px;
    margin-bottom: 0;
}

.radio-label span {
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
}

.radio-label input[type="radio"]:checked + span {
    color: #1a9850;
    font-weight: 600;
}

/* mobile toggle button */
#mobile-controls-toggle {
    display: none;
    position: fixed;
    top: 90px;
    right: 10px;
    z-index: 1001;
    background: white;
    border: 2px solid #1a9850;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #1a9850;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* mobile responsive styles */
@media (max-width: 768px) {
    #hero-bar {
        padding: 8px 12px;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        height: 44px;
    }

    #hero-bar h1 {
        font-size: 16px;
        flex: 1;
    }

    #hero-bar nav {
        display: flex;
        gap: 8px;
    }

    .nav-link {
        font-size: 14px;
        padding: 4px 8px;
    }

    #container {
        height: calc(100vh - 44px);
        margin-top: 44px;
    }

    #mobile-controls-toggle {
        display: block;
    }

    #controls {
        position: fixed;
        top: 0;
        right: 0;
        left: auto;
        bottom: 0;
        width: 85% !important;
        max-width: 330px !important;
        max-height: 100vh;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        box-shadow: -4px 0 20px rgba(0,0,0,0.3);
        padding-top: 20px;
        overflow-y: scroll !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        background: white;
    }

    #controls.mobile-open {
        transform: translateX(0);
    }

    .control-group {
        padding: 10px;
    }

    .control-group h3 {
        font-size: 14px;
    }

    .control-group label {
        font-size: 13px;
    }

    .control-group input,
    .control-group select {
        width: 100px;
        font-size: 12px;
    }

    #analyzeBtn {
        font-size: 14px;
        padding: 12px;
    }

    #map-legend {
        position: fixed;
        bottom: 10px;
        left: 10px;
        right: auto;
        max-width: calc(100vw - 20px);
        padding: 6px 8px;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        font-size: 11px;
    }

    #map-legend h4 {
        font-size: 12px;
        margin: 0;
        flex-shrink: 0;
    }

    .legend-items {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        overflow-x: auto;
    }

    #map-legend .legend-item {
        font-size: 10px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    #map-legend .legend-color {
        width: 16px;
        height: 16px;
        margin-right: 4px;
    }

    #results p {
        font-size: 14px;
        margin: 6px 0;
    }

    /* hide tooltips on mobile (touch devices) */
    .label-text[data-tooltip]:hover::before,
    .label-text[data-tooltip]:hover::after,
    .control-group .label-text[data-tooltip]:hover::before,
    .control-group .label-text[data-tooltip]:hover::after {
        display: none;
    }
}

