#ia-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 90px;
    height: auto;
    z-index: 999 !important;
    /* MÁS ALTO QUE TODO */
    cursor: pointer;
    transition: all 0.3s ease;
    /* Efectos holográficos */
    filter:
        drop-shadow(0 0 10px rgba(0, 255, 255, 0.6)) drop-shadow(0 0 20px rgba(0, 255, 255, 0.4)) brightness(1.1) contrast(1.2);
    /* Animación inicial - fuera de pantalla */
    transform: translateX(200px) scale(0.5);
    opacity: 0;
}

/* Animación de entrada del IA */
#ia-widget.ia-entrada {
    animation: iaEntrada 2s ease-out forwards;
}

/* Estado de reposo del IA */
#ia-widget.ia-reposo {
    animation: iaReposo 4s ease-in-out infinite;
    transform: translateX(0) scale(1);
    opacity: 1;
}

#ia-widget img {
    width: 100%;
    height: auto;
    border-radius: 50%;
    object-fit: cover;
}

/* Hover effects */
#ia-widget:hover {
    transform: translateX(0) scale(1.1);
    filter:
        drop-shadow(0 0 15px rgba(0, 255, 255, 0.8)) drop-shadow(0 0 30px rgba(0, 255, 255, 0.6)) brightness(1.3) contrast(1.4);
}

/* Tooltip del IA - Z-INDEX ALTO */
.ia-tooltip {
    position: fixed;
    bottom: 160px;
    right: 30px;
    background: linear-gradient(135deg, #1a1a3e, #2d4a6b);
    color: #00ffff;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000 !important;
    /* MÁS ALTO QUE TODO */
    /* Efectos holográficos */
    border: 2px solid rgba(0, 255, 255, 0.5);
    box-shadow:
        0 0 20px rgba(0, 255, 255, 0.3),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
    /* Animación inicial - oculto */
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s ease;
}

/* Tooltip visible */
.ia-tooltip.tooltip-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: tooltipPulse 3s ease-in-out infinite;
}

/* Flecha del tooltip */
.ia-tooltip::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(0, 255, 255, 0.8);
}

/* Contenedor principal del chat con efectos holográficos - Z-INDEX MÁS ALTO */
#ia-chatbox {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    height: 460px;
    background: linear-gradient(135deg, #1a1a3e, #2d4a6b);
    border-radius: 12px;
    border: 2px solid rgba(0, 255, 255, 0.3);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(0, 255, 255, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1002 !important;
    /* EL MÁS ALTO DE TODOS */
    font-family: Arial, sans-serif;
}

#ia-chatbox.activo {
    display: flex;
    animation: chatboxGlow 2s ease-in-out infinite alternate;
}

@keyframes chatboxGlow {
    0% {
        box-shadow:
            0 4px 16px rgba(0, 0, 0, 0.3),
            0 0 30px rgba(0, 255, 255, 0.2);
    }

    100% {
        box-shadow:
            0 4px 16px rgba(0, 0, 0, 0.3),
            0 0 40px rgba(0, 255, 255, 0.4);
    }
}

/* Keyframes */
@keyframes chefEntrada {
    0% {
        transform: translateX(200px) scale(0.5) rotate(10deg);
        opacity: 0;
    }

    50% {
        transform: translateX(-10px) scale(1.1) rotate(-5deg);
        opacity: 0.8;
    }

    70% {
        transform: translateX(5px) scale(0.95) rotate(2deg);
        opacity: 0.9;
    }

    100% {
        transform: translateX(0) scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes chefReposo {

    0%,
    100% {
        transform: translateX(0) scale(1) translateY(0);
    }

    25% {
        transform: translateX(0) scale(1.05) translateY(-5px);
    }

    50% {
        transform: translateX(0) scale(1) translateY(-3px);
    }

    75% {
        transform: translateX(0) scale(0.98) translateY(-1px);
    }
}

@keyframes iaEntrada {
    0% {
        transform: translateX(200px) scale(0.5) rotate(10deg);
        opacity: 0;
    }

    50% {
        transform: translateX(-10px) scale(1.1) rotate(-5deg);
        opacity: 0.8;
    }

    70% {
        transform: translateX(5px) scale(0.95) rotate(2deg);
        opacity: 0.9;
    }

    100% {
        transform: translateX(0) scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes iaReposo {

    0%,
    100% {
        transform: translateX(0) scale(1) translateY(0);
    }

    25% {
        transform: translateX(0) scale(1.05) translateY(-5px);
    }

    50% {
        transform: translateX(0) scale(1) translateY(-3px);
    }

    75% {
        transform: translateX(0) scale(0.98) translateY(-1px);
    }
}

@keyframes titleGlow {
    0% {
        text-shadow:
            0 0 10px #00ffff,
            0 0 20px #00ffff,
            0 0 40px #00ffff;
    }

    100% {
        text-shadow:
            0 0 20px #00ffff,
            0 0 30px #00ffff,
            0 0 60px #00ffff,
            0 0 80px #00ffff;
    }
}

@keyframes subtitleFade {
    0% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

@keyframes tooltipPulse {

    0%,
    100% {
        box-shadow:
            0 0 20px rgba(0, 255, 255, 0.3),
            inset 0 0 20px rgba(0, 255, 255, 0.1);
    }

    50% {
        box-shadow:
            0 0 30px rgba(0, 255, 255, 0.5),
            inset 0 0 30px rgba(0, 255, 255, 0.2);
    }
}

/* Encabezado del chat holográfico */
.ia-header {
    background: linear-gradient(135deg, #00ffff, #0080ff);
    height: 50px;
    color: white;
    padding: 0 20px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    flex-shrink: 0;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Botón cerrar holográfico */
#ia-cerrar {
    background: transparent;
    border: none;
    font-size: 18px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

#ia-cerrar:hover {
    text-shadow: 0 0 10px #ffffff;
    transform: scale(1.2);
}

/* Área de mensajes con fondo holográfico */
#ia-mensajes {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

/* Mensajes con efectos holográficos */
.ia-mensaje {
    padding: 10px 14px;
    border-radius: 14px;
    max-width: 75%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    border: 1px solid rgba(0, 255, 255, 0.3);
}

.ia-mensaje.usuario {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.2), rgba(0, 150, 255, 0.2));
    align-self: flex-end;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.ia-mensaje.bot {
    background: linear-gradient(135deg, rgba(0, 255, 100, 0.2), rgba(0, 200, 150, 0.2));
    align-self: flex-start;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(0, 255, 100, 0.3);
}

/* Área de entrada holográfica */
#ia-input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid rgba(0, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.3);
    gap: 8px;
    flex-shrink: 0;
}

#tato-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
}

#tato-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

#tato-input:focus {
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

#ia-enviar {
    background: linear-gradient(135deg, #00ffff, #0080ff);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

#ia-enviar:hover {
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
    transform: scale(1.05);
}

/* Scrollbar holográfica */
#ia-mensajes::-webkit-scrollbar {
    width: 6px;
}

#ia-mensajes::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

#ia-mensajes::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00ffff, #0080ff);
    border-radius: 3px;
}

#ia-mensajes::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00cccc, #0066cc);
}