#custom-wpml-language-switcher {
    position: relative;
    display: flex;
    align-items: center;
    overflow: visible;
    flex-direction: column;
    align-items: flex-start;
    /* Añadimos un padding para mejor posicionamiento */
    padding: 5px 0;
}

#custom-wpml-language-switcher a {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#custom-wpml-language-switcher a img {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 3px;
    /* Aseguramos que la imagen no se escale */
    min-width: 24px;
    min-height: 24px;
    margin: 0 0 3px 0;
}

#custom-wpml-language-switcher a.active {
    z-index: 2;
    position: relative;
    /* Centramos verticalmente la bandera activa */
    top: 0;
    margin: 0;
}

#custom-wpml-language-switcher a:not(.active) {
    position: absolute;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    left: 0;
    top: 0;
    transform: translateY(0);

}


/* Efecto hover de cascada en escritorio */
@media (hover: hover) and (pointer: fine) {
    #custom-wpml-language-switcher:hover a:not(.active) {
        opacity: 1;
        transform: translateY(100%);
    }
    
    /* Efecto cascada para múltiples banderas */
    #custom-wpml-language-switcher:hover a:not(.active):nth-child(2) {
        transform: translateY(120%);
		    background-color: white;
    padding: 0px 8px 6px 8px;
		    left: -7px;
    }
    
    #custom-wpml-language-switcher:hover a:not(.active):nth-child(3) {
        transform: translateY(200%);
    }
    
    #custom-wpml-language-switcher:hover a:not(.active):nth-child(4) {
        transform: translateY(300%);
    }
    
    #custom-wpml-language-switcher:hover a:not(.active):nth-child(5) {
        transform: translateY(400%);
    }
}

/* Estilos específicos para móviles */
@media (max-width: 767px) {
    #custom-wpml-language-switcher {

        /* Ajustamos la alineación vertical */
        display: inline-block;
        vertical-align: middle;
    }
    
    #custom-wpml-language-switcher a img {
        /* Garantizamos que no se reduzca el tamaño */
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        min-height: 24px !important;
    }
    
    /* Cursor pointer para indicar que es clickeable */
    #custom-wpml-language-switcher a.active {
        cursor: pointer;
        /* Aseguramos que la bandera activa esté bien posicionada */
        position: relative;
        display: inline-block;
        vertical-align: middle;
    }
}

/* Cuando se activa específicamente en móviles (clase agregada por JS) */
body.is-mobile #custom-wpml-language-switcher.mobile-active a:not(.active) {
    opacity: 1;
    z-index: 100;
}

/* Posicionamiento específico para cada bandera en estado activo en móvil */
body.is-mobile #custom-wpml-language-switcher.mobile-active a:not(.active):nth-child(2) {
    transform: translateY(120%);
}

body.is-mobile #custom-wpml-language-switcher.mobile-active a:not(.active):nth-child(3) {
    transform: translateY(200%);
}

body.is-mobile #custom-wpml-language-switcher.mobile-active a:not(.active):nth-child(4) {
    transform: translateY(300%);
}

body.is-mobile #custom-wpml-language-switcher.mobile-active a:not(.active):nth-child(5) {
    transform: translateY(400%);
}

/* Estado no activo en móviles */
body.is-mobile #custom-wpml-language-switcher a:not(.active) {
    opacity: 0;
    transform: translateY(0);
}