/* =============================================================
   Minerals Marketplace — County Map
   Plugin: mm-county-map v1.0.0
   Brand: Enverus standard
   ============================================================= */

/* ── Enverus Brand Tokens ──────────────────────────────────── */
.mm-county-map {
    --ev-blue:          #2B811A;
    --ev-blue-hover:    #1F5E12;
    --ev-blue-light:    #6DC35A;
    --ev-navy:          #1A1A2E;
    --ev-inactive:      #C8D4E0;
    --ev-bg:            #F0F4F8;
    --ev-white:         #FFFFFF;
    --ev-text:          #1A2332;
    --ev-text-muted:    #6B7A8D;
    --ev-border:        rgba(0, 30, 70, 0.08);
    --ev-radius-card:   12px;
    --ev-radius-btn:    5px;
    --ev-shadow-card:   0 2px 16px rgba(0, 30, 70, 0.08);
    --ev-shadow-tip:    0 6px 24px rgba(0, 0, 0, 0.30);
    --ev-font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --ev-transition:    0.12s ease-out;
}

/* ── Section wrapper ───────────────────────────────────────── */
.mm-county-map {
    padding: 64px 24px 80px;
    background: transparent;
    font-family: var(--ev-font);
    color: var(--ev-text);
}

.mm-county-map__inner {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

/* ── Eyebrow + heading ─────────────────────────────────────── */
.mm-county-map__eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ev-blue);
    margin: 0 0 10px;
}

.mm-county-map__heading {
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 700;
    color: var(--ev-navy);
    line-height: 1.15;
    margin: 0 0 8px;
}

.mm-county-map__sub {
    font-size: 15px;
    color: var(--ev-text-muted);
    margin: 0 auto 32px;
    max-width: 560px;
    line-height: 1.5;
}

/* ── Stats bar ─────────────────────────────────────────────── */
.mm-stats {
    display: flex;
    gap: 32px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    justify-content: center;
}

.mm-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mm-stat__value {
    font-size: 28px;
    font-weight: 800;
    color: var(--ev-blue);
    line-height: 1;
    letter-spacing: -0.02em;
}

.mm-stat__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ev-text-muted);
}

/* ── Map card ──────────────────────────────────────────────── */
#mm-map-container {
    background: var(--ev-white);
    border-radius: var(--ev-radius-card);
    box-shadow: var(--ev-shadow-card);
    padding: 24px 16px 12px;
    position: relative;
    overflow: visible;
}

#mm-map-container svg {
    width: 100%;
    height: auto;
    display: block;
}

/* ── County path states ────────────────────────────────────── */
.county-active {
    fill: var(--ev-blue);
    stroke: var(--ev-white);
    stroke-width: 0.5px;
    cursor: pointer;
    transition: fill var(--ev-transition);
}

.county-active:hover,
.county-active:focus-visible {
    fill: var(--ev-blue-hover);
    outline: none;
}

/* Keyboard focus ring — visible without relying on color alone */
.county-active:focus-visible {
    stroke: var(--ev-blue-light);
    stroke-width: 2px;
}

.county-inactive {
    fill: var(--ev-inactive);
    stroke: var(--ev-white);
    stroke-width: 0.3px;
    pointer-events: none;
}

.state-borders {
    fill: none;
    stroke: var(--ev-white);
    stroke-width: 1.2px;
    pointer-events: none;
}

/* ── Legend ────────────────────────────────────────────────── */
.mm-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.mm-legend__item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--ev-text-muted);
    font-weight: 500;
    letter-spacing: 0.03em;
}

.mm-legend__dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.mm-legend__dot--active   { background: var(--ev-blue); }
.mm-legend__dot--inactive { background: var(--ev-inactive); }

/* ── Loading state ─────────────────────────────────────────── */
.mm-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    gap: 10px;
    color: var(--ev-text-muted);
    font-size: 14px;
}

.mm-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--ev-inactive);
    border-top-color: var(--ev-blue);
    border-radius: 50%;
    animation: mm-spin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes mm-spin {
    to { transform: rotate(360deg); }
}

/* ── Tooltip card ──────────────────────────────────────────── */
#mm-tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--ev-transition);
    min-width: 220px;
    /* Scoped tokens still accessible via inherited CSS vars */
}

#mm-tooltip.mm-tooltip--visible {
    opacity: 1;
    pointer-events: auto;
}

.mm-tooltip__card {
    background: var(--ev-navy);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--ev-shadow-tip);
    color: var(--ev-white);
    min-width: 220px;
}

.mm-tooltip__header {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ev-white);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.mm-tooltip__row {
    margin-bottom: 10px;
}

.mm-tooltip__row:last-of-type {
    margin-bottom: 0;
}

.mm-tooltip__label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 2px;
}

.mm-tooltip__value {
    font-size: 13px;
    font-weight: 400;
    color: var(--ev-white);
    line-height: 1.3;
}

.mm-tooltip__value--count {
    font-size: 20px;
    font-weight: 700;
    color: var(--ev-blue-light);
    letter-spacing: -0.01em;
}

