/**
 * assets/css/coverage-map.css
 * Estilos personalizados para mapa interactivo de cobertura
 */

/* ─────────────────────────────────────────────────────────
   MARCADORES PERSONALIZADOS
   ───────────────────────────────────────────────────────── */

.custom-marker {
    display: flex;
    justify-content: center;
    align-items: center;
}

.marker-pin {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}

.marker-pin svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.marker-shadow {
    position: absolute;
    bottom: -4px;
    width: 24px;
    height: 6px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0));
    border-radius: 50%;
    filter: blur(2px);
    z-index: 9;
}

.marker-active {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(152, 192, 64, 0.5);
}

/* ─────────────────────────────────────────────────────────
   POPUP DE COBERTURA
   ───────────────────────────────────────────────────────── */

.coverage-popup-wrapper .leaflet-popup-content-wrapper {
    border-radius: 8px;
    padding: 4px;
}

.coverage-popup-wrapper .leaflet-popup-tip {
    background: white;
}

.coverage-popup h4 {
    margin: 0;
}

.coverage-popup a:hover {
    text-decoration: underline;
}

/* ─────────────────────────────────────────────────────────
   MAPA BASE
   ───────────────────────────────────────────────────────── */

#coverage-map {
    background: #f5f5f5;
    font-family: 'Inter', system-ui, sans-serif;
    cursor: default;
    /* Crear contexto de apilamiento aislado para que los z-index de Leaflet
       (700+ en popups, 600+ en marker-pane) no se superpongan al header sticky
       que tiene z-50. Así todo el mapa queda contenido en su propio nivel. */
    position: relative;
    z-index: 1;
    isolation: isolate;
}

/* Cursor pointer solo en los marcadores (que sí son clickeables) */
#coverage-map .custom-marker,
#coverage-map .animated-logo {
    cursor: pointer;
}

/* Tiles del mapa */
.coverage-map-tiles {
    filter: saturate(0.7) brightness(1.08) contrast(0.95);
}

/* Control de zoom */
#coverage-map .leaflet-control-zoom {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#coverage-map .leaflet-control-zoom a {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a1a;
    background: white;
    border: none;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
}

#coverage-map .leaflet-control-zoom a:hover {
    background: #98c040;
    color: white;
}

/* Attribution */
#coverage-map .leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.8);
    color: #666;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
}

/* ─────────────────────────────────────────────────────────
   RUTAS ENTRE CIUDADES
   ───────────────────────────────────────────────────────── */

/* Línea principal con dash animado (efecto de "flujo") */
.coverage-route-line {
    stroke-dasharray: 8 10;
    animation: routeDashFlow 1.5s linear infinite;
    filter: drop-shadow(0 0 4px rgba(152, 192, 64, 0.4));
}

@keyframes routeDashFlow {
    to {
        stroke-dashoffset: -36;
    }
}

/* Halo exterior (efecto de resplandor) */
.coverage-route-glow {
    filter: blur(2px);
}

/* ─────────────────────────────────────────────────────────
   ESTELA / RASTRO DEL LOGO
   ───────────────────────────────────────────────────────── */

.animated-logo-trail {
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 400;  /* Detrás del logo principal */
    pointer-events: none;
}

.trail-logo-container {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    padding: 3px;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.1),
        0 0 0 2px rgba(152, 192, 64, 0.15);
    opacity: 0.6;
    transition: opacity 0.3s ease;
    animation: trailPulse 1.5s ease-in-out infinite;
}

.trail-logo-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

@keyframes trailPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(0.95);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.02);
    }
}

/* ─────────────────────────────────────────────────────────
   LOGO ANIMADO DE JMSERVICES
   ───────────────────────────────────────────────────────── */

.animated-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
}

.animated-logo-container {
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: white;
    border-radius: 50%;
    padding: 4px;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 0 0 3px rgba(152, 192, 64, 0.2);
    animation: logoFloat 3s ease-in-out infinite;
}

.logo-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px) scale(1);
        box-shadow:
            0 4px 12px rgba(0, 0, 0, 0.15),
            0 0 0 3px rgba(152, 192, 64, 0.2);
    }
    50% {
        transform: translateY(-5px) scale(1.05);
        box-shadow:
            0 8px 20px rgba(0, 0, 0, 0.2),
            0 0 0 4px rgba(152, 192, 64, 0.35);
    }
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .marker-pin {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .animated-point-inner {
        width: 18px;
        height: 18px;
    }

    .animated-point-pulse {
        width: 7px;
        height: 7px;
    }
}

@media (max-width: 640px) {
    .marker-pin {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }

    .animated-point-inner {
        width: 16px;
        height: 16px;
    }

    .animated-point-pulse {
        width: 6px;
        height: 6px;
    }

    #coverage-map .leaflet-control-zoom a {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* Altura responsive del mapa */
@media (max-width: 1024px) {
    #coverage-map {
        height: 480px !important;
    }
}

@media (max-width: 640px) {
    #coverage-map {
        height: 400px !important;
    }
}
