/* Property Page Layout */
.property-page-container {
    display: flex;
    height: 100vh;
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

.property-sidebar {
    width: 25%;
    background: #fff;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: flex;
    flex-direction: column;
}

.property-map-container {
    width: 65%;
    position: relative;
}

/* Property Address Section */
.property-address-section {
    padding: 30px 25px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
    color: #333;
}

.property-address {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.3;
    font-family: 'Lato', Arial, sans-serif;
}

/* Content sections below the main property container */
@media screen and (min-width: 769px) {
    .description-container {
        padding-top: 40px;
    }
}

.theme-container {
    padding-top: 40px;

}


.theme-container,
.copyright-container {
    width: 100%;
    background: #fff;
}

.description-container .container-fluid,
.theme-container .container-fluid {
    max-width: 1024px;
    margin: 0 auto;
}

.description-container h2,
.theme-container h2 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    font-family: 'Lato', Arial, sans-serif;
    margin: 0 0 20px 0;
}

/* Cards Grid Layout */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0;
}

.cards-grid .card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid transparent;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: auto;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    min-height: 40px;
}

.cards-grid .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.1);
}

.cards-grid .card img {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

/* Top row: SVG and number side by side */
.cards-grid .card-top-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-self: flex-start;
    margin-left: 0;
}

