/* =========================================================
   Woodhall Plot Map – Frontend styles  v1.3.5
   ========================================================= */

/* ── Block wrapper ────────────────────────────────────────── */
.wpm-map-block {
    --wpm-available:   #22c55e;
    --wpm-reserved:    #f59e0b;
    --wpm-sold:        #ef4444;
    --wpm-unavailable: #6b7280;
    --wpm-coming-soon: #3b82f6;
    --wpm-brand:       #c5601a;
    --wpm-ms:          18px;   /* admin dot-size, used to scale markers */
    font-family: inherit;
    width: 100%;
    position: relative;   /* panel is absolute-positioned inside this */
    /* isolation: isolate creates a local stacking context so ALL child
       z-indexes (panel, zoom buttons, tooltip) are self-contained.
       Fixed/sticky nav menus with high page-level z-indexes will naturally
       appear above the entire block without any further tweaking. */
    isolation: isolate;
}

/* ── Legend ───────────────────────────────────────────────── */
.wpm-frontend-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 13px;
    color: inherit;
}
.wpm-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    vertical-align: middle;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
    margin-right: 2px;
}
.wpm-available   { background: var(--wpm-available);   }
.wpm-reserved    { background: var(--wpm-reserved);    }
.wpm-sold        { background: var(--wpm-sold);        }
.wpm-unavailable { background: var(--wpm-unavailable); }
.wpm-coming-soon { background: var(--wpm-coming-soon); }

/* ── Map outer (the viewport / scroll container) ──────────── */
.wpm-map-outer {
    width: 100%;
    position: relative;
    overflow: visible;   /* allows hover chip to overhang at scale=1 */
    border-radius: 6px;
    -webkit-user-select: none;
    user-select: none;
    background: #f3f4f6;
}
/* When zoomed: clip the scaled content */
.wpm-map-outer.wpm-is-zoomed { overflow: hidden; cursor: grab; }
.wpm-map-outer.wpm-is-zoomed:active { cursor: grabbing; }

/* ── Map inner (the zoomable layer) ──────────────────────── */
.wpm-map-inner {
    position: relative;
    display: inline-block;
    line-height: 0;
    width: 100%;
    transform-origin: 0 0;
    /* No will-change — prevents baking a 1× GPU texture which causes blur */
}
.wpm-site-map {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
    border-radius: 6px;
}

/* ── Numbered plot marker ─────────────────────────────────── */
.wpm-hs {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Size scales with --wpm-ms set by admin */
    min-width: calc(var(--wpm-ms, 18px) * 1.3);
    height: calc(var(--wpm-ms, 18px) * 1.3);
    padding: 0 calc(var(--wpm-ms, 18px) * 0.35);
    border-radius: 0;
    border: 1.5px solid rgba(0,0,0,0.55);
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 10;
    transition: transform .12s ease, box-shadow .12s ease, z-index 0s;
    box-sizing: border-box;
}
.wpm-hs.wpm-available   { background: var(--wpm-available);   }
.wpm-hs.wpm-reserved    { background: var(--wpm-reserved);    }
.wpm-hs.wpm-sold        { background: var(--wpm-sold);        }
.wpm-hs.wpm-unavailable { background: var(--wpm-unavailable); }
.wpm-hs.wpm-coming-soon { background: var(--wpm-coming-soon); }

.wpm-hs:hover,
.wpm-hs:focus,
.wpm-hs:focus-visible,
.wpm-hs.wpm-hs--active {
    transform: translate(-50%, -50%) scale(1.25);
    box-shadow: 0 4px 14px rgba(0,0,0,.45);
    z-index: 50;
    outline: none;
}

