/* ============================================
   Map Preview Section — Home Page
   ============================================ */

.map-preview-section {
    padding: 5rem 0;
    background: linear-gradient(135deg, #0f172a 0%, #0c1a2e 40%, #0e2a3d 100%);
    position: relative;
    overflow: hidden;
}

/* Subtle animated background pattern */
.map-preview-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(6, 182, 212, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

/* Grid dots pattern */
.map-preview-section::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
}

.map-preview-section .section-header h2 {
    color: #f1f5f9;
}

.map-preview-section .section-header p {
    color: #94a3b8;
}

/* --- Layout: Map + Info side-by-side --- */
.map-preview-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 2.5rem;
    align-items: stretch;
    position: relative;
    z-index: 1;
}

/* --- Map Container (mini Leaflet map) --- */
.map-preview-container {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    min-height: 420px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(6, 182, 212, 0.15),
        inset 0 0 80px rgba(6, 182, 212, 0.03);
    transition: box-shadow 0.4s ease;
}

.map-preview-container:hover {
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(6, 182, 212, 0.25),
        0 0 40px rgba(6, 182, 212, 0.08);
}

#homePreviewMap {
    width: 100%;
    height: 100%;
    min-height: 420px;
    border-radius: 20px;
}

/* Subtle gradient overlay at top of map */
.map-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.3), transparent);
    z-index: 450;
    pointer-events: none;
    border-radius: 20px 20px 0 0;
}

/* --- Info Panel (right side) --- */
.map-preview-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Feature highlight cards */
.map-preview-feature {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.map-preview-feature::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.06), transparent 60%);
    opacity: 0;
    transition: opacity 0.35s;
}

.map-preview-feature:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(6, 182, 212, 0.25);
    transform: translateX(-4px);
}

.map-preview-feature:hover::before {
    opacity: 1;
}

.map-feature-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.map-feature-icon.icon-explore {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.08));
    color: #22d3ee;
}

.map-feature-icon.icon-filter {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.08));
    color: #a78bfa;
}

.map-feature-icon.icon-cluster {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.08));
    color: #34d399;
}

.map-feature-text {
    position: relative;
    z-index: 1;
}

.map-feature-text h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0 0 0.35rem;
    line-height: 1.3;
}

.map-feature-text p {
    font-size: 0.88rem;
    color: #94a3b8;
    margin: 0;
    line-height: 1.55;
}

/* --- Stats Row --- */
.map-preview-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.map-stat {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s;
}

.map-stat:hover {
    background: rgba(6, 182, 212, 0.08);
    border-color: rgba(6, 182, 212, 0.2);
}

.map-stat-number {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.map-stat-label {
    font-size: 0.72rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
    font-weight: 600;
}

/* --- CTA Button --- */
.map-preview-cta {
    margin-top: auto;
}

.btn-map-explore {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-map-explore::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.btn-map-explore:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(6, 182, 212, 0.45);
}

.btn-map-explore:hover::before {
    transform: translateX(100%);
}

.btn-map-explore i {
    font-size: 1.1rem;
    transition: transform 0.3s;
}

.btn-map-explore:hover i {
    transform: translateX(3px);
}

/* --- Leaflet overrides for preview map --- */
#homePreviewMap .leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2) !important;
    border-radius: 10px !important;
    overflow: hidden;
}

#homePreviewMap .leaflet-control-zoom a {
    background: rgba(15, 23, 42, 0.85) !important;
    color: #e2e8f0 !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 16px !important;
}

#homePreviewMap .leaflet-control-zoom a:hover {
    background: rgba(6, 182, 212, 0.3) !important;
    color: #fff !important;
}

/* Marker cluster overrides for preview */
#homePreviewMap .marker-cluster-small {
    background-color: rgba(6, 182, 212, 0.25) !important;
}
#homePreviewMap .marker-cluster-small div {
    background-color: #06b6d4 !important;
    color: #fff !important;
    font-weight: 700;
}
#homePreviewMap .marker-cluster-medium {
    background-color: rgba(8, 145, 178, 0.3) !important;
}
#homePreviewMap .marker-cluster-medium div {
    background-color: #0891b2 !important;
    color: #fff !important;
    font-weight: 700;
}
#homePreviewMap .marker-cluster-large {
    background-color: rgba(14, 116, 144, 0.35) !important;
}
#homePreviewMap .marker-cluster-large div {
    background-color: #0e7490 !important;
    color: #fff !important;
    font-weight: 700;
}

/* Popup overrides for preview map */
#homePreviewMap .leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25) !important;
    padding: 0 !important;
    overflow: hidden;
}

#homePreviewMap .leaflet-popup-content {
    margin: 12px 16px !important;
    line-height: 1.5 !important;
    font-family: 'Outfit', sans-serif;
}

#homePreviewMap .leaflet-popup-tip {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15) !important;
}

/* Preview popup style */
.preview-popup {
    min-width: 220px;
}

.preview-popup .popup-img {
    width: calc(100% + 32px);
    height: 110px;
    object-fit: cover;
    margin: -12px -16px 8px;
    display: block;
}

.preview-popup .popup-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.2rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-popup .popup-price {
    font-size: 0.9rem;
    font-weight: 800;
    color: #06b6d4;
    margin: 0 0 0.25rem;
}

.preview-popup .popup-location {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0 0 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.preview-popup .popup-location i {
    color: #06b6d4;
    font-size: 0.7rem;
}

.preview-popup .popup-link {
    display: block;
    text-align: center;
    padding: 0.4rem 0.75rem;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    transition: all 0.2s;
}

.preview-popup .popup-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(6, 182, 212, 0.3);
}

/* Custom marker styling for preview */
.map-preview-container .custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    border: 2.5px solid #fff;
    transition: transform 0.2s;
}

.map-preview-container .custom-marker i {
    transform: rotate(45deg);
    font-size: 12px;
    color: #fff;
}

.map-preview-container .custom-marker:hover {
    transform: rotate(-45deg) scale(1.2);
}

/* Dark tile styling */
#homePreviewMap .leaflet-tile-pane {
    filter: saturate(0.85) brightness(0.95);
}

/* Attribution styling */
#homePreviewMap .leaflet-control-attribution {
    background: rgba(15, 23, 42, 0.7) !important;
    color: #64748b !important;
    font-size: 0.65rem !important;
    border-radius: 6px 0 0 0;
    backdrop-filter: blur(8px);
}

#homePreviewMap .leaflet-control-attribution a {
    color: #94a3b8 !important;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .map-preview-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .map-preview-container {
        min-height: 350px;
    }

    #homePreviewMap {
        min-height: 350px;
    }

    .map-preview-info {
        gap: 1.25rem;
    }
}

@media (max-width: 768px) {
    .map-preview-section {
        padding: 3.5rem 0;
    }

    .map-preview-container {
        min-height: 280px;
        border-radius: 16px;
    }

    #homePreviewMap {
        min-height: 280px;
        border-radius: 16px;
    }

    .map-preview-feature {
        padding: 1.25rem;
        gap: 1rem;
    }

    .map-feature-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        font-size: 1.1rem;
    }

    .map-preview-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .map-stat {
        padding: 0.75rem 0.5rem;
    }

    .map-stat-number {
        font-size: 1.25rem;
    }

    .map-stat-label {
        font-size: 0.65rem;
    }

    .btn-map-explore {
        padding: 0.85rem 1.5rem;
        font-size: 0.95rem;
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .map-preview-container {
        min-height: 240px;
    }

    #homePreviewMap {
        min-height: 240px;
    }

    .map-preview-feature {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
        align-items: center;
    }

    .map-preview-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}