.cards-grid .card-number {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

/* Color-coded card backgrounds with better contrast */
.cards-grid .nature-card {
    background: linear-gradient(135deg, #8bc34a 0%, #689f38 100%);
    color: white;
}

.cards-grid .nature-card .card-label,
.cards-grid .nature-card .card-number {
    color: white;
}

.cards-grid .health-card {
    background: linear-gradient(135deg, #ff5722 0%, #d84315 100%);
    color: white;
}

.cards-grid .health-card .card-label,
.cards-grid .health-card .card-number {
    color: white;
}

.cards-grid .transport-card {
    background: linear-gradient(135deg, #2196f3 0%, #1565c0 100%);
    color: white;
}

.cards-grid .transport-card .card-label,
.cards-grid .transport-card .card-number {
    color: white;
}

.cards-grid .education-card {
    background: linear-gradient(135deg, #9c27b0 0%, #6a1b9a 100%);
    color: white;
}

.cards-grid .education-card .card-label,
.cards-grid .education-card .card-number {
    color: white;
}

.cards-grid .gastronomy-card {
    background: linear-gradient(135deg, #ffc107 0%, #f57f17 100%);
    color: white;
}

.cards-grid .gastronomy-card .card-label,
.cards-grid .gastronomy-card .card-number {
    color: white;
}

.cards-grid .entertainment-card {
    background: linear-gradient(135deg, #e91e63 0%, #ad1457 100%);
    color: white;
}

.cards-grid .entertainment-card .card-label,
.cards-grid .entertainment-card .card-number {
    color: white;
}

.cards-grid .shopping-card {
    background: linear-gradient(135deg, #3f51b5 0%, #283593 100%);
    color: white;
}

.cards-grid .shopping-card .card-label,
.cards-grid .shopping-card .card-number {
    color: white;
}

.cards-grid .amenities-card {
    background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
    color: white;
}

.cards-grid .amenities-card .card-label,
.cards-grid .amenities-card .card-number {
    color: white;
}

/* Responsive Design for Property Page */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    .property-sidebar {
        width: 40%;
    }
    
    .property-map-container {
        width: 60%;
    }
}

@media screen and (max-width: 768px) {
    .property-page-container {
        flex-direction: column;
        min-height: calc(100vh - 80px);
        box-sizing: border-box;
        height: auto;
    }

    .property-sidebar {
        width: 100%;
        height: auto;
        order: 1;
        overflow-y: visible;
    }

    /* Remove overflow from sidebar on mobile to allow page-level scrolling */
    .flex.h-\[calc\(100vh-4rem\)\] {
        height: auto !important;
        overflow-y: visible !important;
    }

    .flex.h-\[calc\(100vh-4rem\)\] > div {
        overflow-y: visible !important;
    }

    /* Disable sticky header on mobile */
    .sticky.top-0 {
        position: relative !important;
    }
    
    .property-map-container {
        display: none;
    }
    
    .property-address {
        font-size: 20px;
    }
    
    .property-address-section {
        padding: 20px;
    }
    
    .geoscore-section {
        padding: 20px;
    }
    
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .cards-grid .card {
        /* padding: 12px; make cards smaller*/ 
        min-height: 60px;
        gap: 6px;
    }
    
    .cards-grid .card img {
        width: 28px;
        height: 28px;
    }
    
    .cards-grid .card-number {
        font-size: 20px;
    }
    
    .cards-grid .card-top-row {
        gap: 6px;
    }
    
    .card-label {
        font-size: 10px;
    }

    /* Content sections responsive styles */
    .description-container,
    .theme-container,
    .copyright-container,
    .footer-container {
        padding: 30px 0;
    }

    .description-container .container-fluid,
    .theme-container .container-fluid {
        padding: 0 20px;
    }

    .description-container h2,
    .theme-container h2 {
        font-size: 20px;
    }
}

@media screen and (max-width: 480px) {
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .cards-grid .card {
        /* padding: 15px; make cards smaller */
        gap: 8px;
    }
    
    .cards-grid .card-top-row {
        gap: 8px;
    }
    
    .cards-grid .card img {
        width: 24px;
        height: 24px;
    }
    
    .cards-grid .card-number {
        font-size: 18px;
    }
    
    .card-label {
        font-size: 10px;
    }
    
    .property-address-section {
        padding: 15px;
    }
    
    .geoscore-section {
        padding: 15px;
    }
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    z-index: 0;
}

/* Map inside property page container */
.property-map-container #map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* Label Row */
.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

/* Copyright */
#map-attribution {
    position: absolute;
    bottom: 10px;
    right: 10px;
    color: #000;
    font-size: 10px;
    z-index: 1000;
    transition: color 0.3s ease;
}

body.dark-mode #map-attribution {
    color: #fff;
}

#map-attribution a {
    color: inherit;
    text-decoration: none;
}

#map-attribution a:hover {
    text-decoration: underline;
}

.card {
    transition: all 0.3s ease-in-out;
    cursor: pointer;
}

#cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); /* make cards smaller */
    /* gap: 1rem; */
    gap: 8px;
    /* padding: 1rem; make cards smaller*/
}

.maplibregl-popup {
    max-width: 200px;
}

.popup-content {
    padding: 8px;
    font-size: 14px;
    line-height: 1.4;
}


/* Loading Module Styles */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: fadeInScale 0.3s ease-out;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3d348b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    color: #333;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Lato', Arial, sans-serif;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Dark mode loading styles */
body.dark-mode #loading-overlay .loading-spinner {
    background: #2c2c2c;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

body.dark-mode #loading-overlay .loading-text {
    color: #ffffff;
}

body.dark-mode #loading-overlay .spinner {
    border: 4px solid #444;
    border-top: 4px solid #3d348b;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #3b82f6;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #3b82f6;
    cursor: pointer;
    border-radius: 50%;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Tooltip */

/* .tooltip-container {
    display: flex;
    align-items: center;
} */

.tooltip-icon {
    margin-right: 10px;
    background-color: white;
    border-radius: 4px;
}

.tooltip-icon-svg {
    margin-right: 10px;
    background-color: white;
    border-radius: 4px;
    width: 50px;
    height: 50px;
    max-width: 50px;
    max-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* .tooltip-info {
    display: flex;
    flex-direction: column;
    margin-right: 10px;
} */

/* .tooltip-info div {
    margin-top: 0;
} */

/* Desktop Tooltip for Badge Clicks */
.desktop-tooltip {
    position: absolute;
    /* background-color: #3d348b; */
    /* color: white; */
    /* padding: 10px; */
    border-radius: 10px;
    pointer-events: none;
    z-index: 1000;
    /* padding: 1rem !important; */
    /* max-width: 250px; */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Mobile Tooltip */
#mobile-tooltip {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #3d348b;
    color: white;
    padding: 15px;
    z-index: 1001;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    max-height: 40vh; /* Limit height to prevent taking too much screen space */
    overflow-y: auto; /* Allow scrolling if content is too large */
}

#mobile-tooltip.show {
    transform: translateY(0);
}

#mobile-tooltip .tooltip-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px; /* Add some padding at the bottom */
}

#mobile-tooltip .tooltip-icon {
    width: 50px;
    height: 50px;
    margin-right: 15px;
    background-color: white;
    border-radius: 8px;
    padding: 5px;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

#mobile-tooltip .tooltip-info {
    flex: 1;
    font-size: 16px; /* Slightly larger font for better readability */
}

#mobile-tooltip .tooltip-info div {
    margin-bottom: 5px; /* Add spacing between info items */
}

.mobile-tooltip-close {
    position: absolute;
    top: 10px;
    background: none;
    right: 25px;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    z-index: 1002; /* Ensure close button is always clickable */
}

/* Add a subtle indicator that the tooltip can be scrolled */
#mobile-tooltip::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to top, rgba(0,0,0,0.2), transparent);
    pointer-events: none;
}

/* Ensure the mobile tooltip appears at the very bottom of the screen on mobile */
@media screen and (max-width: 768px) {
    #mobile-tooltip {
        bottom: 0; /* Position at the very bottom of the screen */
        z-index: 1001; /* Ensure it's above other elements */
    }

    /* In fullscreen mode, ensure tooltip appears above map but below navbar */
    body.map-fullscreen #mobile-tooltip {
        z-index: 920; /* Above map (900) and cards (910), but below navbar */
    }
}

