/* Estilos personalizados para la barra de desplazamiento */
/* Compatible con Chrome, Edge, Firefox y Safari */

/* Ocultar barra de desplazamiento nativa en Firefox */
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Ocultar barra de desplazamiento nativa en WebKit (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
    width: 0;
    height: 0;
    background: transparent;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: transparent;
    border: none;
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

/* Asegurar que body mantenga overflow visible */
body {
    overflow: auto;
    position: relative;
}

/* El contenedor de la barra de desplazamiento personalizada */
.custom-scrollbar-container {
    position: fixed;
    top: 0;
    /* La posición (izquierda/derecha) se establece con JavaScript */
    width: 20px;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Estado oculto del contenedor */
.custom-scrollbar-container.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Línea central (track) */
.custom-scrollbar-track {
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    /* Ancho y color se configuran con JavaScript */
    pointer-events: none;
    border-radius: 1px;
}

/* El punto de desplazamiento */
.custom-scrollbar-dot {
    position: absolute;
    border-radius: 50%;
    /* Color y tamaño se configuran con JavaScript */
    pointer-events: auto;
    opacity: 0.8;
    transition: opacity 0.3s ease, transform 0.2s ease;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Estado activo del punto */
.custom-scrollbar-dot.active {
    opacity: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Efecto hover base (será sobrescrito por JavaScript) */
.custom-scrollbar-dot:hover {
    transform: scale(1.5);
    transition: transform 0.2s ease;
}

/* Prevenir interferencias con otros elementos */
.custom-scrollbar-container * {
    box-sizing: border-box;
}

/* Asegurar que el scrollbar funcione en dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
    .custom-scrollbar-dot {
        opacity: 0.6;
    }
    
    .custom-scrollbar-dot.active {
        opacity: 0.9;
    }
}

/* Prevenir conflictos con temas de WordPress */
.custom-scrollbar-container,
.custom-scrollbar-track,
.custom-scrollbar-dot {
    font-family: inherit;
    font-size: inherit;
    line-height: normal;
    color: inherit;
    text-align: left;
    text-transform: none;
    text-decoration: none;
    text-shadow: none;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
    background-attachment: scroll;
    background-repeat: no-repeat;
    background-position: 0 0;
    background-clip: border-box;
    background-origin: padding-box;
    background-size: auto;
}

/* Estilos para elementos de página que pueden causar conflictos */
html.custom-scrollbar-active {
    overflow: auto;
}

html.custom-scrollbar-active body {
    overflow: auto;
}

/* Compatibilidad con temas populares de WordPress */
.custom-scrollbar-container {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Evitar que otros elementos interfieran con el scrollbar */
.custom-scrollbar-container {
    isolation: isolate;
}

/* Asegurar que el scrollbar esté siempre visible sobre otros elementos */
.custom-scrollbar-container {
    will-change: opacity, visibility;
}

.custom-scrollbar-dot {
    will-change: transform, opacity;
}