/* ============================================ */
/* Small Screen Overrides (< 600px)             */
/* ============================================ */
@media (max-width: 600px) {

    /* Property Details Sidebar - Full Width */
    :root {
        --sidebar-width: 100%;
    }

    .sidebar {
        width: 100%;
        right: -100%;
        box-shadow: none;
    }

    .sidebar.active {
        right: 0;
    }

    /* AI Modal - Compact */
    .ai-modal-content {
        width: 95%;
        margin: 10px auto;
        padding: 15px;
        max-height: 90vh;
    }

    /* Filter Drawer - Slightly wider on very small screens */
    #filter-container {
        max-width: 100%;
    }
}

:root {
    /* Colors */
    --primary-color: #0078A8;
    --secondary-color: #f7a100;
    --background-color: #f8f9fa;
    --text-color: #333;
    --light-text-color: #666;
    --border-color: #ddd;
    --border-subtle: #e2e8f0;
    --bg-subtle: #f8fafc;
    --hover-bg: #f0f7ff;

    /* Sizing */
    --sidebar-width: 380px;
    --filter-height: 50px;
    --fab-size-mobile: 40px;
    --fab-icon-size: 20px;

    /* Typography */
    --font-family: 'Inter', sans-serif;

    /* Transitions */
    --transition-fast: all 0.15s ease;
    --transition-normal: all 0.2s ease;
    --transition-slow: all 0.3s ease;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-primary: 0 4px 16px rgba(0, 120, 168, 0.25);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 50%;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: var(--background-color);
    color: var(--text-color);
    overflow: hidden;
    /* Prevent body scroll */
}

#map-container {
    position: relative;
    flex-grow: 1;
    height: 100vh;
    /* Full height initially */
    width: 100%;
    /* Revert to full width */
    overflow-x: hidden;
    /* Prevent horizontal scroll bar */
}

#map {
    height: 100%;
    width: 100%;
    background-color: #e0e0e0;
    /* Temporary background for visibility check */
}

/* --- Filter Bar --- */
#filter-container {
    position: absolute;
    top: 15px;
    left: 15px;
    /* Align left */
    z-index: 1000;
    /* Above map tiles */
    display: flex;
    flex-direction: row;
    /* Horizontal layout for desktop */
    flex-wrap: wrap;
    /* Allow wrapping */
    align-items: center;
    /* Vertically center items */
    background: transparent !important;
    pointer-events: none;
    /* Let clicks pass through gaps */
    padding-right: 0;
}

#filter-container>* {
    pointer-events: auto;
    /* Re-enable clicks on inputs */
}

/* Ensure wrapper doesn't inherit full width */
#filter-container {
    width: auto;
    max-width: 100%;
}

#filter-input-wrapper {
    align-items: center;
    width: auto;
    min-width: 300px;
    /* Slightly reduced */
    background-color: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 30px;
    padding: 0 8px 0 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s, border-color 0.2s;
    position: relative;
}

#filter-input-wrapper:focus-within {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

#filter-input {
    flex-grow: 1;
    padding: 14px 0;
    border: none;
    font-size: 15px;
    font-family: var(--font-family);
    background-color: transparent;
    outline: none;
    color: var(--text-color);
}

#filter-input::placeholder {
    color: #888;
}

/* Remove or comment out old #scrape-status styles */
/*
#scrape-status {
    font-size: 13px;
    color: var(--light-text-color);
    padding: 8px 15px;
    border-radius: var(--radius-xl);
    display: none; // Hidden initially
    white-space: nowrap;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    margin-left: 5px; // Space from input
}
 #scrape-status.loading {
     color: var(--primary-color);
     font-weight: 500;
 }
 #scrape-status.error {
     color: #dc3545;
     font-weight: 500;
 }
 #scrape-status.success {
     color: #28a745;
     font-weight: 500;
 }
*/

/* New Progress Indicator Styles */
#scraping-progress-indicator {
    display: none;
    align-items: center;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
    font-size: 13px;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--light-text-color);
    padding: 10px 18px;
    border-radius: 24px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border: 1px solid transparent;
    transition: opacity 0.2s, visibility 0.2s;
}

#scraping-progress-indicator span {
    margin-left: 5px;
}

#scraping-progress-indicator.status-info {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

#scraping-progress-indicator.status-success {
    color: #28a745;
    border-color: #28a745;
}

#scraping-progress-indicator.status-error {
    color: #dc3545;
    border-color: #dc3545;
}

/* Scrape Status Dropdown - Inline with filter bar elements */
#scrape-status-dropdown-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    margin-left: 8px;
    flex-shrink: 0;
    vertical-align: middle;
}

#scrape-status-dropdown-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 16px;
    transition: color 0.2s, transform 0.2s;
}

#scrape-status-dropdown-toggle:hover {
    color: var(--primary-color);
    transform: rotate(15deg);
}

#scrape-status-dropdown-menu {
    display: none;
    /* Hidden by default */
    position: absolute;
    left: 0;
    /* Align with the start of scrape-status-dropdown-container */
    top: calc(100% + 5px);
    /* Below the toggle button */
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    min-width: 450px;
    /* Increased minimum width */
    max-width: 95vw;
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: anywhere;
    padding: 0;
    list-style: none;
    margin: 0;
    flex-direction: column;
}

#scrape-status-dropdown-menu.active {
    display: block;
}

/* Styling for new dropdown sections */
#dropdown-actions-section,
#dropdown-flags-section {
    padding: 10px 15px;
}

