/*
    Path in theme: platform/themes/real-scout/public/css/home-page-new/properties-map.css
    Loaded via:    config.php's beforeRenderTheme, gated on route name "public.properties".
    Paired JS:     js/new-home-page/properties-map.js (Leaflet init, marker/popup rendering,
                    AJAX re-fetch on search submit, "My Location" recenter).
*/

:root {
    --header-navy: #1a1d24;
    --header-navy-light: #22262f;
    --header-gold: #e0a63e;
    --header-gold-hover: #cf9530;
    --header-white: #ffffff;
    --header-font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --header-font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --header-max-width: 1320px;
}

.properties-map-section {
    background: #f6f5f3;
    padding: 56px 0 72px;
    font-family: var(--header-font-body);
}

.properties-map-section * {
    box-sizing: border-box;
}

.properties-map-section__inner {
    max-width: var(--header-max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.properties-map-section__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.properties-map-section__eyebrow {
    display: block;
    color: var(--header-gold);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.properties-map-section__heading {
    font-family: var(--header-font-heading);
    font-weight: 700;
    color: var(--header-navy);
    font-size: 32px;
    line-height: 1.2;
    margin: 0 0 10px;
}

.properties-map-section__text {
    color: #6b7280;
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
    max-width: 560px;
}

.properties-map-section__location-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--header-white);
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px 20px;
    font-family: var(--header-font-body);
    font-weight: 600;
    font-size: 14px;
    color: var(--header-navy);
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.properties-map-section__location-btn:hover {
    border-color: var(--header-gold);
    color: var(--header-gold-hover);
}

.properties-map-section__location-btn i {
    color: var(--header-gold);
}

/* ---- Map canvas ---- */
.properties-map {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(26, 29, 36, 0.08);
}

.properties-map-canvas {
    height: 520px;
    width: 100%;
    background: #e9e9e9;
}

.properties-map__count-badge {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 500;
    background: var(--header-white);
    border-radius: 999px;
    padding: 10px 18px;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--header-navy);
    box-shadow: 0 6px 16px rgba(26, 29, 36, 0.15);
}

/* ---- Custom pin marker (L.divIcon) ---- */
.properties-map-pin {
    width: 34px;
    height: 34px;
    border-radius: 50% 50% 50% 0;
    background: var(--header-gold);
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--header-white);
}

.properties-map-pin span {
    transform: rotate(45deg);
    color: var(--header-navy);
    font-weight: 700;
    font-size: 13px;
}

/* ---- Popup content ---- */
.leaflet-popup-content-wrapper {
    border-radius: 10px;
}

/*
   style.css has a global ".leaflet-popup-content-wrapper / -content
   { width: 380px / 350px !important }" rule left over from another map
   elsewhere in the theme, which overrides this popup's intended width
   regardless of source order. These two-class selectors outrank that
   single-class rule even though both are !important.
*/
.properties-map-popup-leaflet .leaflet-popup-content-wrapper {
    width: 270px !important;
}

.properties-map-popup-leaflet .leaflet-popup-content {
    width: 230px !important;
}

.properties-map-popup {
    width: 230px;
    font-family: var(--header-font-body);
}

.properties-map-popup__image {
    display: block;
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}

.properties-map-popup__price {
    color: var(--header-gold-hover);
    font-weight: 700;
    font-size: 14px;
    margin: 0 0 4px;
}

.properties-map-popup__title {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0;
    width: fit-content;
    max-width: 100%;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    margin: 0 0 6px;
    cursor: pointer;
    transition: color 0.2s ease, gap 0.2s ease;
}

/*
   style.css's global ".leaflet-container a { color: black !important;
   font-size: 17px !important }" (left over from another map elsewhere in
   the theme) otherwise silently overrides this link's color and size, and
   would also block the :hover color change below - !important alone isn't
   enough to beat it, since that rule's class+element selector (0,1,1)
   outranks a plain ".properties-map-popup__title" (0,1,0). Scoping through
   the popup's own className (0,2,0) wins on specificity instead.
*/
.properties-map-popup-leaflet .properties-map-popup__title {
    color: var(--header-navy) !important;
    font-size: 13.5px !important;
}

.properties-map-popup__title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.properties-map-popup__title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.properties-map-popup__title-arrow {
    font-size: 10px;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.properties-map-popup-leaflet .properties-map-popup__title:hover {
    color: var(--header-gold-hover) !important;
    gap: 6px;
}

.properties-map-popup__title:hover::after {
    transform: scaleX(1);
}

.properties-map-popup__title:hover .properties-map-popup__title-arrow {
    opacity: 1;
    transform: translateX(0);
}

.properties-map-popup__location {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #6b7280;
    font-size: 12px;
    margin: 0 0 8px;
}

.properties-map-popup__location i {
    color: var(--header-gold);
    font-size: 11px;
}

.properties-map-popup__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid #ececec;
}

.properties-map-popup__meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--header-navy);
    font-size: 12px;
    font-weight: 500;
}

.properties-map-popup__meta i {
    color: var(--header-gold);
    font-size: 11px;
}

.properties-map-section__empty {
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    padding: 16px 0 0;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 640px) {
    .properties-map-section {
        padding: 40px 0 56px;
    }

    .properties-map-section__heading {
        font-size: 26px;
    }

    .properties-map-canvas {
        height: 380px;
    }

    .properties-map-section__location-btn {
        width: 100%;
        justify-content: center;
    }
}
