/* Global scrollbar styles */
html, body {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

html::-webkit-scrollbar, body::-webkit-scrollbar, #results-section::-webkit-scrollbar {
    width: 8px;
}

html::-webkit-scrollbar-track, body::-webkit-scrollbar-track, #results-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 8px;
}

html::-webkit-scrollbar-thumb, body::-webkit-scrollbar-thumb, #results-section::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 8px;
}

html::-webkit-scrollbar-thumb:hover, body::-webkit-scrollbar-thumb:hover, #results-section::-webkit-scrollbar-thumb:hover {
    background: #555;
}

body {
    min-height: auto !important;
}

.container {
    display: flex;
    flex-wrap: nowrap;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0;
    padding: 0;
    height: 87vh;
    overflow: hidden;
    box-sizing: border-box;
    border-top: 1px solid #ccc;
    flex-direction: column;
}

#map-section {
    flex: 0 1 65%;
    position: relative;
    overflow: hidden;
    height: 100%;
    box-sizing: border-box;
}

#results-section {
    flex: 0 1 35%;
    overflow-y: auto;
    padding-right: 10px;
    scroll-behavior: smooth;
    height: 100%;
    box-sizing: border-box;
    box-shadow: -10px 0 15px -5px rgba(0, 0, 0, 0.75);
    background-color: #fff;
    z-index: 10;
}

#closest-results {
    display: grid;
    gap: 20px;
    width: 100%;
}

@media (min-width: 768px) and (max-width: 1349px) {
    .container {
        flex-direction: row;
    }

    #closest-results {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1350px) {
    .container {
        flex-direction: row;
    }

    #closest-results {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .container {
        flex-direction: column;
        height: 82vh; /* Set to full viewport height */
    }

    #map-section {
        flex: 1;
        height: 50vh; /* Adjust height as needed */
    }

    #results-section {
        display: none; /* Hide the results section */
    }
}

.result-card {
    display: flex;
    flex-direction: column;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    background-color: #fff;
}

.result-card:hover {
    transform: scale(1.05);
}

.result-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.result-card .image-section {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.result-card .details-section {
    padding: 10px;
}

.result-card .details-section h3 {
    margin: 0;
    font-size: 1.5em;
    color: #333;
}

.result-card .details-section p {
    margin: 5px 0;
    font-size: 1em;
    color: #777;
}

.result-card .details-section .price {
    font-size: 1.5em;
    color: #000;
}

.result-card .details-section .property-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.result-card .details-section .property-details span {
    font-size: 1em;
    color: #777;
}

.result-card .details-section .address {
    font-size: 1em;
    color: #777;
}

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

#geolocation-post-count {
    margin-top: 10px;
}

#custom-popup {
    display: none;
    position: absolute;
    z-index: 1000;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

#map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.1);
    background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.1) 50%);
    background-size: 200% 200%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -100% 0;
    }
    100% {
        background-position: 100% 0;
    }
}

#search-here {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 1001; /* Adjust this as needed */
    background-color: white;
    border: 1px solid #ccc;
    padding: 5px 10px;
    cursor: pointer;
}

.modal-active #search-here {
    z-index: 999; /* Lower z-index when modal is active */
}

.custom-marker-icon.rise {
    transform: translateY(-10px);
}

.custom-marker-icon.green rect {
    fill: #32CD32;
}

.slider-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.slider-wrapper {
    display: flex;
    transition: transform 0.5s ease;
    height: 100%;
}

.slider-slide {
    min-width: 100%;
    box-sizing: border-box;
    height: 100%;
}

.slider-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slider-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
}

.slider-button.prev {
    left: 10px;
}

.slider-button.next {
    right: 10px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) { /* Adjust the width as needed for your mobile view breakpoint */
    .modal {
        width: 100%;
    }
}


.modal-content {
    background-color: #fefefe;
    margin: 3% auto;
    padding: 1px;
    border: 1px solid #888;
    width: 80%;
    height: 89vh;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    overflow: auto;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        height: 95vh;
    }

    .modal-content iframe {
        height: calc(100% - 60px); /* Adjust height for mobile view */
    }
}