#dropdown-status-messages-title {
    padding: 12px 15px 6px 15px;
    font-size: 0.75em;
    /* Smaller title */
    font-weight: 600;
    color: var(--light-text-color);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    /* Wider spacing */
    border-top: 1px solid #f0f0f0;
    /* Separator if actions/flags are above */
}

#dropdown-status-messages-section {
    padding: 5px 15px 10px 15px;
    max-width: 100%;
    max-height: 40vh;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    word-break: break-word;
    overflow-wrap: anywhere;
}


.dropdown-divider {
    border: none;
    border-top: 1px solid #f0f0f0;
    margin: 8px 0;
    /* Adjusted margin */
}

.dropdown-action-button {
    display: flex;
    align-items: center;
    background-color: transparent;
    border: none;
    color: var(--text-color);
    padding: 12px 5px;
    /* Adjusted padding */
    margin-bottom: 5px;
    width: 100%;
    text-align: left;
    font-size: 14px;
    font-family: var(--font-family);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s, color 0.15s;
}

.dropdown-action-button i {
    margin-right: 12px;
    color: var(--primary-color);
    font-size: 1.1em;
    width: 20px;
    /* Fixed width for icon alignment */
    text-align: center;
}

.dropdown-action-button:hover {
    background-color: #f4f6f8;
    /* Lighter hover */
    color: var(--primary-color);
}

.dropdown-action-button:last-child {
    margin-bottom: 0;
}

.dropdown-flag-item {
    display: flex;
    align-items: center;
    padding: 10px 5px;
    /* Adjusted padding */
    font-size: 14px;
    color: var(--text-color);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s;
}

.dropdown-flag-item:hover {
    background-color: #f4f6f8;
}

.dropdown-flag-item input[type="checkbox"] {
    margin-right: 12px;
    cursor: pointer;
    accent-color: var(--primary-color);
    height: 16px;
    /* Custom size */
    width: 16px;
    /* Custom size */
}

.dropdown-flag-item .flag-label {
    flex-grow: 1;
}

/* Status messages within the new section */
#dropdown-status-messages-section .scrape-status-row {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 6px 6px 6px 10px;
    font-size: 14px;
    color: var(--text-color);
    white-space: pre-line;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    margin-bottom: 3px;
    background: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: default;
    min-height: 2.1em;
    box-shadow: none;
}

/* Focus/hover: subtle background and clear border */
#dropdown-status-messages-section .scrape-status-row:focus,
#dropdown-status-messages-section .scrape-status-row:hover {
    background: #f4f6f8;
    outline: 2px solid var(--primary-color);
    border-color: var(--primary-color);
}

/* Status color borders only, no strong backgrounds */
#dropdown-status-messages-section .scrape-status-row.status-success {
    border-color: #28a745;
    background: none;
}

#dropdown-status-messages-section .scrape-status-row.status-error {
    border-color: #dc3545;
    background: none;
}

#dropdown-status-messages-section .scrape-status-row.status-warning {
    border-color: #ffc107;
    background: none;
}

#dropdown-status-messages-section .scrape-status-row.status-info {
    border-color: #17a2b8;
    background: none;
}

#dropdown-status-messages-section .scrape-status-row:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

/* Icon, message, and property ID styling */
#dropdown-status-messages-section .scrape-status-row .status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5em;
    max-width: 1.7em;
    font-size: 1.2em;
    line-height: 1;
    flex-shrink: 0;
    margin-right: 0.2em;
}

#dropdown-status-messages-section .scrape-status-row .status-prop-id {
    font-family: 'Fira Mono', 'Menlo', 'Consolas', monospace;
    font-size: 1em;
    color: #222;
    font-weight: 600;
    background: none;
    padding: 0.1em 0.4em 0.1em 0;
    border-radius: 2px;
    max-width: 8em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.7em;
    flex-shrink: 1;
    order: 1;
}

#dropdown-status-messages-section .scrape-status-row .status-message {
    flex: 1 1 auto;
    min-width: 0;
    color: #666;
    font-weight: 400;
    font-size: 0.98em;
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: anywhere;
    order: 2;
}

#dropdown-status-messages-section #no-status-updates {
    color: var(--light-text-color);
    font-style: italic;
    text-align: center;
    padding: 15px 5px;
    border-bottom: none;
}

/* Remove standalone scrape button style if it exists */
/* #scrape-button.button-secondary { ... } */


/* --- General Button Styles (Common for Scrape, etc.) --- */
.button-primary,
.button-secondary {
    padding: 10px 20px;
    /* Adjusted padding */
    border-radius: var(--radius-xl);
    /* Rounded corners */
    font-size: 14px;
    font-weight: 500;
    /* Medium weight */
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s, transform 0.1s;
    border: none;
    /* Remove default border */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    /* Uppercase text */
    letter-spacing: 0.5px;
    /* Slight letter spacing */
}

.button-primary:hover,
.button-secondary:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.button-primary:active,
.button-secondary:active {
    transform: translateY(0px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Specifics for Primary Button (Example: Old Filter Button) */
.button-primary {
    background-color: var(--primary-color);
    color: white;
    margin-left: 8px;
    /* Space from input or other elements */
}

.button-primary:hover {
    background-color: #005f8a;
    /* Darker shade of primary */
}

/* Specifics for Secondary Button (Scrape Button) */
/* #scrape-button.button-secondary { */
/* This was the old scrape button, removing its specific style */
/*    background-color: var(--secondary-color); 
    color: white;
    margin-left: 8px; 
} */

/* #scrape-button.button-secondary:hover {
    background-color: #e08e00; 
} */

/* Ensure buttons in the filter bar align well */
/* #filter-input-wrapper .button-primary, */
/* No primary button in wrapper anymore */
/* #filter-input-wrapper #scrape-button.button-secondary { */
/* No scrape button in wrapper anymore */
/*    height: 40px; 
    padding: 0 20px; 
    line-height: 40px; 
    flex-shrink: 0; 
} */


/* --- No Results Message --- */
#no-results {
    position: absolute;
    top: 70px;
    /* Below filter */
    left: 15px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 999;
    /* Below filter, above map */
    display: none;
    /* Hidden by default */
    font-size: 14px;
    color: var(--light-text-color);
    text-align: center;
    max-width: 320px;
}

/* --- Map Overlay --- */
.map-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 1001;
    /* Below sidebar, above map controls */
    display: none;
    transition: background-color 0.3s ease-in-out;
    cursor: pointer;
}

