/* ==========================================================================
   Map View Styling (ระบบค้นหาทรัพย์สิน - มุมมองแผนที่)
   ========================================================================== */

/* Full Layout */
:root, html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    overscroll-behavior-x: none;
    -webkit-overflow-scrolling: auto;
    font-family: 'Noto Sans Thai', 'Inter', sans-serif;
}

.map-page-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Header Tweaks for Map View */
.map-header {
    flex-shrink: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.map-header .header-container {
    max-width: 100%;
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: nowrap;
}

/* Autocomplete Search Box */
.map-search-container {
    position: relative;
    flex: 1;
    min-width: 280px;
    max-width: 760px;
    margin: 0 0.75rem;
}

.map-search-input-wrap {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 0.4rem 0.9rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.map-search-input-wrap:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.map-search-input-wrap i.search-icon {
    color: #64748b;
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

.map-search-input-wrap input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.85rem;
    font-family: inherit;
    background: transparent;
    color: var(--text-main);
}

.map-search-clear {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0 0.2rem;
    display: none;
}

.map-search-clear:hover {
    color: #ef4444;
}

/* Autocomplete Dropdown */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 520px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    z-index: 2000;
    display: none;
}

.search-results-dropdown.show {
    display: block;
}

.search-result-item {
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

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

.search-result-item:hover,
.search-result-item.selected {
    background-color: #f1f5f9;
}

.search-result-badge {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.search-result-title mark {
    background-color: #fef08a;
    color: #854d0e;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 700;
}

.search-match-tag {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.2px;
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
}

.search-match-tag.match-exact {
    background: #dbeafe;
    color: #1e40af;
}

.search-match-tag.match-prefix {
    background: #f1f5f9;
    color: #475569;
}

.search-match-tag.match-phonetic {
    background: #ede9fe;
    color: #6d28d9;
}

.search-match-tag.match-typo {
    background: #ffedd5;
    color: #c2410c;
}

.search-match-tag.match-layout {
    background: #ccfbf1;
    color: #0f766e;
}

.search-layout-hint {
    padding: 0.5rem 0.85rem;
    background: #eff6ff;
    border-bottom: 1px solid #dbeafe;
    font-size: 0.78rem;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.search-result-meta {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-price {
    font-size: 0.78rem;
    color: #059669;
    font-weight: 600;
    margin-top: 2px;
}

.search-no-results {
    padding: 1.5rem;
    text-align: center;
    color: #64748b;
    font-size: 0.85rem;
}

.search-results-footer {
    padding: 0.5rem 0.85rem;
    text-align: center;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 500;
    background: rgba(248, 250, 252, 0.95);
    border-top: 1px solid #e2e8f0;
    position: sticky;
    bottom: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10;
}

/* Top Filter Toolbar */
.map-filter-toolbar {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 1.5rem;
    z-index: 999;
    transition: all 0.3s ease;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.map-filter-toolbar .multi-select-btn {
    min-width: 125px;
    height: 32px;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: border-color 0.2s;
}

.map-filter-toolbar .multi-select-btn:hover {
    border-color: var(--primary-color);
}

.map-filter-toolbar .filter-input {
    height: 32px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.map-filter-toolbar .filter-input:focus {
    border-color: var(--primary-color);
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.range-inputs input {
    width: 85px;
}

/* More Filters Expandable Panel */
.more-filters-panel {
    display: none;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
    gap: 0.75rem;
    flex-wrap: wrap;
}

.more-filters-panel.show {
    display: flex;
}

/* Map Container */
.map-main {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
}

#map {
    width: 100%;
    height: 100%;
    background-color: #e5e7eb;
    touch-action: pan-x pan-y;
    overscroll-behavior: none;
}

.map-sidebar-content,
.map-search-results,
.map-filters-panel,
.custom-leaflet-popup .leaflet-popup-content {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Custom Map Pins */
.custom-map-pin {
    background: transparent;
    border: none;
}

/* Custom Pin Wrapper with Heart Badge */
.custom-pin-wrap {
    position: relative;
    width: 32px;
    height: 38px;
}

.pin-marker {
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    border: 2px solid #ffffff;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
}

.pin-marker i {
    transform: rotate(45deg);
    color: #ffffff;
    font-size: 13px;
}

.pin-marker.pin-closed-price {
    box-shadow: 0 4px 10px rgba(56, 189, 248, 0.45), 0 2px 4px rgba(0, 0, 0, 0.25);
}

.pin-marker.pin-closed-price i {
    filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.4));
}

.pin-heart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 17px;
    height: 17px;
    background-color: #ffffff;
    border: 1.5px solid #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 10;
    pointer-events: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pin-heart-badge i {
    color: #ef4444 !important;
    font-size: 9px !important;
    transform: none !important;
}

.pin-heart-badge.hidden {
    display: none !important;
}

.pin-marker:hover + .pin-heart-badge,
.pin-marker.highlighted + .pin-heart-badge {
    transform: scale(1.25);
}

/* Cluster Heart Badge & Indicator */
.marker-cluster {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.marker-cluster > div {
    position: relative;
}

.marker-cluster.has-heart-child {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.75), 0 4px 14px rgba(239, 68, 68, 0.45) !important;
}

.marker-cluster.has-heart-child > div {
    box-shadow: 0 0 0 1.5px rgba(239, 68, 68, 0.5);
}

.marker-cluster .cluster-heart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background-color: #ffffff;
    border: 1.5px solid #ef4444;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    z-index: 25;
    pointer-events: none;
    line-height: 1 !important;
    animation: heart-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.marker-cluster .cluster-heart-badge i {
    color: #ef4444;
    font-size: 10px;
    line-height: 1 !important;
}

.marker-cluster .cluster-heart-count {
    color: #ef4444;
    font-size: 9px;
    font-weight: 800;
    line-height: 1 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.pin-marker:hover,
.pin-marker.highlighted {
    transform: rotate(-45deg) scale(1.25);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
    z-index: 1000 !important;
}

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

.pin-marker.pulse-pin {
    animation: pin-pulse 1.8s infinite;
}

/* Single Pin Selection Floating Banner */
.single-pin-banner {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 0.4rem 0.6rem 0.4rem 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 90vw;
    animation: slideDownFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.single-pin-banner.hidden {
    display: none !important;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translate(-50%, -12px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.single-pin-banner-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    max-width: 500px;
}

.single-pin-badge {
    background: var(--primary-color);
    color: white;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.single-pin-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.single-pin-reset-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.single-pin-reset-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

/* Floating Map Legend */
.map-legend {
    position: absolute;
    bottom: 24px;
    right: 20px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    z-index: 800;
    font-size: 0.8rem;
    min-width: 200px;
}

.map-legend-title {
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s;
    user-select: none;
}

.legend-item:hover {
    background-color: #f1f5f9;
}

.legend-item.active {
    background-color: #e0f2fe;
    box-shadow: inset 0 0 0 1.5px #0284c7;
}

.legend-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.legend-count {
    font-weight: 700;
    color: #475569;
    font-size: 0.75rem;
    background: #e2e8f0;
    padding: 1px 6px;
    border-radius: 10px;
}

/* Floating Quick Actions */
.map-floating-tools {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 800;
}

.map-tool-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: white;
    border: 1px solid #cbd5e1;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    font-size: 1rem;
}

.map-tool-btn:hover {
    background: #f8fafc;
    color: var(--primary-color);
    transform: translateY(-1px);
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    padding: 0;
    overflow: hidden;
}

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

.popup-card {
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Floating Heart Button in Popup Card */
.popup-heart-btn {
    position: absolute;
    top: 8px;
    right: 36px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    z-index: 25;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 0;
}

.popup-heart-btn:hover {
    transform: scale(1.15);
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.popup-heart-btn:active {
    transform: scale(0.9);
}

.popup-heart-btn i {
    font-size: 15px;
    color: #94a3b8; /* faint outline heart */
    transition: color 0.2s, transform 0.2s;
}

.popup-heart-btn:hover i {
    color: #f87171;
}

.popup-heart-btn.active {
    background: #fff1f2;
    border-color: #fecdd3;
}

.popup-heart-btn.active i {
    color: #ef4444; /* bright red */
    animation: heart-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heart-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.popup-thumb-wrap {
    width: 100%;
    height: 130px;
    background-color: #f1f5f9;
    position: relative;
    overflow: hidden;
}

.popup-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.popup-body {
    padding: 0.85rem;
}

.popup-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Editable Title in Popup */
.popup-title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 0.35rem;
    position: relative;
}

.popup-title-wrap .popup-title {
    margin-bottom: 0;
    flex: 1;
}

.popup-title.popup-title-editable {
    cursor: text;
    padding: 2px 6px;
    margin-left: -6px;
    border-radius: 4px;
    border: 1px dashed transparent;
    transition: background-color 0.15s, border-color 0.15s;
    min-height: 1.4em;
    word-break: break-word;
}

.popup-title.popup-title-editable:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}

.popup-title.popup-title-editable:empty::before {
    content: 'คลิกเพื่อใส่ชื่อทรัพย์...';
    color: #94a3b8;
    font-style: italic;
    font-weight: 400;
}

.popup-title.popup-title-editable.is-editing,
.popup-title.popup-title-editable:focus {
    outline: none;
    background-color: #ffffff;
    border-color: #2563eb;
    border-style: solid;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    -webkit-line-clamp: unset !important;
    line-clamp: unset !important;
    overflow: visible !important;
}

.popup-title-edit-icon {
    font-size: 0.78rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 3px 2px;
    transition: color 0.15s, transform 0.15s;
    flex-shrink: 0;
}

.popup-title-wrap:hover .popup-title-edit-icon {
    color: #2563eb;
}

.popup-title-edit-icon:hover {
    transform: scale(1.15);
}

.popup-title-save-status {
    position: absolute;
    right: 0;
    top: -22px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    animation: fadeIn 0.2s ease;
}

.popup-title-save-status.saving {
    background-color: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.popup-title-save-status.success {
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.popup-title-save-status.error {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.popup-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.76rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.popup-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: #059669;
    margin: 0.4rem 0;
}

.popup-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.popup-tag-badge {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 4px;
    background: #e2e8f0;
    color: #475569;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Editable Status / Action / Grade / Tag section */
.popup-fields-section {
    margin: 0.45rem 0 0.55rem 0;
    padding: 0.45rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.popup-fields-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 0.35rem;
}

.popup-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.popup-field-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.popup-field-label {
    font-size: 0.66rem;
    font-weight: 600;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 3px;
}

.popup-field-select {
    width: 100%;
    height: 27px;
    padding: 0 4px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 5px;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.popup-field-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.popup-field-save-toast {
    font-size: 0.66rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    animation: fadeIn 0.2s ease;
}

.popup-field-save-toast.saving {
    background-color: #eff6ff;
    color: #2563eb;
}

.popup-field-save-toast.success {
    background-color: #ecfdf5;
    color: #059669;
}

.popup-field-save-toast.error {
    background-color: #fef2f2;
    color: #dc2626;
}

.popup-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.popup-btn {
    flex: 1;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    transition: opacity 0.2s;
}

.popup-btn:hover {
    opacity: 0.9;
}

.popup-btn-detail {
    background: var(--primary-color);
    color: white;
}

.popup-btn-map {
    background: #e2e8f0;
    color: #334155;
}

/* Cluster styling override for cleaner look */
.marker-cluster-small {
    background-color: rgba(37, 99, 235, 0.25) !important;
}
.marker-cluster-small div {
    background-color: rgba(37, 99, 235, 0.85) !important;
    color: white !important;
    font-weight: 700 !important;
}

.marker-cluster-medium {
    background-color: rgba(245, 158, 11, 0.25) !important;
}
.marker-cluster-medium div {
    background-color: rgba(245, 158, 11, 0.85) !important;
    color: white !important;
    font-weight: 700 !important;
}

.marker-cluster-large {
    background-color: rgba(239, 68, 68, 0.25) !important;
}
.marker-cluster-large div {
    background-color: rgba(239, 68, 68, 0.85) !important;
    color: white !important;
    font-weight: 700 !important;
}

/* Loading Overlay */
.map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    transition: opacity 0.3s;
}

.map-loading-overlay.hidden {
    display: none;
}

.map-spinner {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

@media (max-width: 900px) {
    .map-header .header-container {
        flex-wrap: wrap;
        padding: 0.5rem 1rem;
    }
    .map-search-container {
        width: 100%;
        max-width: none;
        order: 3;
        margin: 0.4rem 0 0 0;
    }
}
