:root {
    --primary-color: #00007F;
    --secondary-color: #31D300;
    --accent-color: #e74c3c;
    --light-bg: #f8f9fa;
    --dark-text: #2c3e50;
    --light-text: #ecf0f1;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* =============================================
   BASE STYLES
   ============================================= */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7f9;
    color: #333;
    line-height: 1.6;
}

.h4, h4 {
    font-size: 1rem;
}

/* =============================================
   LAYOUT STRUCTURE - MOBILE FIRST
   ============================================= */
.main-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    position: relative;
}

.map-container {
    position: relative;
    height: 40vh;
    flex: 0 0 auto;
    transition: all 0.3s ease;
}

#map {
    width: 100%;
    height: 100%;
}

#menu-toggle {
        display: block !important;
}
.property-container {
    border-top: 3px solid var(--primary-color);
    flex: 0 0 60vh;
    transition: all 0.3s ease;
    background-color: var(--light-bg);
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.5);
    z-index: 100;
    position: relative;
    padding: 0;
    overflow-y: auto;
    overflow-x: visible;
}

.filter-btn.active {
    background-color: #198754 !important;
    border-color: #198754 !important;
    color: white !important;
}

.filter-btn:not(.active) {
    background-color: transparent !important;
    color: #6c757d !important;
    border-color: #6c757d !important;
}

.filter-btn:not(.active):hover {
    background-color: #6c757d !important;
    color: white !important;
}

/* =============================================
   PROPERTY FOOTER
   ============================================= */
.property-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background:var(--primary-color);
    border-top: 1px solid #e0e0e0;
    padding: 0px 20px;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--light-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: var(--dark-text);
    text-decoration: underline;
}

/* =============================================
   FILTER SECTION
   ============================================= */
.filter-section {
    text-align: center;
    margin-bottom: 1.5rem;
    /* padding: 10px; */
    /* START OF NEW/MODIFIED STYLES */
    position: sticky; /* Make it sticky */
    top: 0; /* Stick to the top of the scrollable container */
    background-color: var(--light-bg); /* Ensure it has a background so content doesn't show through */
    z-index: 150; /* Higher z-index to overlap scrolling content */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Optional: Add a subtle shadow to lift it */
    /* END OF NEW/MODIFIED STYLES */
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.5);
}

.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 10px 0 ;
}

.filter-btn {
    padding: 0.3rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.filter-btn.active {
    background-color: var(--primary-color);
    border-color: var(--dark-text);
}

.search-container {
    width: 90%;
    padding-bottom: 10px;
}
#search-input {
    font-size: 12px !important; /* Consistent font size */
    padding: 0px 23px !important; /* Add some padding for better touch targets */
}

#filter-bar-toggle {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #555;
    cursor: pointer;
    z-index: 1001;
    background: white;
    border: none;
    padding: 1;
    border-radius: 3px;
}

.search-icon {
    cursor: pointer;
    transition: color 0.3s ease;
}

.search-icon:hover {
    color: #007bff;
}

.search-icon.searching {
    color: #28a745;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* =============================================
   PROPERTY LISTINGS
   ============================================= */
.property-listings {
    margin-top: 1.5rem;
    padding: 15px 20px 60px;
        min-height: 350px;
}

.property-scroll-container {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding: 0.5rem;
    scrollbar-width: thin;
    -ms-overflow-style: none;
}

.property-scroll-container::-webkit-scrollbar {
    height: 6px;
}

.property-scroll-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* Load More Button Styles */
.load-more-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    margin: 20px 0;
}

.load-more-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 25px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.load-more-message {
    margin-top: 10px;
    font-size: 14px;
    color: #6c757d;
    text-align: center;
}

/* Hide load more when no more results */
.load-more-container.hidden {
    display: none;
}

.property-item {
    flex: 0 0 auto;
    width: 300px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 2px 5px 0 rgba(0, 0, 0, 0.19);
    transition: transform 0.3s ease;
    background: white;
    margin-top: 10px;
    position: relative;
}

.property-item:hover {
    transform: translateY(-3px);
}

.property-image-container {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.property-badge {
    position: absolute;
    right: 0px;
    color: white;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-size: 0.7rem;
    background: #ff7300;
}

.property-content {
    padding: 0.8rem;
}

.property-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--dark-text);
}