.map-overlay.active {
    display: block;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    right: calc(-1 * var(--sidebar-width));
    /* Start off-screen */
    width: var(--sidebar-width);
    height: 100%;
    background-color: #fff;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
    /* Softer shadow */
    transition: right 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1002;
    /* Highest */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.active {
    right: 0;
}

.sidebar-header {
    padding: 20px 25px;
    background-color: #fdfdfd;
    /* Lighter header */
    border-bottom: 1px solid #eee;
    /* Lighter border */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    /* Needed for absolute positioning of refresh button */
}

.sidebar-title-section h2 {
    font-size: 19px;
    font-weight: 600;
    margin: 0;
    color: var(--text-color);
    line-height: 1.3;
}

.sidebar-title-section p {
    font-size: 14px;
    color: var(--light-text-color);
    margin: 5px 0 0 0;
}

.close-sidebar-btn {
    background: none;
    border: none;
    font-size: 30px;
    font-weight: 300;
    cursor: pointer;
    color: #aaa;
    /* Lighter close icon */
    padding: 0 5px;
    line-height: 1;
    transition: color 0.2s;
}

.close-sidebar-btn:hover {
    color: var(--text-color);
}

.refresh-sidebar-btn {
    position: absolute;
    top: 15px;
    /* Adjust as needed */
    right: 60px;
    /* Position left of the close button */
    background: none;
    border: none;
    font-size: 18px;
    /* Smaller than close */
    cursor: pointer;
    color: #aaa;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
    display: none;
    /* Hidden initially */
}

.refresh-sidebar-btn:hover {
    color: var(--primary-color);
    transform: rotate(90deg);
}

.refresh-sidebar-btn.loading {
    color: var(--secondary-color);
    cursor: default;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Container for the main image (fixed below header) */
#sidebar-image-container {
    position: relative;
    /* For overlay button */
    flex-shrink: 0;
    /* Prevent shrinking */
    display: none;
    /* Hidden initially, shown by JS if image exists */
}

#sidebar-image {
    /* The main image element */
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    background-color: #eee;
    border-bottom: 1px solid #eee;
    /* Separator */
}

/* Button to show more images, overlayed on main image */
#show-thumbnails-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.65);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    display: none;
    /* Hidden by default, shown by JS if multiple images */
    z-index: 5;
    /* Above image */
}

#show-thumbnails-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

#show-thumbnails-btn.visible {
    display: block;
}

#show-thumbnails-btn i {
    margin-right: 5px;
}

/* Scrollable content area */
.sidebar-content {
    padding: 0;
    /* Remove padding, handle in sections */
    flex-grow: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Thumbnail gallery section (inside scrollable content) */
#thumbnail-gallery {
    padding: 15px 25px 5px 25px;
    /* Padding around thumbnails */
    background-color: #f8f9fa;
    /* Slightly different background */
    border-bottom: 1px solid #eee;
    display: none;
    /* Hidden by default */
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    /* Responsive grid */
    gap: 10px;
}

#thumbnail-gallery.visible {
    display: grid;
}

.thumbnail-image {
    width: 100%;
    height: 55px;
    /* Smaller thumbnails */
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #ddd;
    transition: transform 0.1s, box-shadow 0.1s, border-color 0.1s;
}

.thumbnail-image:hover {
    transform: scale(1.05);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

/* Detail sections styling */
.detail-section {
    padding: 20px 25px;
    /* Add padding to sections */
    margin-bottom: 0;
    /* Remove margin, use borders */
    border-bottom: 1px solid #f0f0f0;
    /* Separator */
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section h3 {
    font-size: 16px;
    /* Slightly larger section title */
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 15px 0;
    /* More space below title */
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
}

.detail-section h3 i {
    margin-right: 10px;
    font-size: 15px;
}

.detail-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    /* More space between items */
    font-size: 14px;
    /* Slightly larger text */
    line-height: 1.5;
}

.detail-item i.icon {
    margin-right: 15px;
    /* More space for icon */
    color: #999;
    /* Lighter icon */
    margin-top: 3px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1.1em;
    /* Slightly larger icon */
}

.detail-item .text-content {
    display: flex;
    flex-direction: column;
}

.detail-item .label {
    font-weight: 500;
    color: var(--light-text-color);
    font-size: 12px;
    margin-bottom: 2px;
    /* More space below label */
    text-transform: uppercase;
    /* Uppercase label */
    letter-spacing: 0.5px;
}

.detail-item .value {
    color: var(--text-color);
    font-weight: 400;
}

.detail-item .value-boolean.true {
    color: #28a745;
    font-weight: 500;
}

.detail-item .value-boolean.false {
    color: #dc3545;
    font-weight: 500;
}

.description-text {
    font-size: 14px;
    line-height: 1.65;
    /* More line spacing */
    color: var(--light-text-color);
    white-space: pre-wrap;
    overflow: hidden;
    position: relative;
    margin-bottom: 10px;
}

.description-text.truncated {
    max-height: 110px;
    /* Limit height slightly more */
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.toggle-description-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    /* Bolder toggle */
    padding: 5px 0;
    margin-top: 8px;
    display: inline-block;
}

.toggle-description-btn:hover {
    text-decoration: underline;
}

.sidebar-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    background-color: #f8f9fa;
    flex-shrink: 0;
}

