body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    /* Stacks top bar above main content */
    height: 100vh;
    font-family: Arial, sans-serif;
    color: #333;
}

/* --- Top Filter Bar --- */
#top-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background-color: #f9f9f9;
    border-bottom: 2px solid #ddd;
}

.filter-input,
.custom-dropdown {
    border: 2px solid #66b2a0;
    /* Teal from mockup */
    border-radius: 6px;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: bold;
    color: #444;
    background: white;
    cursor: pointer;
}

.filter-input:focus {
    outline: none;
    border-color: #3b8273;
}

#btn-reset {
    background-color: #66b2a0;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    width: auto;
    margin: 0;
}

#btn-reset:hover {
    background-color: #3b8273;
}

/* Custom Checkbox Dropdowns */
.custom-dropdown {
    position: relative;
    padding: 0;
    width: 220px;
    user-select: none;
}

.dropdown-header {
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
}

.dropdown-list {
    position: absolute;
    top: 100%;
    left: -2px;
    right: -2px;
    background: white;
    border: 2px solid #66b2a0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 2000;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dropdown-list label {
    display: block;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: normal;
}

.dropdown-list label:hover {
    background-color: #f0f7f5;
}

.dropdown-list input[type="checkbox"] {
    margin-right: 10px;
    accent-color: #66b2a0;
}

/* --- Main Layout --- */
#main-content {
    display: flex;
    flex: 1;
    /* Takes up remaining height */
    overflow: hidden;
}

#map-container {
    width: 50%;
    height: 100%;
    border-right: 4px solid #000;
}

#map {
    width: 100%;
    height: 100%;
    background-color: #e0eaf5;
}

#info-panel {
    width: 50%;
    height: 100%;
    padding: 40px;
    box-sizing: border-box;
    overflow-y: auto;
    background-color: #fff;
}

.hidden {
    display: none !important;
}

h1 {
    margin-top: 0;
    font-size: 28px;
}

h2 {
    color: #555;
    font-weight: normal;
}

#subsidy-status-summary {
    font-size: 18px;
    margin-bottom: 30px;
}

#action-buttons {
    margin-top: 30px;
    text-align: center;
}

button {
    background-color: #333;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    width: 100%;
    margin-bottom: 10px;
}

button:hover {
    background-color: #000;
}

.subsidy-card {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    /* Soft shadow */
    border: 1px solid #eaeaea;
    border-left: 5px solid #66b2a0;
    /* Teal accent line on the left */
    padding: 25px;
    margin-bottom: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.subsidy-card:hover {
    transform: translateY(-2px);
    /* Slight lift on hover */
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.subsidy-card h3 {
    margin-top: 0;
    color: #2c3e50;
    display: flex;
    align-items: center;
    font-size: 20px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.subsidy-card p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #f0f7f5;
    color: #66b2a0;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    border: 1px solid #66b2a0;
    margin-top: 15px;
    transition: all 0.2s;
}

.btn-link:hover {
    background-color: #66b2a0;
    color: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 13px;
}

th,
td {
    padding: 10px;
    text-align: left;
    border: 1px solid #ddd;
}

th {
    background-color: #5ab1bb;
    color: white;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

.col-yes {
    background-color: #8bc34a;
    color: white;
    text-align: center;
    font-weight: bold;
}

.city-pin {
    background-color: #4caf50;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.city-pin:hover {
    transform: scale(1.7);
    cursor: pointer;
}

.city-pin.active {
    background-color: #0ffff3;
    border-color: #333;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
    transform: scale(2);
    z-index: 1000 !important;
}
.city-pin.past {
    background-color: #ffeb3b !important;
    border-color: #999 !important;
}
/* --- AI Chatbot Widget --- */
#chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: Arial, sans-serif;
}

#btn-chat-toggle {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: 0.2s;
}

#btn-chat-toggle:hover {
    background: #1a252f;
    transform: translateY(-2px);
}

#chat-window {
    width: 350px;
    height: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 60px;
    right: 0;
    border: 1px solid #ddd;
}

#chat-header {
    background: #66b2a0;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #4ca08c;
}

#btn-chat-close {
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

#btn-chat-close:hover {
    color: #e0e0e0;
}

#chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f9f9f9;
}

.msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
}

.bot-msg {
    background: #e0f2f1;
    color: #004d40;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.user-msg {
    background: #2c3e50;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.loading-msg {
    font-style: italic;
    color: #888;
    font-size: 13px;
    align-self: flex-start;
}

#chat-input-area {
    display: flex;
    padding: 10px;
    background: white;
    border-top: 1px solid #eee;
}

#chat-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

#btn-chat-send {
    background: #66b2a0;
    color: white;
    border: none;
    padding: 0 15px;
    margin-left: 8px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

#btn-chat-send:hover {
    background: #4ca08c;
}
.info.legend {
    pointer-events: none !important;
    /* Lets you click the map underneath */
    transition: opacity 0.3s ease;
    /* Makes the fade-out smooth */
    opacity: 1;
    /* Fully visible by default */
}

@media (max-width: 800px) {
    #chat-widget {
        bottom: 10px;
        right: 10px;
    }

    #chat-window {
        width: calc(100vw - 20px);
        height: 400px;
        bottom: 50px;
        right: 0;
    }
}
@media (max-width: 800px) {

    /* 1. Unlock the body so the whole page scrolls naturally */
    body {
        height: auto;
        overflow-y: auto;
    }

    /* 2. Stack the Top Bar Filters */
    #top-bar {
        flex-wrap: wrap;
        padding: 10px;
    }

    .filter-input,
    .custom-dropdown,
    #btn-reset {
        flex: 1 1 45%;
        width: auto;
    }

    #btn-reset {
        flex: 1 1 100%;
    }

    /* 3. Stack the Map and Info Panel */
    #main-content {
        flex-direction: column;
        overflow: visible;
        /* Allow it to grow */
        height: auto;
    }

    #map-container {
        width: 100%;
        height: 400px;
        /* Fixed height so the map is always usable */
        min-height: 400px;
        border-right: none;
        border-bottom: 4px solid #000;
    }

    #info-panel {
        width: 100%;
        height: auto;
        /* Let the box grow as tall as it needs! */
        overflow-y: visible;
        /* Disable the tiny inner scrollbar */
        padding: 20px;
    }

    /* 4. Adjust Panel Fonts for Small Screens */
    .subsidy-card {
        padding: 15px;
    }

    .subsidy-card h3 {
        font-size: 18px;
    }

    table th,
    table td {
        padding: 8px;
        font-size: 13px;
    }
}