.mm-tooltip__cta {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 9px 0;
    background: var(--ev-blue);
    color: var(--ev-white) !important;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    border-radius: var(--ev-radius-btn);
    border: none;
    cursor: pointer;
    text-decoration: none !important;
    letter-spacing: 0.02em;
    transition: background var(--ev-transition);
}

.mm-tooltip__cta:hover,
.mm-tooltip__cta:focus {
    background: var(--ev-blue-hover);
    outline: none;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1023px) {
    .mm-county-map {
        padding: 48px 20px 64px;
    }
}

@media (max-width: 767px) {
    .mm-county-map {
        padding: 40px 16px 56px;
    }

    .mm-county-map__heading {
        font-size: clamp(22px, 6vw, 32px);
    }

    .mm-stats {
        gap: 20px;
        margin-bottom: 20px;
    }

    .mm-stat__value {
        font-size: 22px;
    }

    #mm-map-container {
        padding: 12px 8px 8px;
        min-height: 320px;
    }

    .mm-loading {
        min-height: 320px;
    }

    /* Tooltip: full-width pinned to bottom on small screens */
    #mm-tooltip {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        bottom: 16px !important;
        top: auto !important;
        min-width: unset;
        width: auto;
    }
}

/* ── Map logo (top-left overlay) ───────────────────────────── */
.mm-map-logo {
    position: absolute;
    top: 14px;
    left: 16px;
    z-index: 10;
    pointer-events: none;
    display: flex;
    align-items: center;
}

.mm-map-logo__img {
    height: 26px;
    width: auto;
    display: block;
}

/* Text fallback when no logo_url is supplied */
.mm-map-logo__text {
    font-family: var(--ev-font);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--ev-blue);
}

@media (max-width: 767px) {
    .mm-map-logo { top: 10px; left: 12px; }
    .mm-map-logo__img { height: 20px; }
    .mm-map-logo__text { font-size: 13px; }
}

/* ── Zoom controls ─────────────────────────────────────────── */
.mm-zoom-controls {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}

.mm-zoom-btn {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ev-white);
    color: var(--ev-navy);
    border: 1px solid rgba(0, 30, 70, 0.14);
    border-radius: 6px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 30, 70, 0.10);
    transition: background var(--ev-transition), color var(--ev-transition),
                border-color var(--ev-transition), box-shadow var(--ev-transition);
    user-select: none;
    -webkit-user-select: none;
    font-family: var(--ev-font);
}

.mm-zoom-btn:hover:not(:disabled) {
    background: var(--ev-blue);
    color: var(--ev-white);
    border-color: var(--ev-blue);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.28);
}

.mm-zoom-btn:focus-visible {
    outline: 2px solid var(--ev-blue);
    outline-offset: 2px;
}

.mm-zoom-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.mm-zoom-btn--reset {
    font-size: 14px;
    color: var(--ev-text-muted);
}

.mm-zoom-btn--reset.mm-zoom-btn--active {
    color: var(--ev-blue);
    border-color: rgba(0, 102, 204, 0.30);
}

/* ── Zoom-button tooltips (desktop, hover) ─────────────────── */
.mm-zoom-btn::after {
    content: attr(data-tip);
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) translateX(4px);
    background: var(--ev-navy);
    color: var(--ev-white);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    padding: 5px 9px;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--ev-transition), transform var(--ev-transition);
    z-index: 20;
}

.mm-zoom-btn::before {
    content: '';
    position: absolute;
    right: calc(100% + 3px);
    top: 50%;
    transform: translateY(-50%) translateX(4px);
    border: 5px solid transparent;
    border-left-color: var(--ev-navy);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--ev-transition), transform var(--ev-transition);
    z-index: 20;
}

.mm-zoom-btn:hover:not(:disabled)::after,
.mm-zoom-btn:focus-visible::after,
.mm-zoom-btn:hover:not(:disabled)::before,
.mm-zoom-btn:focus-visible::before {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Hide button tooltips where there's no hover (touch / mobile) */
@media (hover: none), (max-width: 767px) {
    .mm-zoom-btn::after,
    .mm-zoom-btn::before { display: none; }
}

/* ── Pinned (clicked) county ───────────────────────────────── */
.county-pinned {
    fill: var(--ev-blue-hover) !important;
    stroke: var(--ev-white);
}

/* Grab cursor while map is pannable */
#mm-map-container svg {
    cursor: grab;
}

#mm-map-container svg:active {
    cursor: grabbing;
}

/* Hint below map card */
.mm-zoom-hint {
    margin-top: 8px;
    font-size: 11px;
    color: var(--ev-text-muted);
    text-align: center;
    letter-spacing: 0.02em;
}

/* Version tag — small, unobtrusive build identifier */
.mm-version-tag {
    margin-top: 12px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ev-text-muted);
    opacity: 0.55;
    text-align: center;
}

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .county-active,
    .mm-tooltip__cta,
    .mm-zoom-btn,
    #mm-tooltip { transition: none; }
    .mm-spinner { animation: none; border-top-color: var(--ev-blue); }
}