/* ── Current-plot highlight (used by the Plot Page widget) ──── */
.wpm-hs.wpm-current {
    z-index: 40;
    box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
.wpm-hs.wpm-current::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(var(--wpm-ms, 18px) * 2.4);
    height: calc(var(--wpm-ms, 18px) * 2.4);
    transform: translate(-50%, -50%);
    border: 2px solid var(--wpm-brand, #c5601a);
    border-radius: 50%;
    opacity: .85;
    pointer-events: none;
    animation: wpm-current-pulse 1.6s ease-out infinite;
    box-sizing: border-box;
}
@keyframes wpm-current-pulse {
    0%   { transform: translate(-50%, -50%) scale(0.55); opacity: .9; }
    70%  { transform: translate(-50%, -50%) scale(1.25); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1.25); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .wpm-hs.wpm-current::before { animation: none; opacity: .9; }
}

/* Plot number text */
.wpm-hs-num {
    display: block;
    font-size: calc(var(--wpm-ms, 18px) * 0.58);
    font-weight: 800;
    color: #fff;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    letter-spacing: -.3px;
}

/* ── Shared hover tooltip (outside zoom layer, JS-positioned) ─ */
/* Lives inside .wpm-map-outer but NOT inside .wpm-map-inner,   */
/* so it is never affected by the CSS transform scale.           */
.wpm-hs-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(15,15,15,.82);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity .12s ease;
    z-index: 500;
    transform: translateX(-50%);
    letter-spacing: .1px;
}
.wpm-hs-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(15,15,15,.82);
}
.wpm-hs-tooltip.wpm-tt-visible { opacity: 1; }
/* Never show on touch devices */
@media (pointer: coarse) { .wpm-hs-tooltip { display: none !important; } }

/* ── Slide-in plot panel ──────────────────────────────────── */
.wpm-plot-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 250px;
    height: 100%;
    background: #fff;
    box-shadow: -6px 0 24px rgba(0,0,0,.18);
    border-radius: 0 6px 6px 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transform: translateX(101%);
    /* visibility: hidden prevents the translated-out panel from appearing as
       a strip to the right of the map and overlapping sticky nav menus.
       The 0s delay when opening ensures it's visible before transform starts;
       the .28s delay when closing hides it only after the slide-away finishes. */
    visibility: hidden;
    pointer-events: none;
    transition: transform .28s cubic-bezier(.4,0,.2,1),
                visibility 0s linear .28s;
    overflow: hidden;
}
.wpm-plot-panel.wpm-panel--open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    transition: transform .28s cubic-bezier(.4,0,.2,1),
                visibility 0s linear 0s;
}

/* Close button — uses <span role="button"> to avoid Elementor global button overrides */
.wpm-panel-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,.14);
    color: #333;
    font-size: 15px;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background .15s;
    -webkit-user-select: none;
    user-select: none;
}
.wpm-panel-close:hover { background: rgba(0,0,0,.26); }

/* Thumbnail area */
.wpm-panel-thumb {
    width: 100%;
    height: 150px;
    flex-shrink: 0;
    overflow: hidden;
    background: #e5e7eb;
}
.wpm-panel-thumb-inner {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.wpm-panel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Panel body */
.wpm-panel-body {
    padding: 16px 16px 20px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wpm-panel-plot-num {
    font-size: 20px;
    font-weight: 800;
    color: #1d2327;
    margin: 0;
    line-height: 1.2;
}
.wpm-panel-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #fff !important;
    width: fit-content;
}
.wpm-panel-badge.wpm-available   { background: var(--wpm-available);   }
.wpm-panel-badge.wpm-reserved    { background: var(--wpm-reserved);    }
.wpm-panel-badge.wpm-sold        { background: var(--wpm-sold);        }
.wpm-panel-badge.wpm-unavailable { background: var(--wpm-unavailable); }
.wpm-panel-badge.wpm-coming-soon { background: var(--wpm-coming-soon); }

.wpm-panel-type {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    display: none;
}
.wpm-panel-type.wpm-visible { display: block; }

.wpm-panel-price {
    font-size: 22px;
    font-weight: 700;
    color: #1d2327;
    margin: 4px 0 0;
    display: none;
}
.wpm-panel-price.wpm-visible { display: block; }

/* ── Beds / Baths feature strip ───────────────────────────── */
.wpm-panel-features {
    display: none;
    flex-direction: row;
    gap: 14px;
    margin: 2px 0 4px;
}
.wpm-panel-features.wpm-visible { display: flex; }

.wpm-pf-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}
.wpm-pf-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    color: var(--wpm-brand);
    stroke: var(--wpm-brand);
}

.wpm-panel-promo {
    font-size: 12px;
    color: #92400e;
    font-weight: 600;
    background: #fef3c7;
    padding: 6px 10px;
    border-radius: 4px;
    margin: 4px 0 0;
    display: none;
}
.wpm-panel-promo.wpm-visible { display: block; }