/* Mobile Map Fullscreen Styles */
#mobile-map-fullscreen-btn {
    display: none;
}

@media screen and (max-width: 768px) {
    #mobile-map-fullscreen-btn {
        display: flex;
    }

    /* Fullscreen mode for mobile map */
    #mobile-map.fullscreen {
        position: fixed;
        top: 64px; /* Account for navbar height */
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw !important;
        height: calc(100vh - 64px) !important;
        z-index: 900;
        border-radius: 0;
        padding: 0;
        margin: 0;
    }

    /* Hide most sidebar content in fullscreen, but keep cards visible */
    body.map-fullscreen .property-sidebar > *:not(.p-3) {
        display: none !important;
    }

    /* Show cards container in fullscreen as left overlay on top of map */
    body.map-fullscreen #cards-container {
        position: fixed;
        top: 64px;
        left: 0;
        max-height: calc(100vh - 64px - 80px);
        height: auto;
        z-index: 910;
        backdrop-filter: blur(5px);
        overflow-y: visible;
        padding: 8px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    /* Make cards slightly smaller in fullscreen mode */
    body.map-fullscreen .cards-grid .card {
        padding: 6px;
        min-height: 60px;
    }

    body.map-fullscreen .cards-grid .card-number {
        font-size: 20px;
    }

    body.map-fullscreen .card-label {
        font-size: 9px;
    }

    body.map-fullscreen #mobile-map {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: calc(100vh - 64px);
        z-index: 900;
        border-radius: 0;
        padding: 0;
        margin: 0;
    }

    /* Ensure the fullscreen button stays visible in fullscreen mode */
    #mobile-map.fullscreen #mobile-map-fullscreen-btn {
        display: flex;
        bottom: 80px !important;
    }

    /* Adjust map attribution in fullscreen mode */
    #mobile-map.fullscreen #map-attribution {
        bottom: 10px;
        right: 10px;
    }

    /* Hide hamburger toggle and control panel in fullscreen mode */
    body.map-fullscreen #control-panel-toggle,
    body.map-fullscreen #control-panel {
        display: none !important;
    }

    /* Lock body scroll in fullscreen mode */
    body.map-fullscreen {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* Ensure header/navbar stays above fullscreen map */
    body.map-fullscreen #header {
        position: relative;
        z-index: 950 !important;
    }
}

.feature-category-selector .container-fluid {
        max-width: 1024px;
        margin: 0 auto;
        padding: 0 25px;
}

.feature-category-selector .category-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 1rem;
    max-width: 80%;
    margin: 0 auto;
}

@media screen and (max-width: 768px) {
    .feature-category-selector .category-buttons {
        max-width: 100%;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .feature-category-selector .category-btn {
        flex: 0 0 calc(33.333% - 0.34rem);
        padding: 0.5rem 0.5rem;
        font-size: 0.75rem;
        justify-content: center;
    }

    .feature-category-selector .container-fluid {
        padding: 0 15px;
    }
}

.feature-category-selector .category-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.feature-category-selector .category-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.feature-category-selector .category-btn.active {
    background: #0f172a;
    color: white;
    border-color: #0f172a;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.feature-category-selector .category-icon {
    width: 1rem;
    height: 1rem;
}

.feature-category-selector .nature { color: #059669; }
.feature-category-selector .health { color: #dc2626; }
.feature-category-selector .transport { color: #2563eb; }
.feature-category-selector .education { color: #7c3aed; }
.feature-category-selector .gastronomy { color: #ea580c; }
.feature-category-selector .entertainment { color: #ec4899; }
.feature-category-selector .shopping { color: #4f46e5; }
.feature-category-selector .amenities { color: #0d9488; }

.feature-category-selector .category-btn.active .nature,
.feature-category-selector .category-btn.active .health,
.feature-category-selector .category-btn.active .transport,
.feature-category-selector .category-btn.active .education,
.feature-category-selector .category-btn.active .gastronomy,
.feature-category-selector .category-btn.active .entertainment,
.feature-category-selector .category-btn.active .shopping,
.feature-category-selector .category-btn.active .amenities {
    color: white;
}

/* Feature section filtering - clean approach without conflicts */
.theme-container.feature-hidden {
    display: none;
}

.theme-container.feature-visible {
    display: block;
}

/* Smooth transitions for feature sections */
.theme-container {
    transition: opacity 0.2s ease-in-out;
}

/* Feature card inline SVG styling */
.h-5.w-5 svg {
    width: 100%;
    height: 100%;
    max-width: 1.25rem;
    max-height: 1.25rem;
}

.h-5.w-5 {
    width: 1.25rem;
    height: 1.25rem;
}