/*!
 * GeoMap v1.0 — Estilos de la librería (marcadores + controles)
 * Incluir junto a leaflet.css en cualquier proyecto que use geomap.js
 */

/* ---------- Marcadores personalizados ---------- */
.gm-marker-wrap { background: transparent; border: none; }

.gm-marker {
    position: relative;
    width: 34px;
    height: 42px;
}

.gm-marker__dot {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 4px;
    rotate: 0deg;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 800 13px/1 "Arial Black", system-ui, sans-serif;
    color: #0b0e12;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .45);
    border: 2.5px solid #0b0e12;
}

/* La "punta" del pin */
.gm-marker::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 2px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 12px solid #0b0e12;
}

/* Personalizables vía variables CSS (p. ej. desde un selector de tema) */
.gm-marker--start .gm-marker__dot { background: var(--gm-start, #d4ff3f); }
.gm-marker--end   .gm-marker__dot { background: var(--gm-end, #ff6b5e); color: #14090a; }
.gm-marker--me    .gm-marker__dot { background: var(--gm-me, #5ec8ff); font-size: 10px; }

/* Marcador personalizado: icono de fuente, emoji o imagen (addMarker) */
.gm-marker--custom .gm-marker__dot {
    background: var(--gm-custom, #d4ff3f);
    font-size: 15px;
    color: #fff;
    overflow: hidden;
}
.gm-marker--custom .gm-marker__dot i { font-size: 15px; line-height: 1; }
.gm-marker__img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
    display: block;
}

/* Etiqueta con el nombre sobre el pin (addMarker opts.label) */
.gm-marker__label {
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    display: block;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    font: 700 10px/1.3 system-ui, sans-serif;
    background: rgba(11, 14, 18, .82);
    color: #fff;
    padding: 2px 8px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
    pointer-events: none;
}

/* Pulso animado bajo el marcador */
.gm-marker__pulse {
    position: absolute;
    left: 50%;
    bottom: -3px;
    transform: translateX(-50%);
    width: 18px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .35);
    animation: gm-pulse 1.8s ease-out infinite;
}

@keyframes gm-pulse {
    0%   { opacity: .6; scale: 1; }
    70%  { opacity: 0;  scale: 2.2; }
    100% { opacity: 0;  scale: 2.2; }
}

/* ---------- Territorios: leyenda del choropleth ---------- */
.gm-legend {
    background: rgba(11, 14, 18, .88);
    border: 1px solid #262d38;
    border-radius: 10px;
    padding: 10px 12px;
    min-width: 132px;
    color: #e8ecdf;
    font: 500 11px/1.4 "IBM Plex Mono", ui-monospace, monospace;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}

.gm-legend__title {
    display: block;
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: .75;
}

.gm-legend__bar {
    height: 10px;
    border-radius: 5px;
    margin: 7px 0 4px;
    border: 1px solid rgba(255, 255, 255, .12);
}

.gm-legend__scale {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    opacity: .85;
}

/* Tooltip de territorio (nombre + cantidad) */
.gm-terr-tip {
    background: rgba(11, 14, 18, .92) !important;
    border: 1px solid #262d38 !important;
    border-radius: 8px !important;
    color: #e8ecdf !important;
    font: 500 12px/1.5 "IBM Plex Mono", ui-monospace, monospace !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .45) !important;
}
.gm-terr-tip::before { display: none; }

/* ---------- Vista globo 3D (MapLibre GL) ---------- */
/* Se superpone al mapa plano; z-index 800 deja visibles los controles
   de Leaflet (zoom, escala, atribución y leyenda, que van en 1000). */
/* !important: el CSS de MapLibre (cargado después) pone position:relative
   en .maplibregl-map y dejaría el overlay con altura 0 */
.gm-globe,
.gm-globe.maplibregl-map {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 800;
    background: #05070a;
}

.gm-globe canvas { outline: none; }

/* Tooltip de territorio en el globo (mismo look que el del mapa plano) */
.gm-globe-tip .maplibregl-popup-content {
    background: rgba(11, 14, 18, .92);
    border: 1px solid #262d38;
    border-radius: 8px;
    color: #e8ecdf;
    font: 500 12px/1.5 "IBM Plex Mono", ui-monospace, monospace;
    padding: 8px 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
.gm-globe-tip .maplibregl-popup-tip { display: none; }

/* ---------- Ajustes de controles Leaflet ---------- */
.leaflet-container {
    font-family: inherit;
    background: #12151c;
}

.leaflet-control-zoom a {
    transition: background .15s ease;
}

.leaflet-popup-content-wrapper {
    border-radius: 10px;
    font-size: 13px;
}
