/* Mapa México distribuidores — estilos asociados a mapa-mexico-distribuidores.php — carpeta geo-distribuidores (evita conflicto URL /distribuidores → distribuidores.php) */

/* Pantalla completa solo si el mapa es la única capa (standalone); con header del sitio usa la regla más abajo */
body:not(.page-mapa-mexico-distribuidores) #map {
    height: 100vh;
    width: 100%;
    background-color: #f8f9fa;
}

.page-mapa-mexico-distribuidores #map {
    height: min(92vh, 1180px);
    min-height: 580px;
    width: 100%;
    background-color: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.page-mapa-mexico-distribuidores .mapa-presencia-shell {
    padding-bottom: 56px;
}

/* Modal (popup) y tooltips siempre encima de etiquetas de estados y leyenda */
.leaflet-container .leaflet-popup-pane {
    z-index: 2000 !important;
}

.leaflet-container .leaflet-tooltip-pane {
    z-index: 1990 !important;
}

/* Popups del mapa (clase distrib-popup en bindPopup) */
.leaflet-popup.distrib-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow:
        0 12px 40px rgba(0, 45, 90, 0.18),
        0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 74, 153, 0.1);
}

.leaflet-popup.distrib-popup .leaflet-popup-content {
    margin: 0;
    line-height: inherit;
}

.leaflet-popup.distrib-popup a.leaflet-popup-close-button {
    width: 28px;
    height: 28px;
    padding: 6px;
    font-size: 20px;
    line-height: 18px;
    color: #5a6d7e;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}

.leaflet-popup.distrib-popup a.leaflet-popup-close-button:hover {
    background: rgba(0, 74, 153, 0.08);
    color: #004a99;
}

.popup-card {
    text-align: center;
    min-width: 220px;
    max-width: 300px;
    background: #fff;
}

.popup-card-head {
    height: 5px;
    background: linear-gradient(90deg, #004a99 0%, #1a7fd4 50%, #5ba3f5 100%);
}

.popup-card-body {
    padding: 16px 18px 18px;
}

.popup-card strong {
    color: #0a3a6e;
    font-size: 1.08em;
    font-weight: 700;
    display: block;
    margin-bottom: 10px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.popup-card .line {
    color: #3d4f5f;
    font-size: 0.9em;
    margin: 6px 0;
    line-height: 1.45;
}

.popup-card .line a {
    color: #0b5ed7;
    text-decoration: none;
    border-bottom: 1px solid rgba(11, 94, 215, 0.35);
    transition: border-color 0.15s ease, color 0.15s ease;
}

.popup-card .line a:hover {
    border-bottom-color: #0b5ed7;
    color: #084298;
}

.popup-card .muted {
    color: #6b7b8a;
    font-size: 0.82em;
    margin-top: 10px;
    line-height: 1.35;
}

.popup-card-actions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 74, 153, 0.1);
}

.popup-card-btn {
    display: inline-block;
    padding: 9px 16px;
    font-size: 0.82em;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    color: #fff !important;
    background: linear-gradient(180deg, #0b5ed7 0%, #084298 100%);
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(11, 94, 215, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border: none;
}

.popup-card-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(11, 94, 215, 0.45);
    color: #fff !important;
}

.popup-card--solo-rest .popup-card-body strong {
    font-size: 1.02em;
}

/* Tooltip hover: mismo aspecto refinado, solo arriba/abajo por JS */
.leaflet-tooltip.distrib-tooltip-wrap {
    padding: 0;
    border-radius: 14px;
    border: 1px solid rgba(0, 74, 153, 0.12);
    box-shadow:
        0 10px 36px rgba(0, 45, 90, 0.16),
        0 2px 8px rgba(0, 0, 0, 0.05);
    background: transparent;
    max-width: min(300px, 92vw);
    max-height: 72vh;
    overflow-y: auto;
}

.leaflet-tooltip.distrib-tooltip-wrap .popup-card {
    box-shadow: none;
}

.leaflet-tooltip.distrib-tooltip-wrap .leaflet-tooltip-content {
    padding: 0;
    margin: 0;
}

/* Flecha del tooltip discreta, acorde al borde */
.leaflet-tooltip.distrib-tooltip-wrap.leaflet-tooltip-top,
.leaflet-tooltip.distrib-tooltip-wrap.leaflet-tooltip-bottom {
    border: 1px solid rgba(0, 74, 153, 0.12);
}

.estado-distribuidores-wrap .card-sep {
    border: none;
    border-top: 1px solid #ddd;
    margin: 12px 0;
}

.state-label-divicon {
    background: transparent !important;
    border: none !important;
}

.state-label-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
}

.state-label-marker img {
    width: 26px;
    height: 26px;
    display: block;
    margin-bottom: 4px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.state-label-marker span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.55);
    max-width: 200px;
    line-height: 1.2;
}

/* Solo restaurantes (sin distribuidor): icono y texto más compactos */
.state-label-marker--restaurante img {
    width: 18px;
    height: 18px;
    margin-bottom: 2px;
}

.state-label-marker--restaurante span {
    font-size: 8px;
    letter-spacing: 0.06em;
    max-width: 160px;
}

/* Estados sin presencia: solo nombre (sin icono), debajo de otras etiquetas */
.state-label-nombre-solo {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
}

.state-label-nombre-solo span {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #4a6578;
    max-width: 200px;
    line-height: 1.15;
    text-shadow:
        0 0 6px rgba(255, 255, 255, 0.95),
        0 1px 2px rgba(255, 255, 255, 0.9);
}

/* Leyenda (control Leaflet bottom-left) */
.map-leyenda {
    margin: 0 0 28px 12px !important;
    padding: 0;
    clear: both;
}

.map-leyenda-inner {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 251, 255, 0.98) 100%);
    border: 1px solid rgba(0, 74, 153, 0.12);
    border-radius: 14px;
    box-shadow:
        0 4px 24px rgba(0, 61, 122, 0.1),
        0 1px 0 rgba(255, 255, 255, 0.8) inset;
    padding: 14px 16px 12px;
    min-width: 200px;
    max-width: min(260px, calc(100vw - 24px));
}

.map-leyenda-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #004a99;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 74, 153, 0.1);
}

.map-leyenda-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.map-leyenda-row:last-child {
    margin-bottom: 0;
}

.map-leyenda-swatch {
    flex-shrink: 0;
    width: 28px;
    height: 18px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.map-leyenda-swatch--dist {
    background: #003d7a;
}

.map-leyenda-swatch--rest {
    background: #8ec5f0;
}

.map-leyenda-swatch--none {
    background: rgba(91, 163, 245, 0.35);
    border-color: rgba(91, 163, 245, 0.45);
}

.map-leyenda-text {
    font-size: 12px;
    line-height: 1.35;
    color: #2c3e50;
}

.map-leyenda-text strong {
    display: block;
    font-weight: 600;
    color: #1a2d3d;
    font-size: 12.5px;
}

.map-leyenda-text small {
    display: block;
    font-size: 10px;
    color: #6b7c8c;
    font-weight: 400;
    margin-top: 2px;
}