.sidebar-funda-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    /* More padding */
    background-color: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    /* Slightly more rounded */
    font-size: 15px;
    /* Larger font */
    font-weight: 600;
    /* Bolder */
    transition: background-color 0.2s, transform 0.1s;
    text-align: center;
}

.sidebar-funda-link i {
    margin-right: 10px;
}

.sidebar-funda-link:hover {
    background-color: #e08e00;
}

.sidebar-funda-link:active {
    transform: scale(0.98);
}

/* --- Leaflet Popup & Tooltip Styling --- */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    /* More rounded popup */
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 15px;
    /* More margin */
    font-size: 13.5px;
    /* Slightly larger popup font */
    line-height: 1.6;
    color: var(--text-color);
}

.leaflet-popup-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

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

.leaflet-popup-content p {
    margin: 8px 0;
}

.leaflet-popup-content strong {
    font-weight: 600;
}

.leaflet-tooltip {
    background-color: rgba(255, 255, 255, 0.98);
    /* More opaque */
    border: 1px solid #bbb;
    /* Slightly darker border */
    border-radius: 5px;
    padding: 8px 12px;
    /* More padding */
    font-size: 12.5px;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    color: var(--text-color);
}

.leaflet-tooltip strong {
    font-weight: 600;
}

/* --- Marker Interaction Styling --- */
.leaflet-marker-icon {
    transition: transform 0.1s ease-out, filter 0.1s ease-out;
}

.leaflet-marker-icon:hover {
    transform: scale(1.1);
    /* Scale up on hover */
    filter: brightness(1.1);
    cursor: pointer;
}

/* Style for the currently selected marker */
.selected-marker .leaflet-marker-icon {
    /* Target the icon within the selected marker */
    transform: scale(1.2);
    filter: brightness(1.2);
    /* Make it slightly brighter */
}

/* --- Progress Bar (Batch Scraping) --- */
#scrape-progress-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 500px;
    height: 24px;
    background-color: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    /* Hidden by default */
}

#scrape-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4caf50, #81c784);
    border-radius: 12px;
    transition: width 0.3s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

/* AI Advisor FAB - Desktop: Pill with icon + text */
.ask-ai-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    border: none;
    border-radius: 28px;
    padding: 16px 28px;
    min-width: 140px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

.ask-ai-fab i {
    font-size: 18px;
    line-height: 1;
}

.ask-ai-fab:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.ask-ai-fab:active {
    transform: translateY(0) scale(0.98);
}

