﻿#chat-avatar {
    position: fixed;
    bottom: 110px;
    right: 20px;
    cursor: pointer;
    z-index: 1000;
    display: none; /* oculto al inicio */
    opacity: 0;
    transition: opacity 1s ease-in;
}

    #chat-avatar.show {
        display: block;
        opacity: 1;
    }

    #chat-avatar img {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        box-shadow: 0 0 10px rgba(0,0,0,0.3);
    }

#chat-box {
    position: fixed;
    bottom: 160px;
    right: 20px;
    width: 300px;
    height: 400px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 20px;
    display: none; /* oculto al inicio */
    flex-direction: column;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
    transform: translateY(20px);
}

    #chat-box.show {
        display: flex;
        opacity: 1;
        transform: translateY(0);
    }


#chat-header {
    background: #E5812E;
    color: #fff;
    padding: 10px;
    font-weight: bold;
    border-radius: 20px 20px 0 0;
}

#chat-messages {
    flex: 1; /* ocupa el espacio disponible */
    padding: 10px;
    overflow-y: auto;
    font-size: 14px;
    max-height: calc(100% - 50px); /* deja espacio para el input */
}

#chat-input-area {
    display: flex;
    border-top: 1px solid #ccc;
    flex-shrink: 0; /* evita que se colapse */    
}

#chat-input {
    flex: 1;
    border: none;
    padding: 10px;
    font-size: 14px;
    border-radius: 0 0 20px 20px;
}

    #chat-input:focus {
        outline: none;
    }

#chat-input-area button {
    background: #E5812E;
    color: #fff;
    border: none;
    padding: 10px;
    cursor: pointer;
    border-radius: 2px 2px 20px 2px;
}

.animated-avatar {
    width: 120px;
    height: auto;
    opacity: 0; /* oculto al inicio */
    animation: fadeIn 2s ease forwards, float 3s ease-in-out infinite, wave 6s ease-in-out infinite, blink 4s linear infinite, shadowPulse 5s ease-in-out infinite;
    transform-origin: center bottom;
}

/* Fade-in inicial */
@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Movimiento de “flotar” */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Movimiento de “saludo” (rotación ligera) */
@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(5deg);
    }

    50% {
        transform: rotate(-5deg);
    }

    75% {
        transform: rotate(3deg);
    }
}

/* Simulación de parpadeo */
@keyframes blink {
    0%, 90%, 100% {
        filter: brightness(1);
    }

    95% {
        filter: brightness(0.7);
    }
}

/* Sombra dinámica para efecto 3D */
@keyframes shadowPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(0,0,0,0.3);
    }

    50% {
        box-shadow: 0 0 25px rgba(0,0,0,0.6);
    }
}


/* Contenedor de los tres puntitos */
.typing-indicator {
    display: inline-block;
    margin-left: 5px;
    vertical-align: middle;
}

    /* Cada puntito */
    .typing-indicator span {
        display: inline-block;
        width: 6px;
        height: 6px;
        margin: 0 2px;
        background-color: #333;
        border-radius: 50%;
        animation: blink 1.4s infinite both;
    }

        /* Retrasos para que los puntitos se animen en secuencia */
        .typing-indicator span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-indicator span:nth-child(3) {
            animation-delay: 0.4s;
        }

/* Animación de parpadeo */
@keyframes blink {
    0% {
        opacity: 0.2;
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0.2;
    }
}