.wpm-panel-cta {
    display: block !important;
    margin-top: auto !important;
    padding: 12px 16px !important;
    background: var(--wpm-brand) !important;
    color: #fff !important;
    text-align: center !important;
    border-radius: 5px !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    text-decoration: none !important;
    transition: background .15s !important;
    border: none !important;
    letter-spacing: .2px !important;
    margin-top: 12px !important;
}
.wpm-panel-cta:hover { background: #a84e14 !important; color: #fff !important; }

/* ── Zoom controls ────────────────────────────────────────── */
.wpm-zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: all;
}
.wpm-zoom-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    border: 1px solid rgba(0,0,0,.18) !important;
    background: rgba(255,255,255,.92) !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.2) !important;
    color: #1d2327 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: background .12s ease !important;
    -webkit-user-select: none;
    user-select: none;
}
.wpm-zoom-btn:hover { background: #fff !important; }
.wpm-zoom-btn:disabled,
.wpm-zoom-btn[disabled] { opacity: .3 !important; cursor: default !important; pointer-events: none; }

/* ── Mobile hint ──────────────────────────────────────────── */
.wpm-mobile-hint {
    display: none;
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    margin: 6px 0 0;
    letter-spacing: .2px;
    transition: opacity .4s ease;
}
@media (max-width: 768px) and (pointer: coarse) {
    .wpm-mobile-hint { display: block; }
    .wpm-mobile-hint.wpm-hint-hidden { opacity: 0; pointer-events: none; }
}

/* ── Download map button ──────────────────────────────────── */
.wpm-map-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-start;
}
.wpm-download-map-pdf {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: var(--wpm-brand) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 50px !important;
    padding: 12px 26px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    transition: background .15s ease !important;
    letter-spacing: .2px !important;
}
.wpm-download-map-pdf:hover  { background: #a84e14 !important; }
.wpm-download-map-pdf:disabled,
.wpm-download-map-pdf.wpm-loading { background: #9ca3af !important; cursor: wait !important; }

/* ── Mobile: panel becomes a bottom sheet ─────────────────── */
@media (max-width: 640px) {
    .wpm-plot-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 82vh;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -6px 30px rgba(0,0,0,.22);
        transform: translateY(105%);
        flex-direction: row;   /* thumb left, body right on wide phones */
        overflow: hidden;
    }
    .wpm-plot-panel.wpm-panel--open { transform: translateY(0); }
    .wpm-panel-thumb {
        width: 130px;
        height: auto;
        flex-shrink: 0;
    }
    .wpm-panel-body { padding: 14px 14px 18px; }
    .wpm-panel-plot-num { font-size: 17px; }
    .wpm-panel-price    { font-size: 18px; }

}

/* ── Mobile (≤ 768px): dots at overview, chips when zoomed ─── */
/* At full-map view (scale = 1) markers collapse to small coloured
   circles so they don't overlap. When the user pinches in the map
   zooms and .wpm-is-zoomed is set, markers expand to numbered chips. */
@media (max-width: 768px) {

    /* Overview: tiny dot, number hidden */
    .wpm-map-outer:not(.wpm-is-zoomed) .wpm-hs {
        width: 9px;
        min-width: 9px;
        height: 9px;
        padding: 0;
        border-radius: 50%;
        border-width: 1.5px;
        box-shadow: 0 1px 3px rgba(0,0,0,.32);
    }
    .wpm-map-outer:not(.wpm-is-zoomed) .wpm-hs-num { display: none; }

    /* Zoomed: numbered chip (scaled down vs desktop) */
    .wpm-map-outer.wpm-is-zoomed .wpm-hs {
        min-width: calc(var(--wpm-ms, 18px) * 0.7);
        height: calc(var(--wpm-ms, 18px) * 0.7);
        padding: 0 calc(var(--wpm-ms, 18px) * 0.25);
        border-radius: 0;
    }
    .wpm-map-outer.wpm-is-zoomed .wpm-hs-num {
        display: block;
        font-size: calc(var(--wpm-ms, 18px) * 0.32);
    }

    /* Update hint text colour for visibility */
    .wpm-mobile-hint { font-size: 11px; }
}