.property-type {
    font-size: 1rem;
    padding: 10px 0;
}

.property-features {
    display: flex;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #727272;
    align-items: center;
}

.property-price {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.3rem;
}

.property-actions {
    display: flex;
    gap: 0.5rem;
}

.property-action-btn {
    padding: 6px 10px;
    font-size: 14px;
    min-width: unset;
}

.company-logo-container {
    position: absolute;
    bottom: -5px;
    right: 15px;
    width: 80px;
    height: 80px;
    overflow: hidden;
    z-index: 10;
}

.company-logo-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}


/* =============================================
   UTILITY CLASSES
   ============================================= */
.hidden-btn { display: none; }
.text-center { text-align: center; }
.mb-3 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.spinner-border {
    width: 2rem;
    height: 2rem;
    border-width: 0.2em;
}

/* =============================================
   MOBILE STYLES (MAX-WIDTH: 767px)
   ============================================= */
@media (max-width: 767px) {
    .h4, h4 {
            font-size: .8rem;
        }

    .map-container {
        height: 40vh;
        flex: 1;
    }

    
    .property-content {
        padding: 0.5rem;
    }

    .property-container.collapsed {
        height: 0;
        flex: 0 0 0;
        overflow: hidden;
    }

    .property-container.collapsed ~ .map-container {
        height: 100vh;
        flex: 1 0 100vh;
    }

    .property-toggle {
        position: sticky;
        top: -25px;
        left: 50%;
        transform: translateX(-50%);
        width: 60px;
        height: 25px;
        background-color: var(--primary-color);
        border-radius: 20px 20px 0 0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        cursor: pointer;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
        border: none;
        outline: none;
        margin-top: -25px;
    }

    .property-scroll-container {
        flex-direction: row;
        overflow-x: auto;
        padding: 0;
    }

    .filter-section {
        margin-bottom: 0.5rem;
        /* padding: 10px 10px 0; */
    }

    .filter-section h5 {
        font-size: 1rem;
        padding: 0.5rem;
        margin: 0 !important;
    }

    .filter-section .btn {
        padding: 0.2rem 1rem;
        font-size: 0.8rem;
    }

    .property-image-container {
        height: 150px;
    }

    .property-title {
        display: none;
    }

    .property-actions a {
        padding: 8px;
        font-size: 14px;
        min-width: auto;
    }

    .property-listings {
        margin-top: 0;
        padding: 0 10px 50px;
    }

    .property-price {
        font-size: .7rem;
    }

    .property-item {
        width: 220px;
        margin-top: 0;
        margin-left: 10px;
    }

    .company-logo-container {
        bottom: 160px;
    }

    .property-footer {
        padding: 0px 10px;
    }

    .footer-links {
        gap: 1rem;
    }

    .footer-link {
        font-size: 0.8rem;
    }

    #tools-toolbar,
    .tools-toolbar {
        display: none;
    }

    
    
    /* Update the base class to enable transitions */
    .filter-buttons {
        display: flex; /* Keep existing display mode */
        justify-content: center;
        gap: 0.5rem;
        flex-wrap: wrap;
        padding: 6px;
        
        /* ADD/MODIFY THESE LINES FOR TRANSITION SETUP */
        max-height: 100px; /* Set a value large enough for the content to fully show */
        opacity: 1;
        overflow: hidden; /* Important to hide content that exceeds max-height */
        transition: max-height 0.35s ease-in-out, opacity 0.35s ease-in-out, padding 0.35s ease-in-out;
    }

    /* Add a class to hide the filter buttons with a smooth transition */
    .filter-buttons.hidden {
        /* Set max-height to 0 to collapse the element */
        max-height: 0;
        /* Set opacity to 0 for a fade-out effect */
        opacity: 0;
        /* Remove vertical padding to complete the "slide up" effect */
        padding-top: 0;
        padding-bottom: 0;
        /* We still use display: none; but only AFTER the transition to remove it from document flow */
        /* This will be handled by JavaScript for reliability, but keep this for fallback */
        /* If you were using pure CSS, you'd add: visibility: hidden; */
    }
}

/* =============================================
   DESKTOP STYLES (MIN-WIDTH: 768px)
   ============================================= */
