/* web/static/map-overlay.css

   Responsive overlay for the US regions map. The container holds a
   background image (map.png) plus absolutely-positioned tokens for
   demand labels and team DCs. All token positions use percentage
   coords so the overlay scales with the container width.

   Image intrinsic ratio: 2752 x 1728 = 1.593 : 1.
*/

.map-overlay {
    margin: 1rem 0;
}

.map-overlay summary {
    cursor: pointer;
    font-weight: 600;
}

.map-overlay-title {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: var(--pico-muted-color);
}

.map-overlay-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    aspect-ratio: 1.593 / 1;
    background-image: url("/static/map.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    border-radius: 8px;
    overflow: hidden;
}

.map-overlay-container.fullscreen {
    max-width: 100%;
}

/* Per-region label (demand bucket or truckload count). */
.map-region-label {
    position: absolute;
    transform: translate(-50%, -50%);
    background: rgba(11, 29, 42, 0.82);
    color: #f5f7fa;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.map-region-label .region-code {
    display: block;
    font-size: 0.72rem;
    opacity: 0.82;
    font-weight: 500;
}

.map-region-label .region-value {
    display: block;
}

.map-region-label.demand-high   { background: rgba(194, 65, 12,  0.92); }
.map-region-label.demand-medium { background: rgba(120, 113, 108, 0.92); }
.map-region-label.demand-low    { background: rgba(31, 41, 55,  0.78); }

/* Team DC tokens — small numbered circles in a team color, sitting
   just below the region label so both stay readable. */
.map-dc-token {
    position: absolute;
    transform: translate(-50%, 0);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 0.55rem;
    font-weight: 700;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
    margin-left: calc(var(--fan-x, 0) * 1px);
    margin-top:  calc(var(--fan-y, 0) * 1px);
}

.map-dc-token.size-large {
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
    border-width: 2px;
}

/* Big-screen variant: a touch larger for legibility at distance, but
   still small enough not to crowd labels. */
.map-overlay.bigscreen .map-region-label { font-size: 1.05rem; }
.map-overlay.bigscreen .map-region-label .region-code { font-size: 0.92rem; }
.map-overlay.bigscreen .map-dc-token {
    width: 20px; height: 20px; font-size: 0.78rem;
}
.map-overlay.bigscreen .map-dc-token.size-large {
    width: 26px; height: 26px; font-size: 0.9rem;
}

/* Mobile: even smaller so tokens don't obscure labels at narrow widths. */
@media (max-width: 768px) {
    .map-dc-token { width: 11px; height: 11px; font-size: 0.5rem; }
    .map-dc-token.size-large {
        width: 14px; height: 14px; font-size: 0.55rem;
    }
}

/* Legend shown under the map (team names -> colors). */
.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    justify-content: center;
    margin-top: 0.6rem;
    font-size: 0.88rem;
}

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

.map-legend-swatch {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}
