/* ==========================================================================
   MAPA DE COBERTURA
   Marcado en sitio_web/componentes/mapa_clientes.html
   Comportamiento en sitio_web/js/mapa_clientes.js
   ========================================================================== */

.mapa {
    --mapa-azul: #102a43;
    --mapa-vino: #6b1e2e;
    --mapa-verde: #16a34a;
    --mapa-tinta: #0f172a;
    --mapa-suave: #5f7183;
    --mapa-linea: #e3eaf1;
    padding: clamp(56px, 7vw, 88px) 0;
    border-top: 1px solid var(--mapa-linea);
    background: #f6f8fb;
    color: var(--mapa-tinta);
}
.mapa *, .mapa *::before, .mapa *::after { box-sizing: border-box; }
.mapa-ancho { width: min(1180px, 92vw); margin-inline: auto; }

/* ---------- Cabecera ---------- */
.mapa-cabecera {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 22px;
}
.mapa-etiqueta {
    display: inline-block;
    margin-bottom: 13px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(107, 30, 46, .09);
    color: var(--mapa-vino);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.mapa-cabecera h2 {
    margin: 0 0 10px;
    font-size: clamp(26px, 3.4vw, 38px);
    line-height: 1.16;
    letter-spacing: -.02em;
}
.mapa-cabecera p {
    max-width: 58ch;
    margin: 0;
    color: var(--mapa-suave);
    font-size: 16px;
    line-height: 1.65;
}

.mapa-cifras { display: flex; gap: 10px; flex: 0 0 auto; }
.mapa-cifras > div {
    min-width: 104px;
    padding: 15px 18px;
    border: 1px solid var(--mapa-linea);
    border-radius: 14px;
    background: #fff;
    text-align: center;
}
.mapa-cifras strong {
    display: block;
    color: var(--mapa-azul);
    font-size: 27px;
    line-height: 1;
}
.mapa-cifras span {
    display: block;
    margin-top: 6px;
    color: #7d8fa1;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* ---------- Aviso de datos referenciales ---------- */
.mapa-aviso {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
    padding: 12px 16px;
    border: 1px solid #fde3c7;
    border-radius: 11px;
    background: #fff8ef;
    color: #92500e;
    font-size: 13.5px;
}
.mapa-aviso svg {
    width: 19px; height: 19px; flex: 0 0 19px;
    fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Distribucion ---------- */
.mapa-reja {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 20px;
    align-items: start;
}

/* ---------- Lienzo del mapa ---------- */
.mapa-lienzo {
    position: relative;
    padding: 26px 20px 46px;
    border: 1px solid var(--mapa-linea);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 14px 38px rgba(16, 42, 67, .06);
}
.mapa-marco {
    position: relative;
    width: min(78%, 560px);
    height: 620px;
    margin: 0 auto;
}
.mapa-imagen {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: saturate(.28) contrast(.94) brightness(1.06);
    user-select: none;
    pointer-events: none;
}
.mapa-capa { position: absolute; inset: 0; pointer-events: none; }
.mapa-capa-regiones { z-index: 4; }
.mapa-capa-puntos { z-index: 6; }

/* Ancla de region */
.mapa-region-ancla {
    position: absolute;
    left: var(--region-x);
    top: var(--region-y);
    width: 14px; height: 14px;
    padding: 0; border: 0;
    background: transparent;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: pointer;
}
.mapa-region-punto {
    position: absolute;
    inset: 3px;
    border: 1.5px solid rgba(16, 42, 67, .34);
    border-radius: 50%;
    background: #fff;
}
.mapa-region-ancla.con-clientes .mapa-region-punto {
    inset: 2px;
    border-color: var(--mapa-vino);
    background: var(--mapa-vino);
    box-shadow: 0 0 0 4px rgba(107, 30, 46, .12);
}
.mapa-region-globo {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 7px;
    background: var(--mapa-azul);
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 4px);
    transition: opacity .16s ease, transform .16s ease, visibility .16s;
    box-shadow: 0 7px 18px rgba(16, 42, 67, .22);
}
.mapa-region-globo b {
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .2);
}
.mapa-region-ancla:hover .mapa-region-globo,
.mapa-region-ancla:focus-visible .mapa-region-globo,
.mapa-region-ancla.region-activa .mapa-region-globo {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* Punto de cliente */
.mapa-cliente-dot {
    position: absolute;
    left: var(--mapa-x);
    top: var(--mapa-y);
    width: 7px; height: 7px;
    border: 1.5px solid #fff;
    border-radius: 50%;
    background: var(--mapa-verde);
    box-shadow: 0 1px 4px rgba(16, 42, 67, .28);
    transform: translate(-50%, -50%);
    transition: transform .14s ease, background-color .14s ease;
}
.mapa-cliente-dot.region-activa {
    z-index: 8;
    background: var(--mapa-vino);
    transform: translate(-50%, -50%) scale(1.8);
}

.mapa-leyenda {
    position: absolute;
    left: 22px;
    bottom: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: #7c8b9a;
    font-size: 11.5px;
    font-weight: 700;
}
.mapa-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.mapa-leyenda i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.leyenda-cliente { background: var(--mapa-verde); box-shadow: 0 0 0 3px rgba(22, 163, 74, .14); }
.leyenda-region  { background: var(--mapa-vino);  box-shadow: 0 0 0 3px rgba(107, 30, 46, .14); }

/* ---------- Panel lateral ---------- */
.mapa-panel {
    padding: 22px;
    border: 1px solid var(--mapa-linea);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 14px 38px rgba(16, 42, 67, .06);
}
.mapa-panel-cabecera { padding-bottom: 15px; border-bottom: 1px solid var(--mapa-linea); }
.mapa-panel-cabecera strong { display: block; color: var(--mapa-azul); font-size: 16px; }
.mapa-panel-cabecera span { display: block; margin-top: 3px; color: #8898a8; font-size: 11.5px; }

.mapa-lista { display: grid; gap: 3px; margin-top: 12px; }
.mapa-fila {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 68px 30px;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background-color .14s ease, box-shadow .14s ease;
}
.mapa-fila:hover, .mapa-fila.activo { background: #f2f6fa; }
.mapa-fila.activo { box-shadow: inset 3px 0 0 var(--mapa-vino); }
.mapa-fila-nombre {
    overflow: hidden;
    color: var(--mapa-tinta);
    font-size: 13.5px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mapa-fila-barra {
    height: 6px;
    border-radius: 999px;
    background: #eaf0f6;
    overflow: hidden;
}
.mapa-fila-barra i {
    display: block;
    height: 100%;
    min-width: 4px;
    border-radius: inherit;
    background: var(--mapa-vino);
}
.mapa-fila b { color: var(--mapa-azul); font-size: 13.5px; text-align: right; }

.mapa-restantes { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--mapa-linea); }
.mapa-restantes summary {
    color: #8898a8;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
}
.mapa-restantes-lista { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.mapa-chip {
    padding: 5px 10px;
    border: 1px solid var(--mapa-linea);
    border-radius: 999px;
    background: #fbfcfd;
    color: #8494a4;
    font-size: 11.5px;
    font-weight: 650;
    cursor: pointer;
    transition: border-color .14s ease, color .14s ease;
}
.mapa-chip:hover, .mapa-chip.activo { border-color: var(--mapa-vino); color: var(--mapa-vino); }

/* ---------- Pantallas pequenas ---------- */
@media (max-width: 1050px) {
    .mapa-cabecera { align-items: flex-start; flex-direction: column; }
    .mapa-cifras { width: 100%; }
    .mapa-cifras > div { flex: 1; min-width: 0; }
    .mapa-reja { grid-template-columns: 1fr; }
    .mapa-marco { width: min(84%, 520px); height: 560px; }
}
@media (max-width: 640px) {
    .mapa-lienzo { padding: 18px 12px 44px; }
    .mapa-marco { width: 96%; height: 420px; }
    .mapa-region-globo { display: none; }
    .mapa-cliente-dot { width: 6px; height: 6px; }
    .mapa-cifras strong { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
    .mapa *, .mapa *::before, .mapa *::after { transition: none !important; }
}
