/* ==========================================================================
   EstateOS Interactive Map Matrix Stylesheet
   ========================================================================== */

:root {
    --estate-primary: #2563eb;
    --estate-primary-hover: #1d4ed8;
    --estate-primary-light: #eff6ff;
    --estate-dark: #0f172a;
    --estate-slate: #1e293b;
    --estate-muted: #64748b;
    --estate-light: #f8fafc;
    --estate-border: #e2e8f0;
    --estate-green: #10b981;
}

.estate-search-page-wrapper {
    background-color: #f8fafc !important;
    min-height: 100vh;
    padding-top: 15px;
    padding-bottom: 40px;
    font-family: 'Inter', sans-serif !important;
}

/* --------------------------------------------------------------------------
   Top Matrix Control & Header Bar
   -------------------------------------------------------------------------- */
.estate-matrix-top-bar {
    background: transparent;
    margin-bottom: 8px;
}

.estate-matrix-pulse-dot {
    width: 9px;
    height: 9px;
    background-color: var(--estate-primary);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    animation: estate-pulse-wave 2s infinite;
}

@keyframes estate-pulse-wave {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.estate-matrix-eyebrow {
    font-size: 15px;
    font-weight: 800;
    color: var(--estate-dark);
    letter-spacing: -0.01em;
}

.estate-count-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #eff6ff !important;
    border: 1px solid #bfdbfe !important;
    color: #1e40af !important;
    padding: 4px 12px 4px 6px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.08);
}

.estate-count-num {
    background: #2563eb;
    color: #ffffff !important;
    font-size: 11.5px;
    font-weight: 800;
    padding: 4px 9px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    line-height: 1;
}

.estate-count-text {
    color: #1d4ed8;
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: -0.01em;
}

.estate-matrix-pins-badge {
    background: var(--estate-primary-light);
    color: var(--estate-primary);
    border: 1px solid #bfdbfe;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}

.estate-matrix-subtext {
    font-size: 13px;
    color: var(--estate-muted);
    font-weight: 500;
}

.mls-feed-badge {
    background: #ecfdf5;
    color: var(--estate-green);
    border: 1px solid #a7f3d0;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
}

.estate-top-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

.estate-top-title-wrap {
    flex-shrink: 0;
}

.estate-asset-pills-wrap {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    max-width: 680px;
    overflow: hidden;
}

/* Quick Asset Filter Pills */
.estate-asset-pills {
    background: #ffffff;
    padding: 3px 6px;
    border-radius: 30px;
    border: 1px solid var(--estate-border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 3px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.estate-asset-pills::-webkit-scrollbar {
    display: none;
}

.estate-sort-wrap {
    flex-shrink: 0;
    min-width: 160px;
}

.asset-pill-btn {
    border: none;
    background: transparent;
    color: var(--estate-muted);
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    line-height: 1;
}

.asset-pill-btn:hover {
    color: var(--estate-dark);
    background: #f1f5f9;
}

.asset-pill-btn.active {
    background: var(--estate-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* Sort Dropdown */
.estate-sort-select {
    background-color: #ffffff;
    border: 1px solid var(--estate-border);
    border-radius: 20px;
    height: 40px;
    padding: 6px 34px 6px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--estate-dark);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.estate-sort-select:focus {
    border-color: var(--estate-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: none;
}

/* --------------------------------------------------------------------------
   Compact Glass Filter Bar
   -------------------------------------------------------------------------- */
.estate-filter-bar-card {
    background: #ffffff;
    border: 1px solid var(--estate-border);
    border-radius: 14px;
    padding: 8px 12px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.03);
}

.estate-filter-control {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--estate-dark);
    height: 42px;
    padding: 8px 14px;
    transition: all 0.2s ease;
    width: 100%;
}

.estate-filter-control:focus {
    background-color: #ffffff;
    border-color: var(--estate-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    outline: none;
}

.estate-filter-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 13px;
    pointer-events: none;
}

.estate-dropdown-popover {
    border-radius: 14px !important;
    border: 1px solid var(--estate-border) !important;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14) !important;
    z-index: 1050;
}

/* Autocomplete suggestions */
.autocomplete-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--estate-border);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    z-index: 1060;
    max-height: 240px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 8px 12px;
    font-size: 12.5px;
    color: var(--estate-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}

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

.autocomplete-item:hover,
.autocomplete-item.active {
    background: #f8fafc;
    color: var(--estate-primary);
}

/* --------------------------------------------------------------------------
   Feed Header & Scrollable 2-Column Cards Feed
   -------------------------------------------------------------------------- */
.estate-feed-count-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--estate-dark);
    letter-spacing: -0.02em;
}

