/* ============================================
    BOTÓN "BRÚJULA"
    Contenedor: leaflet-top leaflet-right2
    ============================================ */

/* Marker de brújula en el mapa - para Leaflet */
.compass-marker-icon,
.leaflet-marker-icon.compass-marker-icon,
.leaflet-marker-icon[src*="compass"] {
    width: 48px !important;
    height: 48px !important;
    transform-origin: center center !important;
    -webkit-transform-origin: center center !important;
    transition: none !important;
}

.compass-marker-icon img,
.compass-marker-icon svg,
.leaflet-marker-icon.compass-marker-icon img,
.leaflet-marker-icon[src*="compass"] img {
    width: 100% !important;
    height: 100% !important;
    transform-origin: center center !important;
    -webkit-transform-origin: center center !important;
}

.leaflet-control-compass.leaflet-bar {
    width: 33px;
    height: 33px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border: 2px solid rgba(0,0,0,0.2);
    cursor: pointer;
    box-sizing: border-box;
    position: relative;
    border-radius: 4px;
    transition: all 0.12s ease;
    user-select: none;
    -webkit-user-select: none;
}

.leaflet-control-compass.leaflet-bar:active {
    transform: scale(0.98);
}

.leaflet-control-compass.leaflet-bar:hover {
    background-color: #f2f8fc;
    border-color: rgba(0,0,0,0.3);
}

/* Emoji del botón */
.leaflet-control-compass span {
    font-size: 24px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
}

/* Estado activo (cuando está activado - siguiendo) */
.leaflet-control-compass.compass-active {
    background: #FCBC04 !important;
    border-color: #c99603;
}

.leaflet-control-compass.compass-active span {
    color: #fff;
}

/* Estado calibrando (longpress) */
.leaflet-control-compass.compass-calibrating {
    background: #9CE500 !important;
    border-color: #7bb800;
    animation: compass-calibrate-pulse 0.5s ease-in-out;
}

@keyframes compass-calibrate-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Estado cargando */
.leaflet-control-compass.compass-loading {
    background: #DD90E2 !important;
    border-color: #b366cc;
}

/* Tooltip para táctil */
.compass-tooltip-touch {
    position: fixed;
    background: rgba(0,0,0,0.88);
    color: #fff;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.12s ease;
    z-index: 100000;
    pointer-events: none;
    transform-origin: left center;
}

/* Tooltip cuando está dentro del contenedor del mapa (fullscreen) */
.leaflet-container .compass-tooltip-touch {
    position: absolute;
    z-index: 1001;
}

.compass-tooltip-touch.visible {
    opacity: 1;
}

/* Marker de brújula en el mapa */
.compass-marker {
    width: 48px;
    height: 48px;
    position: absolute;
    z-index: 1000;
    transform-origin: center center;
    pointer-events: none;
}

.compass-marker img,
.compass-marker svg {
    width: 100%;
    height: 100%;
    transition: transform 0.1s ease-out;
}

/* Estado de carga del marker */
.compass-marker.loading {
    animation: compass-pulse 1.5s infinite;
}

@keyframes compass-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@media (max-width: 360px) {
    .compass-tooltip-touch {
        font-size: 0.72rem;
        padding: 5px 7px;
    }
}
