/* =========================================================
   MAXIMUS REAL ESTATE - APPLE STYLE MAP CARD
   Child theme custom Leaflet popup
========================================================= */

/* ---------- Leaflet popup base ---------- */

body .leaflet-popup,
.leaflet-fade-anim .leaflet-popup {
    border-radius: 26px !important;
    overflow: visible !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", sans-serif !important;
}

/* Wrapper esterno Leaflet */
body .leaflet-popup-content-wrapper {
    width: auto !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 26px !important;
    overflow: visible !important;
}

/* Contenitore della card */
body .leaflet-popup-content {
    width: 306px !important;
    max-width: calc(100vw - 22px) !important;
    min-width: 280px !important;

    margin: 0 !important;
    padding: 0 !important;

    border-radius: 26px !important;
    overflow: visible !important;
}

/* Nasconde la punta standard Leaflet */
body .leaflet-popup-tip-container {
    display: none !important;
}

/* Neutralizza wrapper originale Houzez */
body .leaflet-popup .property-info-window {
    width: 100% !important;

    margin: 0 !important;
    padding: 0 !important;

    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;

    border-radius: 26px !important;
    overflow: visible !important;
}

/* ---------- Card principale ---------- */

.mx-map-card {
    position: relative;
    overflow: hidden;

    width: 100%;
    max-width: 100%;
    box-sizing: border-box;

    border-radius: 26px;
    background: rgba(255, 255, 255, 0.975);
    border: 1px solid rgba(255, 255, 255, 0.88);

    backdrop-filter: blur(24px) saturate(165%);
    -webkit-backdrop-filter: blur(24px) saturate(165%);

    box-shadow:
        0 24px 58px rgba(0, 0, 0, 0.18),
        0 8px 18px rgba(0, 0, 0, 0.075),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);

    animation: mxMapCardFadeIn 0.18s ease-out;
}

/* Solo fade, niente transform */
@keyframes mxMapCardFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ---------- Foto ---------- */

.mx-map-card__media {
    position: relative;
    display: block;
    width: 100%;

    aspect-ratio: 1.34 / 1;
    overflow: hidden;

    border-radius: 26px 26px 0 0;
    background: #eef1f5;
    text-decoration: none;
}

.mx-map-card__media img {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    display: block;
    object-fit: cover;
    object-position: center center;

    transform: scale(1.01);
    transition: transform 0.45s ease;
}

.mx-map-card:hover .mx-map-card__media img {
    transform: scale(1.04);
}

/* Overlay foto */
.mx-map-card__shade {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;

    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0) 30%),
        linear-gradient(to top, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0) 50%);
}

/* ---------- Badge In Evidenza ---------- */

.mx-map-card__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;

    display: inline-flex;
    align-items: center;

    padding: 7px 11px;
    border-radius: 999px;

    background: linear-gradient(135deg, #34d66d, #19bb5a);
    color: #ffffff;

    font-size: 10px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0.35px;
    text-transform: uppercase;

    box-shadow:
        0 8px 18px rgba(25, 187, 90, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.30);
}

/* ---------- Prezzo Apple Liquid Glass scuro ---------- */