/* Buy Credits FAB - Desktop: Pill with icon + text, hidden by default (shown by JS when logged in) */
.buy-credits-fab {
    position: fixed;
    bottom: 90px;
    right: 24px;
    z-index: 1000;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    padding: 10px 20px;
    min-width: 140px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(34, 197, 94, 0.3);
    transition: var(--transition-normal);
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.buy-credits-fab i {
    font-size: 14px;
    line-height: 1;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

.buy-credits-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(34, 197, 94, 0.45);
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
}


.buy-credits-fab:active {
    transform: translateY(0);
}

/* Modal Styling */
.ai-modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    /* Black w/ opacity */
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.ai-modal-content {
    background-color: #ffffff;
    margin: 10% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    font-family: 'Inter', sans-serif;
    position: relative;
    animation: slideIn 0.3s;
}

.ai-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.ai-modal-close:hover {
    color: #000;
}

.ai-modal-content h3 {
    margin-top: 0;
    color: #1f2937;
    font-size: 1.5rem;
}

/* AI Configuration Section */
.ai-config-section {
    margin: 15px 0;
    padding: 12px;
    background: var(--bg-subtle);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.ai-config-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ai-config-row label {
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

#ai-property-limit {
    width: 80px;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.ai-data-tags {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-config-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.ai-tag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
}

/* Configuration Dropdown */
.ai-config-dropdown {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    background: white;
}

.ai-config-header {
    background: linear-gradient(135deg, #1fa2ff 0%, #12d8fa 50%, #a6ffcb 100%);
    /* Teal/Cyan Gradient */
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid transparent;
    transition: filter 0.2s;
    color: white;
}

.ai-config-header:hover {
    filter: brightness(1.05);
}

.ai-config-title {
    font-weight: 600;
    color: white;
    /* White text on gradient */
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ai-config-arrow {
    color: white;
    /* White arrow */
    font-size: 12px;
    transition: transform 0.3s ease;
    opacity: 0.9;
}

.ai-config-arrow.expanded {
    transform: rotate(180deg);
}

.ai-config-body {
    padding: 15px;
    border-top: 1px solid #eee;
    background: #fff;
}

.ai-config-groups {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.ai-config-group {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.group-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.ai-tag-grid.small-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-tag-grid.small-grid .ai-tag {
    font-size: 11px;
    padding: 3px 8px;
}

.ai-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
}

.ai-tag:hover {
    border-color: #4f46e5;
    background: #f5f3ff;
}

.ai-tag input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.ai-tag input[type="checkbox"]:checked+* {
    color: #4f46e5;
    font-weight: 500;
}

/* AI Context Preview Panel */
.ai-context-preview {
    margin: 15px 0;
    border: 1px solid var(--border-subtle);
    margin: 20px 0;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.ai-context-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
    color: white;
    transition: filter 0.2s;
}

.ai-context-header:hover {
    filter: brightness(1.1);
}

.ai-context-badge {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    margin-left: auto;
    margin-right: 10px;
    font-weight: 600;
}

.ai-context-arrow {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    transition: transform 0.3s ease;
}

.ai-context-arrow.expanded {
    transform: rotate(180deg);
}

.ai-context-body {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    max-height: 200px;
    overflow-y: auto;
    background: white;
}

.ai-context-filters {
    padding: 8px 10px;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: #475569;
}

.ai-context-filters .filter-tag {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    padding: 2px 8px;
    border-radius: 4px;
    margin: 2px 4px 2px 0;
    font-size: 0.75rem;
}

.ai-context-list {
    display: grid;
    gap: 6px;
}

.ai-context-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.ai-context-item-address {
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.ai-context-item-price {
    color: #059669;
    font-weight: 600;
}

.ai-context-more {
    text-align: center;
    padding: 6px;
    color: #64748b;
    font-size: 0.75rem;
    font-style: italic;
}

.ai-input-group {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.ai-option-btn {
    flex: 1;
    padding: 10px;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.ai-option-btn:hover {
    background-color: #e5e7eb;
}

.ai-custom-query {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-custom-query textarea {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.ai-send-btn {
    align-self: flex-end;
    padding: 8px 16px;
    background-color: #4f46e5;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.ai-send-btn:hover {
    background-color: #4338ca;
}

.ai-response-area {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #374151;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ======================== */
/* AI Chat Message Styling  */
/* ======================== */

.ai-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease-out;
}

.ai-message-user {
    flex-direction: row-reverse;
}

.ai-message-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.ai-message-user .ai-message-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.ai-message-assistant .ai-message-icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
}

.ai-message-content {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.6;
}

.ai-message-user .ai-message-content {
    background-color: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message-assistant .ai-message-content {
    background-color: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

/* Markdown Rendering Styles */
.ai-message-content .ai-h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 16px 0 8px 0;
    color: #1f2937;
}

.ai-message-content .ai-h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 14px 0 6px 0;
    color: #374151;
}

.ai-message-content .ai-h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 12px 0 4px 0;
    color: #4b5563;
}

.ai-message-content .ai-list {
    margin: 8px 0;
    padding-left: 20px;
    list-style: none;
}

.ai-message-content .ai-list li {
    position: relative;
    margin-bottom: 6px;
    padding-left: 12px;
}

.ai-message-content .ai-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #6366f1;
    font-weight: bold;
}

.ai-message-content .ai-link {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

.ai-message-content .ai-link:hover {
    text-decoration: underline;
}

.ai-message-content .ai-link i {
    font-size: 0.75em;
    margin-left: 4px;
    opacity: 0.7;
}

.ai-message-content .ai-price {
    color: #059669;
    font-weight: 600;
}

.ai-message-content .ai-price-m2 {
    color: #7c3aed;
    font-weight: 600;
    background-color: rgba(124, 58, 237, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Follow-up Section Styling */
.ai-followup-section {
    margin-top: 20px;
    border-top: 1px solid #e5e7eb;
    padding-top: 15px;
}

.ai-followup-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ai-followup-input-container input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-followup-input-container input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ai-followup-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-followup-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ai-followup-btn:active {
    transform: scale(0.98);
}

/* Improved Response Area */
.ai-response-area {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #374151;
}

.ai-response-area::-webkit-scrollbar {
    width: 6px;
}

.ai-response-area::-webkit-scrollbar-track {
    background: transparent;
}

.ai-response-area::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 3px;
}

.ai-response-area::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af;
}

/* --- Property Filter Controls --- */
#filter-container {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
}

/* Filter groups - uniform height container */
.filter-group {
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 0 8px;
    height: 42px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.filter-separator {
    color: #999;
    font-size: 12px;
    margin: 0 2px;
}

/* Price inputs - compact */
#price-filter-wrapper input {
    width: 80px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-family);
    background-color: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

#price-filter-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 120, 168, 0.1);
}

#price-filter-wrapper input::placeholder {
    color: #999;
}

/* City and Neighbourhood - Multi-select with expand on focus */
#city-filter-wrapper,
#neighbourhood-filter-wrapper {
    position: relative;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
}

#city-filter,
#neighbourhood-filter {
    width: 150px;
    height: 42px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 13px;
    font-family: var(--font-family);
    background-color: #fff;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* Expand on focus/active */
#city-filter:focus,
#neighbourhood-filter:focus {
    height: auto;
    max-height: 200px;
    overflow-y: auto;
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 120, 168, 0.2);
    z-index: 100;
    position: absolute;
    min-width: 180px;
}

#city-filter:hover,
#neighbourhood-filter:hover {
    border-color: #999;
}

#city-filter option,
#neighbourhood-filter option {
    padding: 8px 10px;
    cursor: pointer;
}

#city-filter option:checked,
#neighbourhood-filter option:checked {
    background-color: var(--primary-color);
    color: white;
}

#city-filter option:hover,
#neighbourhood-filter option:hover {
    background-color: var(--hover-bg);
}

/* Apply Filter Button */
.filter-apply-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 2px 6px rgba(0, 120, 168, 0.3);
    flex-shrink: 0;
}

.filter-apply-btn:hover {
    background-color: #005f8a;
    transform: translateY(-1px);
}

