body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    overflow: hidden;
}

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

/* --- Map Messages (No Results / Error) --- */
.map-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 999;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    text-align: center;
    font-weight: 500;
    color: #555;
}
.map-message.hidden {
    display: none;
}

/* --- Controls Container --- */
#map-controls-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    width: 108px; /* Width to hold two buttons side-by-side */
    height: 162px; /* Height for three rows of buttons */
}

/* --- Map Control Buttons --- */
.map-control-button {
    position: absolute; /* Each button is positioned within the container */
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}
.map-control-button:hover {
    transform: scale(1.1);
}

/* --- Individual Button Positions --- */
#about-button { top: 0; right: 0; }
#geolocation-button { top: 54px; right: 0; }
#filter-toggle { top: 108px; right: 0; }
#reset-button-map { top: 108px; right: 54px; } /* Positioned to the left of the filter toggle */


#reset-button-map.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.5);
}

#filter-toggle.active {
    background-color: rgba(0, 122, 255, 0.2);
}
#filter-toggle.active svg {
    fill: #007aff;
}

.map-control-button svg {
    width: 20px;
    height: 20px;
    fill: #333;
    transition: fill 0.3s ease;
}


/* --- Filter Controls --- */
#filter-container {
    position: absolute;
    bottom: 192px; /* Positioned above the controls container */
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    transform-origin: bottom right;
}

#filter-container.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95) translateY(10px);
}

.filter-control {
    display: flex;
    flex-direction: column;
}

.filter-control label {
    font-size: 12px;
    color: #333;
    margin-bottom: 5px;
    font-weight: 600;
}

.filter-control select,
.filter-control input {
    -webkit-appearance: none;
    appearance: none;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    width: 200px;
}

.filter-control select {
    padding-right: 30px;
    cursor: pointer;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007AFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.4-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 8px top 50%;
    background-size: .65em auto;
}

.filter-control input {
    width: 176px; /* Adjust for padding */
}

#reset-filters {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: #007aff;
    background-color: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease;
}

#reset-filters:hover {
    background-color: rgba(0, 122, 255, 0.1);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 600px) {
    #filter-container {
        width: calc(100% - 40px);
        top: 20px;
        right: 20px;
        left: 20px;
        bottom: auto; /* Reset bottom for mobile */
        max-height: calc(100% - 100px);
        overflow-y: auto;
    }

    #filter-container.hidden {
        transform: translateY(20px);
    }

    .filter-control select,
    .filter-control input {
        width: calc(100% - 24px);
    }
}


/* --- Marker & Popup Styles --- */
.custom-marker-icon .marker-pin {
    position: absolute;
    width: 30px;
    height: 30px;
    left: 50%;
    top: 50%;
    margin-left: -15px;
    margin-top: -30px; /* Position tip at anchor */
    background: #007aff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 1px solid white;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* --- Highlighted Marker Animation --- */
.marker-highlight .marker-pin {
    animation: pulse-marker 1.5s infinite;
}

@keyframes pulse-marker {
    0% {
        transform: rotate(-45deg) scale(1);
    }
    50% {
        transform: rotate(-45deg) scale(1.2);
    }
    100% {
        transform: rotate(-45deg) scale(1);
    }
}

.custom-marker-icon .marker-pin::after {
    content: none;
}
.custom-cluster {
    background-clip: padding-box;
    border-radius: 50%;
    color: #fff;
    font-weight: bold;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3);
}
.custom-cluster.small { background-color: rgba(29, 185, 84, 0.9); }
.custom-cluster.medium { background-color: rgba(240, 180, 0, 0.9); }
.custom-cluster.large { background-color: rgba(255, 70, 70, 0.9); }
.leaflet-popup-content-wrapper {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    padding: 1px;
}
.leaflet-popup-content {
    margin: 15px 20px !important;
    line-height: 1.5;
}
.leaflet-popup-tip {
    background: #ffffff;
    box-shadow: none;
}
.custom-popup a {
    color: #007aff;
    text-decoration: none;
}
.custom-popup a:hover {
    text-decoration: underline;
}
.custom-popup hr {
    border: none;
    height: 1px;
    background-color: #e5e5e5;
    margin: 10px 0;
}
.marker-cluster-spider-leg {
    display: none !important;
}

/* --- User Location Marker --- */
.user-location-marker .pulse {
    width: 20px;
    height: 20px;
    background: #007aff;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 0 rgba(0, 122, 255, 1);
    transform: scale(1);
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(0, 122, 255, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0);
    }
}

/* --- About Modal Styles --- */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.modal-container.hidden {
    opacity: 0;
    visibility: hidden;
}

.modal-content {
    background: #fff;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    max-width: 500px;
    width: 90%;
    position: relative;
    line-height: 1.6;
    transform: scale(1);
    transition: transform 0.3s ease;
}

.modal-container.hidden .modal-content {
    transform: scale(0.95);
}

.modal-content h2 {
    margin-top: 0;
    color: #333;
}

.modal-content p {
    color: #555;
}

.modal-content a {
    color: #007aff;
    font-weight: 600;
    text-decoration: none;
}

.modal-content a:hover {
    text-decoration: underline;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 28px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
}

.close-button:hover {
    color: #333;
}