.estate-feed-location-sub {
    font-size: 13px;
    color: var(--estate-muted);
    font-weight: 500;
}

.estate-cards-scroll-container {
    max-height: calc(100vh - 220px);
    min-height: 560px;
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.estate-cards-scroll-container::-webkit-scrollbar {
    width: 5px;
}

.estate-cards-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* --------------------------------------------------------------------------
   EstateOS Luxury Property Card (2-Column Grid)
   -------------------------------------------------------------------------- */
.estate-card-item {
    background: #ffffff;
    border: 1px solid var(--estate-border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.estate-card-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px -8px rgba(15, 23, 42, 0.12);
    border-color: #93c5fd;
}

.estate-card-item.spotlight-card {
    border-color: var(--estate-primary) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35), 0 16px 32px -8px rgba(37, 99, 235, 0.25) !important;
    transform: translateY(-4px) scale(1.01);
}

.estate-card-media-wrap {
    width: 100%;
    aspect-ratio: 16 / 10;
    position: relative;
    overflow: hidden;
    background: #0f172a;
}

.estate-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.estate-card-item:hover .estate-card-thumb {
    transform: scale(1.08);
}

/* Card Badges */
.badge-verified-flag {
    background: var(--estate-green);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.04em;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}

.badge-category-flag {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.04em;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Card Action Buttons */
.estate-card-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.95);
    color: var(--estate-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.estate-card-icon-btn:hover {
    background: #ffffff;
    color: var(--estate-primary);
    transform: scale(1.08);
}

.estate-card-icon-btn.wishlist-active {
    background: #ffffff;
    color: #ef4444 !important;
}

/* Card Body Content */
.estate-card-content-wrap {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.estate-card-price {
    font-size: 19px;
    font-weight: 800;
    color: var(--estate-dark);
    letter-spacing: -0.02em;
    line-height: 1;
}

.estate-card-price .price-period {
    font-size: 12px;
    font-weight: 500;
    color: var(--estate-muted);
}

.estate-card-verified-status {
    color: var(--estate-green);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.estate-card-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--estate-dark);
    line-height: 1.35;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.estate-card-title a {
    color: var(--estate-dark);
    text-decoration: none;
    transition: color 0.2s ease;
}

.estate-card-title a:hover {
    color: var(--estate-primary);
}

.estate-card-location {
    font-size: 12px;
    color: var(--estate-muted);
    font-weight: 500;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.estate-card-specs {
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

.estate-card-specs .spec-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* --------------------------------------------------------------------------
   Right Column: Interactive Map Matrix & Toolbar
   -------------------------------------------------------------------------- */
.estate-map-matrix-card {
    background: #ffffff;
    border: 1px solid var(--estate-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    position: relative;
}

.estate-matrix-leaflet-map {
    height: calc(100vh - 220px);
    min-height: 560px;
    width: 100%;
    background: #e2e8f0;
}

/* Floating Map Toolbar */
.estate-map-toolbar {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 5px 8px;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.8);
    pointer-events: auto;
}

.estate-map-theme-group {
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
}

.map-theme-btn {
    border: none;
    background: transparent;
    color: var(--estate-muted);
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.map-theme-btn:hover {
    color: var(--estate-dark);
}

.map-theme-btn.active {
    background: #ffffff !important;
    color: var(--estate-primary) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.map-layer-btn {
    border: 1px solid var(--estate-border);
    background: #ffffff;
    color: var(--estate-dark);
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.map-layer-btn.active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: var(--estate-primary);
}

/* Bottom Telemetry Bar */
.estate-map-telemetry {
    background: #0f172a;
    color: #94a3b8;
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: 0.02em;
}

.telemetry-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--estate-green);
    box-shadow: 0 0 6px var(--estate-green);
}

.telemetry-text {
    color: #cbd5e1;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Custom Leaflet Price-Pill Markers & Popups
   -------------------------------------------------------------------------- */
.estate-price-icon-wrap {
    background: transparent !important;
    border: none !important;
}

.estate-map-price-pill {
    background: #ffffff;
    color: var(--estate-dark);
    font-weight: 800;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.25);
    border: 1.5px solid var(--estate-primary);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    text-align: center;
    display: inline-block;
}

.estate-map-price-pill:hover,
.estate-map-price-pill.spotlight {
    background: var(--estate-primary) !important;
    color: #ffffff !important;
    transform: scale(1.18);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.55) !important;
    border-color: #ffffff !important;
    z-index: 1000 !important;
}

/* Modern Leaflet Popup */
.leaflet-popup-content-wrapper {
    padding: 0 !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.22) !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    line-height: 1.4 !important;
    width: 260px !important;
}

.leaflet-container a.leaflet-popup-close-button {
    top: 8px !important;
    right: 8px !important;
    color: #ffffff !important;
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(4px) !important;
    border-radius: 50% !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    text-shadow: none !important;
}

.estate-map-popup-card {
    background: #ffffff;
}

.estate-map-popup-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.estate-map-popup-body {
    padding: 12px 14px;
}

.estate-map-popup-price {
    font-size: 17px;
    font-weight: 800;
    color: var(--estate-dark);
}

.estate-map-popup-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--estate-dark);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.estate-map-popup-link {
    display: block;
    text-align: center;
    background: var(--estate-primary);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    text-decoration: none;
    margin-top: 8px;
    transition: background 0.2s ease;
}

.estate-map-popup-link:hover {
    background: var(--estate-primary-hover);
    color: #ffffff;
}

/* Pagination Custom */
.customPaginagte .pagination {
    gap: 6px;
}

.customPaginagte .page-item .page-link {
    border-radius: 8px;
    border: 1px solid var(--estate-border);
    color: var(--estate-dark);
    font-weight: 600;
    font-size: 13px;
    padding: 6px 12px;
}

.customPaginagte .page-item.active .page-link {
    background: var(--estate-primary);
    border-color: var(--estate-primary);
    color: #ffffff;
}

/* Floating Mobile Map/List Toggle Button */
.estate-mobile-floating-toggle {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1060;
    display: none;
    background: #0f172a;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 30px;
    padding: 10px 22px;
    font-size: 13.5px;
    font-weight: 700;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.estate-mobile-floating-toggle:hover,
.estate-mobile-floating-toggle:active {
    background: #1e293b;
    color: #ffffff;
    transform: translateX(-50%) scale(1.04);
}

/* Responsive Rules for Search Page */
@media (max-width: 991.98px) {
    .estate-mobile-floating-toggle {
        display: inline-flex !important;
        align-items: center;
        gap: 8px;
    }

    .estate-cards-scroll-container {
        max-height: none !important;
        overflow-y: visible !important;
    }

    .estate-matrix-leaflet-map {
        height: 480px;
        min-height: 480px;
    }

    /* Mobile Views Toggle State */
    .estate-search-page-wrapper.mobile-map-active .estate-search-cards-col {
        display: none !important;
    }

    .estate-search-page-wrapper.mobile-map-active .estate-search-map-col {
        display: block !important;
    }

    .estate-search-page-wrapper:not(.mobile-map-active) .estate-search-map-col {
        display: none !important;
    }

    .estate-search-page-wrapper:not(.mobile-map-active) .estate-search-cards-col {
        display: block !important;
    }

    .estate-map-matrix-card {
        position: relative !important;
        top: 0 !important;
    }

    /* Category pills & top row on mobile */
    .estate-top-header-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px 0 !important;
    }

    .estate-top-title-wrap {
        order: 1 !important;
    }

    .estate-matrix-top-bar .estate-sort-wrap {
        order: 2 !important;
        width: auto !important;
        min-width: 130px !important;
        max-width: 155px !important;
        flex-shrink: 0 !important;
    }

    .estate-asset-pills-wrap {
        order: 3 !important;
        width: 100% !important;
        max-width: 100% !important;
        justify-content: flex-start !important;
        margin-top: 4px !important;
    }

    .estate-asset-pills {
        display: flex !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        max-width: 100% !important;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 6px !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    .estate-asset-pills::-webkit-scrollbar {
        display: none !important;
    }

    .estate-sort-select {
        width: 100% !important;
        height: 36px !important;
        border-radius: 12px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        padding: 4px 26px 4px 10px !important;
        background-color: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    }
}

@media (max-width: 575.98px) {
    .estate-search-page-wrapper {
        padding-top: 10px;
        padding-bottom: 70px;
    }

    .estate-filter-bar-card {
        padding: 10px 8px;
        border-radius: 12px;
    }

    .estate-filter-control {
        height: 42px;
        font-size: 13px;
        padding: 6px 10px;
    }

    /* Center popovers on small mobile devices */
    .estate-dropdown-popover {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 92vw !important;
        max-width: 360px !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        border-radius: 16px !important;
    }

    .estate-card-thumb {
        height: 190px;
    }

    .estate-card-price {
        font-size: 18px !important;
    }

    .estate-card-title {
        font-size: 14.5px !important;
    }

    .estate-map-toolbar {
        margin: 8px !important;
        flex-direction: column;
        align-items: flex-start !important;
    }

    .estate-map-theme-group button span {
        display: none;
    }

    .estate-map-theme-group button {
        padding: 6px 10px !important;
    }
}