.filter-apply-btn:active {
    transform: translateY(0);
}

/* Make search input wrapper match height */
#filter-input-wrapper {
    height: 42px;
    min-width: 220px;
    padding: 0 12px;
    border-radius: 8px;
}

#filter-input {
    height: 100%;
    padding: 0;
    font-size: 14px;
}

/* Responsive adjustments for filters */
@media (max-width: 1100px) {
    #filter-container {
        flex-wrap: wrap;
    }

    #city-filter,
    #neighbourhood-filter {
        width: 130px;
    }
}

@media (max-width: 768px) {
    #filter-container {
        flex-wrap: wrap;
        gap: 6px;
    }

    #filter-input-wrapper {
        min-width: 180px;
        flex: 1 1 auto;
    }

    #city-filter,
    #neighbourhood-filter {
        width: 120px;
    }

    #price-filter-wrapper input {
        width: 70px;
    }
}

@media (max-width: 600px) {
    #filter-container {
        top: 10px;
        left: 10px;
        right: 10px;
        flex-direction: column;
        align-items: stretch;
    }

    #filter-input-wrapper {
        min-width: 100%;
    }

    .filter-group,
    #city-filter-wrapper,
    #neighbourhood-filter-wrapper {
        width: 100%;
    }

    #price-filter-wrapper input {
        flex: 1;
        width: auto;
    }

    #city-filter,
    #neighbourhood-filter {
        width: 100%;
    }

    .filter-apply-btn {
        width: 100%;
    }
}

/* --- Login Button --- */
.login-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    /* Above map and standard overlays */
    /* Glassmorphism for Desktop too */
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 10px 20px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    font-family: var(--font-family);
    transition: var(--transition-normal);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    background-color: #f8f9fa;
}

.login-btn i {
    font-size: 1.2em;
}

/* --- Search Suggestions --- */
.search-suggestions {
    position: absolute;
    top: 100%;
    /* Below input wrapper */
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 15px 15px;
    /* Rounded bottom */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    max-height: 350px;
    overflow-y: auto;
    z-index: 1002;
    margin-top: 5px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: none;
    /* Controlled by JS */
}

/* Scrollbar for suggestions */
.search-suggestions::-webkit-scrollbar {
    width: 6px;
}

.search-suggestions::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.search-suggestions::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f8f8f8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.15s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: var(--hover-bg);
    /* Light blue tint */
}

.suggestion-name {
    font-weight: 500;
    color: var(--text-color);
}

.suggestion-meta {
    color: #999;
    font-size: 0.85em;
    font-weight: 500;
    background-color: #f0f0f0;
    padding: 2px 8px;
    border-radius: var(--radius-md);
}

/* --- Custom Filter Dropdowns --- */
.custom-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.custom-dropdown-btn {
    padding: 10px 15px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: var(--radius-xl);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: var(--transition-normal);
    font-family: var(--font-family);
    min-width: 160px;
}

.custom-dropdown-btn:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.custom-dropdown-btn i {
    font-size: 0.8em;
    flex-shrink: 0;
}

.custom-dropdown-btn .dropdown-label {
    flex: 1;
    text-align: left;
}

.custom-dropdown-btn .dropdown-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.count-badge {
    background-color: var(--primary-color);
    color: white;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: var(--radius-md);
    min-width: 18px;
    text-align: center;
    display: inline-block;
}

.custom-dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background-color: white;
    min-width: 250px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-md);
    z-index: 1002;
    padding: 10px;
    border: 1px solid #eee;
}

.custom-dropdown-content.show {
    display: block;
}

.dropdown-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-family: var(--font-family);
    box-sizing: border-box;
}

.dropdown-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.dropdown-list {
    max-height: 250px;
    overflow-y: auto;
}

.dropdown-item {
    padding: 6px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 4px;
    font-size: 13px;
    user-select: none;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: var(--hover-bg);
}

.dropdown-item input[type="checkbox"] {
    accent-color: var(--primary-color);
    cursor: pointer;
}

.dropdown-item label {
    cursor: pointer;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Adjust Login Button Position */
.login-btn {
    right: 80px !important;
}

/* --- Auth Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    position: relative;
    font-family: var(--font-family);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

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

#auth-forms h2 {
    margin-top: 0;
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    font-size: 15px;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
}

#auth-forms button[type="submit"] {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.2s;
}

#auth-forms button[type="submit"]:hover {
    background-color: #004d6b;
    /* Darker primary */
}

.auth-switch {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    color: #666;
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* --- Buy Credits Button --- */
.buy-credits-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius-xl);
    font-size: 14px;
    cursor: pointer;
    margin-right: 10px;
    transition: background-color 0.2s;
    font-weight: 600;
}

.buy-credits-btn:hover {
    background-color: #218838;
}

.buy-credits-btn i {
    margin-right: 5px;
}

