/**
 * Drive - State Selector & Interactive US Map Component Styles
 * Exact copy of design reference with activity heat levels, pins,
 * floating dark hover popover, and responsive scaling.
 *
 * @package Drive
 */

/* ==========================================================================
   1. State Selector Section Layout
   ========================================================================== */
.homepage-state-selector {
    padding: 5rem 0 4.5rem;
    background: #ffffff;
    position: relative;
    overflow: hidden;
}

.state-section-header {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 3rem;
}

.section-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: rgba(0, 102, 255, 0.08);
    color: #0066FF;
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-bottom: 0.85rem;
}

.state-section-header .section-title {
    font-size: clamp(2rem, 3.5vw, 2.75rem);
    font-weight: 800;
    color: #0c0d10;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.75rem;
}

.state-section-header .section-description {
    font-size: 1.05rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

/* ==========================================================================
   2. Map Container & SVG Responsive Box
   ========================================================================== */
.state-map-wrapper {
    position: relative;
    max-width: 1040px;
    margin: 0 auto;
    padding: 1rem 0;
}

.map-svg-responsive-box {
    width: 100%;
    position: relative;
    overflow: visible;
}

.us-interactive-map-svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

/* ==========================================================================
   3. State Heatmap Paths & Levels
   ========================================================================== */
.state-path {
    stroke: #ffffff;
    stroke-width: 1.4px;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
    transition: fill 280ms cubic-bezier(0.4, 0, 0.2, 1), 
                stroke 280ms cubic-bezier(0.4, 0, 0.2, 1), 
                filter 280ms cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

/* Heatmap Activity Levels matching design screenshot */
.state-path.level-very-high {
    fill: #0066FF; /* California electric saturated blue */
}

.state-path.level-high {
    fill: #74AEFB; /* High activity light sky blue */
}

.state-path.level-medium {
    fill: #B1D5FD; /* Medium activity ice blue */
}

.state-path.level-low {
    fill: #D5E8FD; /* Low activity pale ice blue */
}

.state-path.level-very-low {
    fill: #EDF5FE; /* Very low activity soft tint */
}

/* State Hover & Focus Interaction - Smooth & Elegant */
.state-path:hover,
.state-path:focus-visible,
.state-path.is-hovered {
    fill: #0052cc !important;
    stroke: #ffffff;
    stroke-width: 2px;
    filter: drop-shadow(0 2px 8px rgba(0, 102, 255, 0.35));
}

.state-path.level-very-high:hover,
.state-path.level-very-high.is-hovered {
    fill: #004ecc !important;
    filter: drop-shadow(0 4px 12px rgba(0, 102, 255, 0.45));
}

/* ==========================================================================
   4. Map Teardrop Pins & Labels (Coordinates Locked Strictly in Place)
   ========================================================================== */
.map-pin-node {
    cursor: pointer;
    outline: none;
}

.map-pin-node .pin-geometry {
    transition: fill 240ms cubic-bezier(0.4, 0, 0.2, 1), 
                filter 240ms cubic-bezier(0.4, 0, 0.2, 1),
                stroke 240ms cubic-bezier(0.4, 0, 0.2, 1);
    stroke: rgba(255, 255, 255, 0.6);
    stroke-width: 0.8px;
}

/* Blue Pin (Standard) */
.map-pin-node.pin-blue .pin-geometry {
    fill: #0066FF;
    filter: drop-shadow(0 2px 4px rgba(0, 102, 255, 0.35));
}

/* Orange Pin (California / Very High) */
.map-pin-node.pin-orange .pin-geometry {
    fill: #FF5722;
    filter: drop-shadow(0 2px 5px rgba(255, 87, 34, 0.45));
}

/* Numeric text inside pin */
.map-pin-node .pin-label {
    fill: #ffffff;
    font-size: 8.5px;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    letter-spacing: -0.02em;
    pointer-events: none;
    user-select: none;
}

/* Pin Hover & Active State: Illuminates smoothly without moving */
.map-pin-node:hover .pin-geometry,
.map-pin-node.is-hovered .pin-geometry {
    stroke: #ffffff;
    stroke-width: 1.5px;
}

.map-pin-node.pin-blue:hover .pin-geometry,
.map-pin-node.pin-blue.is-hovered .pin-geometry {
    fill: #0044cc;
    filter: drop-shadow(0 3px 8px rgba(0, 68, 204, 0.65));
}

.map-pin-node.pin-orange:hover .pin-geometry,
.map-pin-node.pin-orange.is-hovered .pin-geometry {
    fill: #e64a19;
    filter: drop-shadow(0 3px 10px rgba(230, 74, 25, 0.75));
}

/* ==========================================================================
   5. Dynamic Floating Dark Popover / Tooltip
   Exact match to Colorado popover in screenshot
   ========================================================================== */
.state-map-tooltip {
    position: absolute;
    background: #181b22; /* Dark graphite container */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    padding: 0.6rem 0.95rem;
    box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -100%) translateY(-10px);
    transition: opacity 180ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1), visibility 180ms ease;
    text-align: center;
    white-space: nowrap;
    min-width: 105px;
}

.state-map-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -100%) translateY(-14px);
}

.state-map-tooltip .tooltip-state-name {
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-bottom: 0.2rem;
}

.state-map-tooltip .tooltip-state-meta {
    font-size: 0.75rem;
    color: #cbd5e1;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.state-map-tooltip .tooltip-active-count {
    font-weight: 600;
    color: #ffffff;
}

/* ==========================================================================
   6. Bottom Activity Level Legend
   ========================================================================== */
.map-activity-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-top: 2.5rem;
    padding: 0.75rem 1.5rem;
    background: #f8fafc;
    border-radius: 9999px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid #e2e8f0;
}

.legend-heading {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #334155;
    letter-spacing: -0.01em;
}

.legend-swatches-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.15rem;
}

.legend-swatch-item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.legend-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.legend-color-dot.dot-very-high {
    background-color: #0066FF;
}

.legend-color-dot.dot-high {
    background-color: #74AEFB;
}

.legend-color-dot.dot-medium {
    background-color: #B1D5FD;
}

.legend-color-dot.dot-low {
    background-color: #D5E8FD;
}

.legend-color-dot.dot-very-low {
    background-color: #EDF5FE;
}

.legend-color-label {
    font-size: 0.8125rem;
    color: #64748b;
    font-weight: 500;
}

/* ==========================================================================
   7. Quick Select Dropdown (Mobile / Keyboard Fallback)
   ========================================================================== */
.state-quick-select-wrap {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.quick-select-box {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    max-width: 480px;
    width: 100%;
}

.state-quick-select {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #1e293b;
    outline: none;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.state-quick-select:focus {
    border-color: #0066FF;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.btn-state-go {
    padding: 0.75rem 1.25rem;
    background: #0066FF;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: background-color 200ms ease, transform 150ms ease;
    white-space: nowrap;
}

.btn-state-go:hover {
    background: #0052cc;
    transform: translateY(-1px);
}

/* ==========================================================================
   8. Responsive Adjustments
   ========================================================================== */
@media (max-width: 768px) {
    .homepage-state-selector {
        padding: 3.5rem 0 3rem;
    }

    .state-section-header {
        margin-bottom: 2rem;
    }

    .map-activity-legend {
        border-radius: 16px;
        padding: 0.85rem 1rem;
        gap: 0.75rem;
        justify-content: flex-start;
    }

    .legend-swatches-row {
        gap: 0.75rem;
    }

    .quick-select-box {
        flex-direction: column;
    }

    .btn-state-go {
        width: 100%;
        justify-content: center;
    }
}
