/* =============================================================================
   Movon Maps — movon-maps.css  v1.0.0
   Plugin WordPress para mapas interactivos de cobertura logística Movon.
   Compatible con Elementor. Prefijo: .movon-
   ============================================================================= */

/* ── Reset de box-sizing ──────────────────────────────────────────────────── */
.movon-mapa-widget *,
.movon-mapa-widget *::before,
.movon-mapa-widget *::after {
    box-sizing: border-box;
}

/* ── Wrapper principal ────────────────────────────────────────────────────── */
.movon-mapa-widget {
    font-family: Arial, 'Helvetica Neue', sans-serif;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    display: block;
    position: relative;
}

/* ── Contenedor con aspect-ratio ─────────────────────────────────────────── */
/*    viewBox: "0 -160 792.41846 657.54324" → ratio = 657.54 / 792.42 ≈ 82.99%  */
/*    margin-top: 10% crea el espacio visual para etiquetas internacionales    */
.movon-mapa-container {
    position: relative;
    width: 100%;
    padding-bottom: 82.99%;
    margin-top: 10%;
    height: 0;
    overflow: visible;
}

/* ── SVG del mapa ────────────────────────────────────────────────────────── */
.movon-mapa-container .movon-svg-map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
    filter: drop-shadow(0 0 24px rgba(36, 131, 196, 0.14));
}

/* ── Estados: color por defecto (gris claro) ─────────────────────────────── */
.movon-mapa-container .movon-svg-map path {
    fill: #E8EDF2;
    stroke: #ffffff;
    stroke-width: 0.8;
    vector-effect: non-scaling-stroke;
    transition: fill 0.3s ease, filter 0.3s ease;
    cursor: default;
}

/* ── Estados activos (azul Movon) ────────────────────────────────────────── */
.movon-mapa-container .movon-svg-map path.movon-estado-activo {
    fill: #2483C4;
    stroke: #ffffff;
    stroke-width: 0.8;
    vector-effect: non-scaling-stroke;
}

.movon-mapa-container .movon-svg-map path.movon-estado-activo:hover {
    fill: #1c6fa8;
    cursor: pointer;
    filter: brightness(1.08) drop-shadow(0 0 7px rgba(36, 131, 196, 0.55));
}

/* ── Todas las conexiones — regla visual única Movon ─────────────────────── */
/*    fill:none  stroke:#D81533  dasharray:6 6  round  non-scaling-stroke     */
/*    Aplica a: red nacional, rutas internacionales, marítimas, aéreas        */
.movon-conn-nacional,
.movon-conn-int {
    fill: none !important;
    stroke: #D81533 !important;
    stroke-linecap: round;
    stroke-dasharray: 6 6;
    vector-effect: non-scaling-stroke;
    opacity: 0;
}

.movon-conn-nacional {
    stroke-width: 1.2;
    animation: movonDashFlow 2.8s linear infinite;
}

.movon-conn-int {
    stroke-width: 1.5;
    /* la animación se activa vía JS con duración individual por ruta */
}

/* ── Puntos de destino internacional ─────────────────────────────────────── */
.movon-dest-dot {
    fill: #D81533;
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
    opacity: 0;
}

/* ── Anillos de pulso (pulse rings) ──────────────────────────────────────── */
.movon-pulse-ring {
    fill: none;
    stroke: #D81533;
    stroke-width: 1.2;
    opacity: 0;
    vector-effect: non-scaling-stroke;
    transform-box: fill-box;
    transform-origin: center;
}

/* ── Partículas viajeras ─────────────────────────────────────────────────── */
.movon-particle {
    fill: #D81533;
    opacity: 0;
}

/* ── Overlay HTML (pines + etiquetas) ────────────────────────────────────── */
.movon-pins-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

/* ── Pin: contenedor posicionado ─────────────────────────────────────────── */
.movon-pin {
    position: absolute;
    transform: translate(-50%, -100%);
    pointer-events: all;
    z-index: 10;
}

/* ── Pin: marcador (teardrop CSS, siempre visible) ───────────────────────── */
.movon-pin-marker {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(14px, 1.8vw, 20px);
    height: clamp(14px, 1.8vw, 20px);
    animation: movonPinPulse 2.8s ease-in-out infinite;
}

.movon-pin-marker::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #D81533;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 1.5px solid rgba(255, 255, 255, 0.88);
    box-shadow: 0 2px 8px rgba(216, 21, 51, 0.45);
}