/* --- AI Modal Professional Header --- */
.ai-modal-header-styled {
    display: flex;
    align-items: center;
    padding: 20px 25px;
    /* Increased padding */
    margin: -20px -20px 20px -20px;
    /* Negative margin to span full width */
    background: linear-gradient(to right, #f8f9fa, #ffffff);
    border-bottom: 1px solid #e0e0e0;
    border-radius: 12px 12px 0 0;
    /* Match modal rounded corners */
}

.ai-header-icon {
    width: 40px;
    /* Larger icon */
    height: 40px;
    background: linear-gradient(135deg, #0078A8, #00A3E0);
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    /* Larger icon font */
    margin-right: 15px;
    box-shadow: 0 4px 12px rgba(0, 120, 168, 0.25);
}

.ai-modal-content h3 {
    margin: 0;
    font-size: 20px;
    /* Larger title */
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.4px;
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: initial;
    display: block;
}

/* Make property links "fat" (bold) and distinct */
.ai-response-area a {
    font-weight: 700;
    color: #0078A8;
    text-decoration: none;
    border-bottom: 2px solid rgba(0, 120, 168, 0.2);
    transition: var(--transition-normal);
    padding-bottom: 1px;
}

.ai-response-area a:hover {
    color: #005f8a;
    border-bottom-color: #0078A8;
    background-color: rgba(0, 120, 168, 0.05);
    border-radius: 3px;
}

.ai-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    color: #999;
    line-height: 1;
    z-index: 10;
}

/* Admin Only Elements - Hidden by default */
/* Admin Status Elements - Bottom Left */
#system-status-bar {
    position: fixed;
    bottom: 20px;
    left: 16px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 14px;
    border-radius: var(--radius-xl);
    font-size: 0.8em;
    display: none;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: opacity 0.2s, visibility 0.2s;
}

#progress-container {
    position: absolute;
    bottom: 20px;
    left: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85em;
    display: none;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Specific overrides via JS class */
body.is-admin #system-status-bar {
    display: flex !important;
}

body.is-admin #scraping-progress-indicator,
body.is-admin #progress-container,
body.is-admin #scrape-status-dropdown-container {
    display: flex !important;
}

body.is-admin #progress-container {
    display: block !important;
}

body.is-admin #scrape-status-dropdown-container {
    display: block !important;
}

/* Onboarding Banner (Glassmorphism) */
.glass-banner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-xl);
    padding: 30px;
    z-index: 9999;
    max-width: 450px;
    width: 90%;
    text-align: center;
    color: #1f2937;
    animation: fadeScaleIn 0.5s ease-out forwards;
    display: none;
    /* Hidden by default */
}

@keyframes fadeScaleIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.banner-content h2 {
    margin-top: 0;
    color: var(--secondary-color);
    /* Funda Orange */
    font-size: 24px;
    margin-bottom: 12px;
}

.banner-content p {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 25px;
    color: #4b5563;
}

.banner-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(243, 112, 33, 0.3);
}

.banner-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(243, 112, 33, 0.4);
    background: #e66014;
    /* Darker Orange */
}

/* --- Mobile Responsive Controls Drawer --- */

/* Mobile Menu Toggle Button (Hidden on Desktop) */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 2000;
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    color: #555;
    font-size: 1rem;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal);
}

.mobile-menu-toggle:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    color: #333;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Close Button inside Drawer (Hidden on Desktop) */
.close-mobile-menu {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 5px;
}

/* ============================================ */
/* MOBILE RESPONSIVE STYLES                     */
/* Clean, Professional Mobile Experience        */
/* ============================================ */

