/* annotations.css - Estilos para el sistema de anotaciones */

/* Contenedores */
.annotations-markers-container,
.annotations-popups-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.annotations-markers-container {
    z-index: var(--mavi-layer-hotspot-markers, 10020);
    contain: layout paint;
    will-change: opacity;
}

.annotations-popups-container {
    z-index: var(--mavi-layer-hotspot-popup, 10180);
    isolation: isolate;
}

/* Marcadores */
.annotation-marker {
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    transform: translate3d(-9999px, -9999px, 0) translate(-50%, -50%);
    pointer-events: auto;
    cursor: pointer;
    transition: opacity 0.2s ease;
    z-index: 1;
    contain: layout paint;
    will-change: transform, opacity;
}

.annotation-marker-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.annotation-marker-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background-color: rgba(0, 204, 255, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.annotation-marker-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.annotation-marker:hover .annotation-marker-circle {
    transform: translate(-50%, -50%) scale(1.2);
    background-color: #FF6600;
}

/* Popups */
.annotation-popup {
    position: absolute;
    width: min(340px, calc(100vw - 24px));
    max-width: min(340px, calc(100vw - 24px));
    max-height: min(62vh, 520px);
    overflow: auto;
    box-sizing: border-box;
    overflow-wrap: break-word;
    background-color: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(8px);
    color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 300ms ease, 
                transform 300ms ease,
                visibility 0ms linear 300ms;
    z-index: 1;
    scrollbar-width: thin;
    scrollbar-color: #FF6600 rgba(255, 255, 255, 0.12);
}

.annotation-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    z-index: 2;
    transition: opacity 300ms ease, 
                transform 300ms ease,
                visibility 0ms linear 0ms;
}

.annotation-popup::-webkit-scrollbar {
    width: 6px;
}

.annotation-popup::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 6px;
}

.annotation-popup::-webkit-scrollbar-thumb {
    background: #FF6600;
    border-radius: 6px;
}

.annotation-popup-title {
    margin: 0 0 10px 0;
    padding-right: 28px;
    font-size: 16px;
    font-weight: bold;
    color: #f5d856;
}

.annotation-popup-content {
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.annotation-popup-content p {
    margin: 0 0 10px 0;
}

.annotation-popup-content p:last-child {
    margin-bottom: 0;
}

.annotation-popup-content a {
    color: #FF9E5E;
    text-decoration: none;
    transition: color 0.2s ease;
}

.annotation-popup-content a:hover {
    color: #FFB78A;
    text-decoration: underline;
}

.annotation-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    z-index: 3;
}

.annotation-popup-close:hover {
    opacity: 1;
}

.annotation-popup-close::before,
.annotation-popup-close::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 2px;
    background-color: white;
}

.annotation-popup-close::before {
    transform: rotate(45deg);
}

.annotation-popup-close::after {
    transform: rotate(-45deg);
}

/* Botón para mostrar/ocultar anotaciones */
#annotationsToggle {

    /* position: fixed; */  /* <-- Quitar o comentar */
    /* bottom: 62px; */      /* <-- Quitar o comentar */
    /* right: 40%; */       /* <-- Quitar o comentar */
    /* z-index: 1005; */    /* <-- Quitar o comentar */
    width: 40px;
    height: 40px;
    background-color: rgba(62, 73, 235, 0.7);
    backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s, transform 0.2s;
    flex-shrink: 0; /* Evita que se encoja si el contenedor es pequeño */
    margin: 0 5px; /* Añadir algo de margen si está junto a otros botones */
}

#annotationsToggle:hover {
    background-color: rgba(40, 40, 40, 0.9);
    transform: scale(1.05);
}

#annotationsToggle svg {
    width: 24px;
    height: 24px;
}

/* Animación de pulsación para marcadores */
@keyframes markerPulse {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* Clase para ocultar todos los marcadores */
body.hide-annotations .annotation-marker {
    display: none !important;
}

body.hide-annotations .annotation-popup {
    display: none !important;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .annotation-popup {
        width: min(330px, calc(100vw - 24px));
        max-width: min(330px, calc(100vw - 24px));
        max-height: min(58vh, calc(100vh - 132px));
    }
    
    #annotationsToggle {
        bottom: 70px;
    }
}

@media screen and (max-width: 480px) {
    .annotation-popup {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        padding: 12px;
    }
    
    .annotation-popup-title {
        font-size: 14px;
    }
    
    .annotation-popup-content {
        font-size: 12px;
    }
    
    #annotationsToggle {
        width: 36px;
        height: 36px;
        bottom: 60px;
    }
}