@media (min-width: 768px) {
    .main-container {
        flex-direction: row;
    }

    .map-container {
        flex: 0 0 60%;
        height: 100%;
    }

    .property-container {
        flex: 0 0 40%;
        border-left: 1px solid #ddd;
        border-top: 5px solid var(--primary-color);
        height: 100%;
        overflow-y: auto;
    }

    .property-toggle {
        display: none;
    }

    .property-scroll-container {
        flex-direction: column;
        overflow-x: visible;
        gap: 1.5rem;
    }

    .property-item {
        width: 98%;
        display: flex;
        max-height: 200px;
        flex-direction: row;
        margin: 10px 0;
    }

    .property-image-container {
        flex: 0 0 200px;
        height: 200px;
    }

    .property-content {
        width: 70%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    #sidebar-logo {
        display: block;
    }

}

/* =============================================
   TABLET OPTIMIZATIONS (768px - 1024px)
   ============================================= */
@media (min-width: 768px) and (max-width: 1024px) {

    .filter-section h5 {
        font-size: 1rem;
    }

    .filter-buttons {
        gap: 0.75rem;
        /* margin: 10px 0 0; */
    }

    .filter-btn {
        padding: 0 10px;
        border-radius: 15px;
        font-size: 1rem;
    }

    .search-container {
        width: 90%;
    }

    .property-title {
        display: none;
    }

    .property-type {
        font-size: 0.9rem;
    }

    .info-icon-link {
        display: none;
    }
}

/* =============================================
   MEDIUM SCREENS (1024px - 1279px)
   ============================================= */
@media (min-width: 1024px) and (max-width: 1279px) {
    .property-item {
        flex-direction: row;
        max-height: 200px;
        width: 98%;
    }

    .property-image-container {
        flex: 0 0 180px;
        height: 200px;
    }

    .property-content {
        width: 70%;
    }

    .info-icon-link {
        display: none;
    }
}

/* =============================================
   LARGE SCREENS (1280px AND UP)
   ============================================= */
@media (min-width: 1280px) {
    .property-image-container {
        flex: 0 0 40%;
        height: 200px;
    }

    .property-item {
        flex: 1;
        width: auto;
        flex-direction: row;
    }

    .property-content {
        flex: 1;
    }

    .property-type {
        font-size: 1rem;
    }

    .info-icon-link {
        display: none;
    }
}

/* =============================================
   EXTRA LARGE SCREENS (1600px AND UP)
   ============================================= */
@media (min-width: 1600px) {
    .property-actions a:nth-child(-n+2) i {
        margin: 0 10px;
    }

    .company-logo-container {
        bottom: -5px;
        right: 15px;
    }

    .info-icon-link {
        display: block;
    }
}

/* =============================================
   NAVBAR STYLES
   ============================================= */
.navbar-toggler {
    border: none;
    outline: none;
    padding: 0.2rem 0.3rem;
    background-color: #fff;
    border-radius: 5px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    margin-left: -13px;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-toggler:hover {
    background-color: #f1f1f1;
}

.navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #fff;
    padding: 1rem;
    border-top: 1px solid #ddd;
    z-index: 1100;
}

@media (min-width: 992px) {
    .navbar-collapse {
        position: static;
        width: auto;
        background-color: transparent;
        border-top: none;
        padding: 0;
    }
}

/* listing header styles */


.listing-header {
    color: white;
    padding: 0 .5rem;
    border-radius: 12px;
    color: var(--dark-text);
}

.listing-header h4 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.listing-header .text-muted {
    margin-bottom: 0;
}


/* =============================================
   LOAD MORE BUTTON STYLES FOR ALL SCREENS
   ============================================= */

/* Base styles for load more button wrapper */
.load-more-wrapper-inside {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

#load-more-btn-inside {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 25px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #0000FF 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    transition: all 0.3s ease;
}

#load-more-btn-inside:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#load-more-btn-inside:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* No more results message */
.no-more-results {
    padding: 20px;
    color: #6c757d;
    font-size: 0.9rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.no-more-results i {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: #28a745;
}

/* =============================================
   MOBILE STYLES (MAX-WIDTH: 767px)
   ============================================= */
@media (max-width: 767px) {
    .load-more-wrapper-inside {
        flex: 0 0 auto;
        width: 220px;
        /* height: 120px; */
        display: flex;
        align-items: center;
    }
    
    #load-more-btn-inside {
        min-width: 200px;
    }
    
    .no-more-results {
        flex: 0 0 auto;
        width: 220px;

    }
    .property-type {
    padding: 0 !important;
    }
}