@media (max-width: 768px) {

    /* ---------------------------------------- */
    /* Mobile Menu Toggle Button                */
    /* ---------------------------------------- */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ---------------------------------------- */
    /* Filter Drawer (Sidebar) - Premium Design */
    /* ---------------------------------------- */
    #filter-container {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 340px;
        height: 100vh;
        background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        z-index: 2001;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
        transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        overflow-x: hidden;
        gap: 0;
    }

    #filter-container.active {
        left: 0;
    }

    /* Drawer Header - More refined */
    #filter-container::before {
        content: 'Filters';
        display: flex;
        align-items: center;
        padding: 24px 20px 20px;
        font-size: 20px;
        font-weight: 700;
        color: #1a202c;
        letter-spacing: -0.3px;
        border-bottom: 1px solid #e2e8f0;
        background: #ffffff;
        position: sticky;
        top: 0;
        z-index: 5;
    }

    /* Close Button - Drawer */
    .close-mobile-menu {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        background: #f5f5f5;
        border: none;
        border-radius: 50%;
        font-size: 20px;
        color: #666;
        cursor: pointer;
        transition: var(--transition-normal);
        z-index: 10;
    }

    .close-mobile-menu:hover {
        background: #eee;
        color: #333;
    }

    /* Drawer Content Wrapper - Let each element handle its own margins */
    #filter-container>*:not(.close-mobile-menu) {
        padding: 0;
        margin-bottom: 8px;
    }

    #filter-container>*:first-child:not(.close-mobile-menu) {
        margin-top: 12px;
    }

    /* ---------------------------------------- */
    /* Form Elements Styling                    */
    /* ---------------------------------------- */

    /* Search Input - Compact height, fits within drawer */
    #filter-input-wrapper {
        width: calc(100% - 24px) !important;
        max-width: calc(100% - 24px) !important;
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        flex: 0 0 44px !important;
        border-radius: var(--radius-md);
        border: 1px solid var(--border-subtle);
        background: var(--bg-subtle);
        padding: 0 12px;
        margin: 0 12px;
        box-sizing: border-box;
        transition: var(--transition-normal);
        display: flex;
        align-items: center;
    }

    #filter-input-wrapper:focus-within {
        border-color: var(--primary-color);
        background: #fff;
        box-shadow: 0 0 0 3px rgba(0, 120, 168, 0.08);
    }

    #filter-input {
        width: 100%;
        height: 100%;
        padding: 0;
        font-size: 15px;
        background: transparent;
        border: none;
        outline: none;
    }

    /* Price Inputs - Fit within drawer */
    #price-filter-wrapper {
        flex-direction: row !important;
        gap: 8px;
        height: auto;
        padding: 0;
        margin: 0 12px;
        width: calc(100% - 24px) !important;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    #price-filter-wrapper input {
        flex: 1;
        height: 44px;
        padding: 0 12px;
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-md);
        font-size: 14px;
        background: var(--bg-subtle);
        box-sizing: border-box;
        transition: var(--transition-normal);
    }

    #price-filter-wrapper input:focus {
        border-color: var(--primary-color);
        background: #fff;
        box-shadow: 0 0 0 3px rgba(0, 120, 168, 0.08);
        outline: none;
    }

    .filter-separator {
        display: none;
    }

    /* Filter Groups - Card-like sections */
    .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        height: auto;
        padding: 16px;
        margin: 0 12px 12px;
        background: #ffffff;
        border: none;
        border-radius: 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }

    /* Dropdowns - Cleaner design */
    .custom-dropdown-wrapper {
        width: 100%;
        margin: 0 12px;
        max-width: calc(100% - 24px);
    }

    .custom-dropdown-btn {
        width: 100%;
        height: 52px;
        padding: 0 16px;
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-lg);
        background: #ffffff;
        font-size: 15px;
        font-weight: 500;
        color: #374151;
        justify-content: space-between;
        box-sizing: border-box;
        transition: var(--transition-normal);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }

    .custom-dropdown-btn:hover,
    .custom-dropdown-btn:focus {
        border-color: var(--primary-color);
        background: #fff;
        box-shadow: 0 2px 8px rgba(0, 120, 168, 0.12);
    }

    .custom-dropdown-content {
        position: static;
        width: 100%;
        margin-top: 8px;
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-lg);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        overflow: hidden;
        max-height: none;
        background: #fff;
        z-index: 10;
    }

    .custom-dropdown-content.show {
        display: block;
    }

    .dropdown-list {
        max-height: 220px;
        overflow-y: auto;
        padding: 8px;
    }

    .dropdown-item {
        padding: 14px 12px;
        font-size: 15px;
        border-radius: var(--radius-md);
        margin-bottom: 4px;
        transition: background 0.15s ease;
    }

    .dropdown-item:hover {
        background: var(--hover-bg);
    }

    .dropdown-item:last-child {
        margin-bottom: 0;
    }

    .dropdown-search-input {
        height: 44px;
        padding: 0 12px;
        font-size: 14px;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        border-radius: 0;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }


    /* Apply Filters Button */
    .filter-apply-btn {
        width: 100%;
        height: 52px;
        margin: 20px 0 16px;
        padding: 0 20px;
        background: linear-gradient(135deg, var(--primary-color) 0%, #005f8a 100%);
        color: white;
        border: none;
        border-radius: var(--radius-lg);
        font-size: 15px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        box-shadow: 0 4px 12px rgba(0, 120, 168, 0.25);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        cursor: pointer;
        transition: var(--transition-normal);
    }

    .filter-apply-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 16px rgba(0, 120, 168, 0.3);
    }

    .filter-apply-btn:active {
        transform: translateY(0);
    }

    /* Hide Login Button inside drawer, show fixed version */
    #filter-container .login-btn {
        display: none !important;
    }

    /* ---------------------------------------- */
    /* Drawer Overlay                           */
    /* ---------------------------------------- */
    #drawer-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        z-index: 2000;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    #drawer-overlay.active {
        display: block;
    }

    /* ---------------------------------------- */
    /* Login Button (Fixed Position)            */
    /* ---------------------------------------- */
    .login-btn {
        position: fixed !important;
        top: 16px !important;
        right: 16px !important;
        width: auto !important;
        padding: 8px 16px;
        font-size: 13px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.8);
        border-radius: 24px;
        z-index: 1000;
    }

    .auth-user-name {
        display: none;
    }

    .auth-user-credits {
        font-size: 12px;
        font-weight: 600;
        color: var(--primary-color);
    }

    .login-btn i {
        font-size: 14px;
        margin-right: 6px;
        color: #555;
    }

    /* ---------------------------------------- */
    /* FAB Buttons - Compact Circular           */
    /* ---------------------------------------- */

    /* AI FAB - Primary Action (48px circle, icon only) */
    .ask-ai-fab {
        position: fixed !important;
        bottom: 20px;
        right: 16px;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 50% !important;
        font-size: 0 !important;
        color: transparent !important;
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
        z-index: 999;
        text-indent: -9999px !important;
    }

    .ask-ai-fab i {
        font-size: 20px !important;
        color: white !important;
        margin: 0 !important;
        padding: 0 !important;
        line-height: 1 !important;
        text-indent: 0 !important;
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }

    /* Buy Credits FAB - Same size (48px), icon-only */
    .buy-credits-fab {
        position: fixed !important;
        bottom: 68px;
        right: 16px;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 50% !important;
        font-size: 0 !important;
        color: transparent !important;
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 3px 12px rgba(34, 197, 94, 0.35);
        z-index: 999;
        text-indent: -9999px !important;
    }

    .buy-credits-fab i {
        font-size: 20px !important;
        color: white !important;
        margin: 0 !important;
        padding: 0 !important;
        line-height: 1 !important;
        text-indent: 0 !important;
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }

    /* ---------------------------------------- */
    /* Hide Admin/Debug/Status Elements         */
    /* ---------------------------------------- */
    body #system-status-bar,
    body.is-admin #system-status-bar,
    #scraping-progress-indicator,
    #notification-bar {
        display: none !important;
    }

    #scrape-status-dropdown-container {
        display: none !important;
    }

    /* ---------------------------------------- */
    /* Mobile Menu Toggle - Ensure visible      */
    /* ---------------------------------------- */
    .mobile-menu-toggle {
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 1000;
    }
}