/* =============================================
   Fernwood Hills — Interactive Lot Map Styles
   ============================================= */

/* Wrapper */
.fhl-map-wrapper {
    position: relative;
    width: 100%;
    font-family: inherit;
}

/* Legend */
.fhl-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    width: fit-content;
}

.fhl-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}

.fhl-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}
.fhl-dot--active         { background: #22c55e; }
.fhl-dot--under_contract { background: #f59e0b; }
.fhl-dot--sold           { background: #ef4444; }
.fhl-dot--coming_soon    { background: #94a3b8; }

/* Map Container — responsive aspect-ratio box */
.fhl-map-container {
    position: relative;
    width: 100%;
    /* Match blank image: 1536 × 1024 = 3:2 ratio */
    aspect-ratio: 1536 / 1024;
    overflow: hidden;  /* ← CRITICAL: keeps color fills inside container */
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    touch-action: pan-y; /* allow vertical scroll on mobile */
}

/* Base image fills container fully */
.fhl-map-base {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;  /* stretch to fill exactly */
    display: block;
    user-select: none;
    pointer-events: none;
}

/* SVG overlay — sits exactly on top of image */
.fhl-map-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible; /* SVG internal paths can bleed within viewBox */
}

/* Individual lot paths */
.fhl-lot {
    fill: transparent;
    stroke: transparent;
    stroke-width: 0;
    cursor: pointer;
    transition: fill 0.2s ease, opacity 0.2s ease;
    outline: none;
}

/* Hover / focus state — darken fill */
.fhl-lot:hover,
.fhl-lot:focus {
    opacity: 0.75 !important;
    stroke: rgba(0,0,0,0.5);
    stroke-width: 1.5px;
}

/* Active / keyboard focus ring */
.fhl-lot:focus-visible {
    stroke: #1d4ed8;
    stroke-width: 2.5px;
}

/* Status fill colors (set via JS) */
.fhl-lot[data-status="active"]         { fill: rgba(34, 197, 94,  0.45); }
.fhl-lot[data-status="under_contract"] { fill: rgba(245, 158, 11, 0.45); }
.fhl-lot[data-status="sold"]           { fill: rgba(239, 68,  68,  0.45); }
.fhl-lot[data-status="coming_soon"]    { fill: rgba(148, 163, 184, 0.35); }

/* Lot number labels */
.fhl-lot-label {
    font-size: 11px;
    font-weight: 700;
    fill: #1e293b;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
    user-select: none;
    paint-order: stroke fill;
    stroke: #fff;
    stroke-width: 3px;
}

/* ─── Tooltip ─── */
.fhl-tooltip {
    position: absolute;
    background: #1e293b;
    color: #f8fafc;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 100;
    min-width: 180px;
    max-width: 240px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.28);
    white-space: nowrap;
    /* Start hidden above */
    transform: translateY(-4px);
}

.fhl-tooltip.fhl-tooltip--visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.fhl-tooltip-lot {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
    margin-bottom: 2px;
}

.fhl-tooltip-address {
    font-weight: 600;
    font-size: 13px;
    color: #f1f5f9;
    margin-bottom: 2px;
    white-space: normal;
}

.fhl-tooltip-price {
    font-size: 14px;
    font-weight: 700;
    color: #4ade80;
    margin-bottom: 4px;
}

.fhl-tooltip-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.fhl-tooltip-status[data-status="active"]         { background: #166534; color: #bbf7d0; }
.fhl-tooltip-status[data-status="under_contract"] { background: #78350f; color: #fde68a; }
.fhl-tooltip-status[data-status="sold"]           { background: #7f1d1d; color: #fecaca; }
.fhl-tooltip-status[data-status="coming_soon"]    { background: #334155; color: #cbd5e1; }

.fhl-tooltip-link {
    display: block;
    color: #93c5fd;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 6px;
    margin-top: 2px;
}
.fhl-tooltip-link:hover { color: #bfdbfe; text-decoration: underline; }

/* ─── Mobile tooltip — fixed bottom sheet ─── */
@media (max-width: 640px) {
    .fhl-tooltip {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        border-radius: 16px 16px 0 0;
        min-width: unset;
        max-width: unset;
        white-space: normal;
        padding: 16px 20px 24px;
        transform: translateY(100%);
        transition: opacity 0.2s ease, transform 0.25s ease;
        pointer-events: none;
    }
    .fhl-tooltip.fhl-tooltip--visible {
        transform: translateY(0);
        pointer-events: auto;
    }
    .fhl-lot-label {
        font-size: 9px;
    }
}

/* ─── Map footer note ─── */
.fhl-map-note {
    margin-top: 10px;
    font-size: 13px;
    color: #64748b;
}
.fhl-map-note a {
    color: #166534;
    text-decoration: underline;
}

/* ─── Loading state ─── */
.fhl-map-wrapper.fhl-loading .fhl-map-container::after {
    content: 'Loading lot statuses…';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #64748b;
    background: rgba(255,255,255,0.7);
    pointer-events: none;
}