/* =============================================
   DESKTOP STYLES (MIN-WIDTH: 768px)
   ============================================= */
@media (min-width: 768px) {
    .load-more-wrapper-inside {
        width: 100%;
        margin: 20px 0;
        padding: 20px;
    }
    
    #load-more-btn-inside {
        min-width: 250px;
        font-size: 16px;
        padding: 15px 30px;
    }
    
    .no-more-results {
        width: 100%;
        margin: 20px 0;
        padding: 30px 20px;
        font-size: 1rem;
    }
    
    .no-more-results i {
        font-size: 2rem;
    }
}

/* =============================================
   ANIMATION STYLES
   ============================================= */

/* Fade-in animation for new properties */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation classes */
.property-item.fade-in {
    animation: fadeInUp 0.5s ease-out forwards;
}

.property-item.fade-in-scale {
    animation: fadeInScale 0.4s ease-out forwards;
}

/* For mobile horizontal layout */
@media (max-width: 767px) {
    .property-item.fade-in {
        animation: fadeInScale 0.4s ease-out forwards;
    }
}

/* For initial page load - stagger the animations */
.property-item.initial-load {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Stagger delays for initial load */
.property-item.initial-load:nth-child(1) { animation-delay: 0.1s; }
.property-item.initial-load:nth-child(2) { animation-delay: 0.2s; }
.property-item.initial-load:nth-child(3) { animation-delay: 0.3s; }
.property-item.initial-load:nth-child(4) { animation-delay: 0.4s; }
.property-item.initial-load:nth-child(5) { animation-delay: 0.5s; }
.property-item.initial-load:nth-child(6) { animation-delay: 0.6s; }

/* Loading state for smooth transitions */
.property-item {
    opacity: 1;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Ensure smooth scrolling when new items are added */
.property-scroll-container {
    scroll-behavior: smooth;
}

/* Add to your existing CSS */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Loading spinner for button */
.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}




/* =============================================
   SEARCH INPUT FIXES FOR MOBILE KEYBOARD
   ============================================= */
.search-container {
    position: relative;
    z-index: 1000;
}

#search-input {
    font-size: 16px !important; /* Prevent zoom on iOS */
    transform: translateZ(0); /* Hardware acceleration */
}

/* When keyboard is active */
.keyboard-active .property-container {
    transform: translateY(0) !important; /* Prevent container from moving */
}

.keyboard-active .map-container {
    height: 30vh !important; /* Reduce map height when keyboard is visible */
    flex: 0 0 30vh !important;
}

/* =============================================
   TOGGLE BUTTON ENHANCEMENTS
   ============================================= */
.property-toggle {
    position: sticky;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 25px;
    background-color: var(--primary-color);
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    z-index: 1001; /* Higher z-index to ensure visibility */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    border: none;
    outline: none;
    margin-top: -25px;
}

/* Ensure toggle button is always visible */
.property-toggle:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* =============================================
   MOBILE SPECIFIC FIXES
   ============================================= */
@media (max-width: 767px) {
    .main-container {
        height: 100dvh;
        position: fixed;
    }
    
    .map-container {
        height: 40dvh;
        flex: 0 0 40dvh;
    }
    
    .property-container {
        height: 60dvh;
        flex: 0 0 60dvh;
    }
    
    .property-container.collapsed {
        height: 0 !important;
        flex: 0 0 0 !important;
        overflow: hidden;
    }
    
    .map-container.fullscreen {
        height: 100dvh !important;
        flex: 1 0 100dvh !important;
    }
    
    /* Prevent layout shift when keyboard appears */
    .search-container.active {
        position: relative;
        z-index: 1002;
    }
    
    /* Adjust filter section when keyboard is active */
    .keyboard-active .filter-section {
        position: relative;
        top: 0;
    }
}

/* Add to your CSS */
:root {
    --window-height: 100vh;
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .main-container {
        height: var(--window-height, 100vh);
    }
    
    .map-container,
    .property-container {
        transition: none; /* Disable transitions on iOS for better performance */
    }
    
    /* Prevent elastic scrolling on main container */
    .main-container {
        -webkit-overflow-scrolling: touch;
        overflow: hidden;
    }
    
    .property-container {
        -webkit-overflow-scrolling: touch;
    }
}