.mx-map-card__price {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 3;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    max-width: calc(100% - 24px);

    padding: 8px 13px;

    border: none !important;
    outline: none !important;
    border-radius: 18px;

    background:
        radial-gradient(
            circle at 20% 12%,
            rgba(255, 255, 255, 0.18),
            rgba(255, 255, 255, 0.06) 34%,
            rgba(255, 255, 255, 0.015) 100%
        ),
        linear-gradient(
            135deg,
            rgba(18, 25, 38, 0.68),
            rgba(14, 22, 36, 0.44)
        );

    backdrop-filter: blur(2px) saturate(185%) contrast(1.08);
    -webkit-backdrop-filter: blur(2px) saturate(185%) contrast(1.08);

    color: #ffffff;

    font-size: 22px;
    line-height: 1;
    font-weight: 850;
    letter-spacing: -0.55px;

    text-shadow:
        0 1px 1px rgba(0, 0, 0, 0.30),
        0 4px 14px rgba(0, 0, 0, 0.34);

    box-shadow:
        0 14px 34px rgba(0, 0, 0, 0.24),
        0 4px 10px rgba(0, 0, 0, 0.12) !important;

    overflow: hidden;
    isolation: isolate;

    transform: none !important;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.mx-map-card__price::before {
    content: none !important;
    display: none !important;
}

.mx-map-card__price::after {
    content: none !important;
    display: none !important;
}

/* ---------- Corpo ---------- */

.mx-map-card__body {
    padding: 13px 12px 12px;
}

/* Titolo */
.mx-map-card__title {
    margin: 0 0 12px;

    color: #1b2030;

    font-size: 17px;
    line-height: 1.2;
    font-weight: 850;
    letter-spacing: -0.32px;

    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =========================================================
   Statistiche senza contenitore esterno visibile
========================================================= */

.mx-map-card__stats {
    display: grid;
    grid-template-columns: 0.95fr 0.95fr 1.1fr;
    gap: 8px;

    padding: 0;
    margin: 0;

    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/* I 3 badge delle icone: stesso radius del prezzo */
.mx-map-card__stat {
    min-height: 44px;
    padding: 9px 9px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    border-radius: 18px;

    background: linear-gradient(180deg, #ffffff, #fbfbfc);
    border: 1px solid rgba(17, 24, 39, 0.06);

    box-shadow:
        0 3px 9px rgba(15, 23, 42, 0.055),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);

    white-space: nowrap;

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}

.mx-map-card__stat:hover {
    transform: translateY(-1px);
    background: #ffffff;

    box-shadow:
        0 6px 14px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

.mx-map-card__stat i {
    flex: 0 0 15px;
    font-size: 15px;
    line-height: 1;
    color: #8b95a7;
}

.mx-map-card__value {
    display: inline-block;

    color: #151821;

    font-size: 21px;
    line-height: 1;
    font-weight: 850;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;

    white-space: nowrap;
}

/* Superficie: numero + unità */
.mx-map-card__value--area {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    white-space: nowrap;
}

.mx-map-card__number {
    font-size: 21px;
    font-weight: 850;
    line-height: 1;
    letter-spacing: -0.05em;
}

.mx-map-card__unit {
    font-size: 12px;
    font-weight: 750;
    line-height: 1;
    color: #6b7280;
    letter-spacing: -0.02em;
}

/* ---------- Bottone chiusura Leaflet ---------- */

body .leaflet-popup-close-button {
    top: 12px !important;
    right: 12px !important;
    z-index: 100 !important;

    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.90) !important;
    color: #272b34 !important;

    font-size: 26px !important;
    line-height: 1 !important;
    font-weight: 300 !important;
    text-decoration: none !important;

    backdrop-filter: blur(16px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(160%) !important;

    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.88) !important;

    transition:
        transform 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease !important;
}

body .leaflet-popup-close-button:hover {
    background: rgba(255, 255, 255, 0.98) !important;
    transform: scale(1.05) !important;

    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.94) !important;
}

body .leaflet-popup-close-button span {
    line-height: 1 !important;
    transform: translateY(-1px);
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
    body .leaflet-popup,
    .leaflet-fade-anim .leaflet-popup,
    body .leaflet-popup-content-wrapper,
    body .leaflet-popup-content,
    body .leaflet-popup .property-info-window {
        border-radius: 24px !important;
    }

    body .leaflet-popup-content {
        width: 286px !important;
        max-width: calc(100vw - 14px) !important;
        min-width: 0 !important;
    }

    .mx-map-card {
        width: 100%;
        max-width: 100%;
        border-radius: 24px;
    }

    .mx-map-card__media {
        border-radius: 24px 24px 0 0;
        aspect-ratio: 1.30 / 1;
    }

    .mx-map-card__badge {
        top: 10px;
        left: 10px;
        padding: 7px 10px;
        font-size: 10px;
    }

    .mx-map-card__price {
        left: 10px;
        bottom: 10px;
        padding: 7px 12px;
        font-size: 21px;
        border-radius: 17px;

        border: none !important;
        outline: none !important;

        background:
            radial-gradient(
                circle at 20% 12%,
                rgba(255, 255, 255, 0.16),
                rgba(255, 255, 255, 0.055) 34%,
                rgba(255, 255, 255, 0.015) 100%
            ),
            linear-gradient(
                135deg,
                rgba(18, 25, 38, 0.70),
                rgba(14, 22, 36, 0.46)
            );

        backdrop-filter: blur(2px) saturate(185%) contrast(1.08);
        -webkit-backdrop-filter: blur(2px) saturate(185%) contrast(1.08);

        box-shadow:
            0 12px 30px rgba(0, 0, 0, 0.24),
            0 4px 10px rgba(0, 0, 0, 0.12) !important;
    }

    .mx-map-card__price::before,
    .mx-map-card__price::after {
        content: none !important;
        display: none !important;
    }

    .mx-map-card__body {
        padding: 12px 10px 10px;
    }

    .mx-map-card__title {
        font-size: 16.5px;
        margin-bottom: 10px;
    }

    .mx-map-card__stats {
        grid-template-columns: 0.95fr 0.95fr 1.1fr;
        gap: 7px;

        padding: 0;
        margin: 0;

        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .mx-map-card__stat {
        min-height: 42px;
        padding: 8px 7px;
        gap: 6px;

        border-radius: 17px;
    }

    .mx-map-card__stat i {
        font-size: 14px;
        flex-basis: 14px;
    }

    .mx-map-card__value {
        font-size: 20px;
    }

    .mx-map-card__number {
        font-size: 20px;
    }

    .mx-map-card__unit {
        font-size: 11.5px;
    }

    body .leaflet-popup-close-button {
        width: 36px !important;
        height: 36px !important;
        font-size: 24px !important;
    }
}