/* ── Variantes de pin — TODOS en rojo Movon #D81533 ──────────────────────── */
/*    La distinción visual entre tipos la da el ícono FA interior,            */
/*    no el color del teardrop (regla visual Movon).                          */
.movon-pin-marker--warehouse::before,
.movon-pin-marker--anchor::before {
    background: #D81533;
    border-color: rgba(255, 255, 255, 0.88);
    box-shadow: 0 2px 8px rgba(216, 21, 51, 0.45);
}

/* ── Ícono Font Awesome dentro del pin ───────────────────────────────────── */
.movon-pin-icon {
    position: relative;
    z-index: 1;
    font-size: clamp(6px, 0.85vw, 9px);
    color: #ffffff;
    pointer-events: none;
}

/* ── Tooltip del pin ─────────────────────────────────────────────────────── */
.movon-pin-tooltip {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 24, 48, 0.93);
    border: 1px solid #2483C4;
    border-radius: 6px;
    padding: 6px 10px;
    min-width: 140px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    z-index: 30;
}

.movon-pin-tooltip strong {
    display: block;
    color: #cde6f7;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 2px;
}

.movon-pin-tooltip span {
    display: block;
    color: #8ab8d9;
    font-size: 10px;
}

.movon-pin:hover .movon-pin-tooltip {
    opacity: 1;
}

/* ── Etiquetas internacionales (EUA / Canadá) ────────────────────────────── */
.movon-label-intl {
    position: absolute;
    transform: translate(-50%, -50%);
    background: rgba(10, 24, 48, 0.88);
    border: 1px solid #2483C4;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 13px;
    font-family: Arial, 'Helvetica Neue', sans-serif;
    font-weight: 700;
    color: #cde6f7;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    z-index: 20;
    line-height: 1.3;
}

/* ── Keyframes ───────────────────────────────────────────────────────────── */

/* Flujo de todas las conexiones (stroke-dasharray: 6 6, período=12) */
/* stroke-dashoffset: -12 = 1 período exacto → loop perfecto sin salto */
@keyframes movonDashFlow {
    from { stroke-dashoffset: 0; }
    to   { stroke-dashoffset: -12; }
}

/* Pulso de pines */
@keyframes movonPinPulse {
    0%,  100% { transform: scale(1);    }
    50%        { transform: scale(1.15); }
}

/* Anillo de pulso en destinos */
@keyframes movonPulseRing {
    0%   { transform: scale(1);   opacity: 0.85; }
    100% { transform: scale(2.8); opacity: 0;    }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .movon-mapa-container {
        margin-top: 13%;
    }
    .movon-label-intl {
        font-size: 11px;
        padding: 3px 8px;
    }
    .movon-pin-tooltip {
        min-width: 110px;
    }
}

@media (max-width: 480px) {
    .movon-mapa-container {
        margin-top: 15%;
    }
    .movon-label-intl {
        font-size: 10px;
        padding: 2px 6px;
    }
    .movon-pin-tooltip {
        font-size: 9px;
        min-width: 90px;
    }
    .movon-pin-tooltip strong {
        font-size: 9px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODO LIGERO — Dispositivos < 768 px  (OPT 3)
   ─────────────────────────────────────────────────────────────────────────
   Complementa la lógica IS_LITE del JS:
   · Elimina el costoso drop-shadow del SVG (fuerza composite layer en GPU)
   · Detiene la animación de flujo de líneas nacionales (reduce CPU)
   · Desactiva will-change en pines (sin animación de pulso)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

    /* Quitar drop-shadow: el filtro obliga al browser a rasterizar
       un layer extra del SVG completo en cada frame              */
    .movon-mapa-container .movon-svg-map {
        filter: none;
    }

    /* Líneas nacionales: JS establece animation:none en modo lite,
       pero esta regla sirve como seguro CSS por si JS no pudo     */
    .movon-conn-nacional {
        animation-duration: 0.001ms; /* detiene el bucle sin "none" */
    }

    /* Pines: sin pulso continuo (reduce paint/composite en móvil) */
    .movon-pin-marker {
        animation: none;
    }

    /* Pulse rings: el JS no las activa en modo lite, pero por
       si hubiera un caso edge, no gastan GPU                      */
    .movon-pulse-ring {
        animation: none !important;
        display: none;
    }
}