.modal-content iframe {
    width: 100%;
    height: calc(100% - 40px); /* Adjust height to account for padding */
}

.close {
    cursor: pointer;
    font-size: 16px;
    color: #000;
    margin-bottom: 10px;
    display: inline-block;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#geolocation-search-container {
    max-width: 65%;
    overflow-x: visible;
    position: relative;
    background: white;
}

@media (max-width: 1024px) {
    #geolocation-search-container {
        max-width: 80%;
    }
}

@media (max-width: 768px) {
    #geolocation-search-container {
        max-width: 100%;
    }
}

#geolocation-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    background: white;
    padding: 0px;
    border-radius: 10px;
    box-sizing: border-box;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    align-items: center;
    position: relative;
}

#geolocation-search-form::before,
#geolocation-search-form::after {
    content: '';
    position: absolute;
    left: -50vw; /* Extend past the left edge of the page */
    right: -50vw; /* Extend past the right edge of the page */
    width: 200vw; /* Full viewport width plus the overflow */
    height: 1px;
    background: #ccc;
}

#geolocation-search-form::before {
    top: 0; /* Position at the top of the form */
}

#geolocation-search-form::after {
    bottom: 0; /* Position at the bottom of the form */
}

.form-field {
    flex: 1 1 15%; /* 15% width with flex-grow and flex-shrink */
}

.form-field label {
    display: none; /* Hide all labels by default */
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    height: 40px; /* Fixed height for input and select */
    background: white;
}

#beds-baths-field {
    position: relative;
    flex: 1 1 15%; /* 15% width with flex-grow and flex-shrink */
}

#beds-baths-dropdown {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    height: 40px; /* Fixed height for dropdown */
}

#beds-baths-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

#more-filters-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

#more-filters-popup label {
    display: block; /* Ensure labels are displayed in the popup */
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.bedroom-btn,
.bathroom-btn,
.bedroom-btn-popup,
.bathroom-btn-popup {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    height: 40px; /* Fixed height for buttons */
}

.bedroom-btn.active,
.bathroom-btn.active,
.bedroom-btn-popup.active,
.bathroom-btn-popup.active {
    background-color: #ccc;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: #aaa;
}

#results-section {
    flex: 1;
    overflow-y: auto;
}

#show-more-fields-btn {
    background: white;
    color: #000;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    display: none; /* Hide by default */
    height: 40px; /* Fixed height for button */
    padding: 8px; /* Matching padding to other fields */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex: 1 1 15%; /* 15% width with flex-grow and flex-shrink */
}

@media (max-width: 1024px) {
    .optional-field {
        display: none;
    }

    .mandatory-field {
        display: flex;
    }

    #show-more-fields-btn {
        display: block;
    }
}

@media (max-width: 768px) {
    #geolocation-search-form {
        flex-direction: column;
    }

    #geolocation-search-form > .form-field {
        width: 100%;
        margin-bottom: 10px;
    }

    .mandatory-field {
        display: flex;
    }

    .optional-field {
        display: none;
    }

    #show-more-fields-btn {
        display: block;
    }

    #map-section, #results-section {
        height: auto; /* Ensure both sections are displayed correctly */
        width: 100%;
    }
}

.optional-field.show-label label {
    display: block; /* Show labels when "Show More Filters" is selected */
}

@media (min-width: 1024px) {
    #beds-baths-options label {
        display: block; /* Ensure labels are displayed in beds-baths-options on desktop view */
    }
}

.back-to-search {
    cursor: pointer;
    font-size: 16px;
    color: #000;
    margin-bottom: 10px;
    display: inline-block;
}

body.dark-mode .button.view-listing {
    background-color: #2a2a2a; /* Match the dark mode background */
    color: white; /* White text color */
    border: 1px solid white; /* White border */
}

body.dark-mode .button.view-listing:hover {
    background-color: #353535; /* Slightly lighter background on hover */
    color: white; /* Ensure text color remains white on hover */
    border-color: #e0e0e0; /* Slightly lighter border on hover */
}