/* ===========================
   1. Botón flotante del chatbot
   =========================== */
.chatbot-video {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 130px; /* Ajusta el tamaño del video */
    height: 130px;
    border-radius: 50%; /* Botón redondo */
    background-color: #ffffff; /* Fondo blanco */
    cursor: pointer;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2); /* Sombra para darle profundidad */
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out; /* Transición suave */
    display: flex;
    align-items: center;
    justify-content: center;
    animation: chatbot-button-ani 0.4s;
}

.chatbot-video:hover {
    transform: scale(1.1); /* Efecto de agrandamiento */
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.3); /* Sombra más pronunciada al pasar el mouse */
}

/* ===========================
   2. Caja de entrada y botones
   =========================== */
.chat-input {
    width: 100%;
    display: flex;
    align-items: center; /* Para alinear verticalmente todos los elementos */
    gap: 10px; /* Espacio entre los elementos */
}

.voice-btn {
    background-color: #4CAF50; /* Color verde para el micrófono */
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.voice-btn:hover {
    background-color: #45a049; /* Cambio de color al pasar el ratón */
}

input[type="text"] {
    flex-grow: 1; /* Esto hace que el input ocupe todo el espacio disponible */
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

/* #send-btn {
    background-color: #007bff; 
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
}

#send-btn:hover {
    background-color: #0056b3;
} */

.chatbot-btn i {
    font-size: 24px;
}

#mic-btn {
    background-color: #ff3b30; /* Rojo estilo grabación */
    color: white;
    border: none;
    padding: 12px 14px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    margin-left: 10px;
    transition: background-color 0.3s ease;
}

#mic-btn:hover {
    background-color: #c8231c;
}

/* ===========================
   3. Contenedor principal del chatbot
   =========================== */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 28%;
    height: 90%;
    max-width: 90%;
    background-color: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transition: all 0.3s ease-in-out;
}

.chatbot-container.hidden {
    display: none;
}

/* ===========================
   4. Cabecera del chatbot
   =========================== */

.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: #4A7C59;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    position: relative;
}

.chatbot-header-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header-section.left,
.chatbot-header-section.right {
    flex: 0 0 auto;
    min-width: 0;
}

.chatbot-header-section.center {
    position: absolute;
    left: 42.5%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 10px;
    
    min-width: 120px;
}

.chatbot-header-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header-section.center {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
    gap: 10px;
}

.chatbot-header-section.left,
.chatbot-header-section.right {
    flex: 0 0 auto;
}

.header-btn {
    background: none;
    border: none;
    border-radius: 50%;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.header-btn:hover {
    background: #f0f0f0;
}

.icon-container {
    position: relative;
    width: 40px;
    height: 40px;
}

.chatbot-icon {
    width: 40px;
    height: 40px;
}

.online-indicator {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -3px;
    right: -3px;
    background-color: #2ecc71;
    border: 2px solid white;
    border-radius: 50%;
}

.bot-name {
    color: #222;
    font-family: 'Poppins', sans-serif;
    font-weight: bold;
    font-size: 15px;
    margin-left: 6px;
}

.chat-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-options .mute-btn {
    background: none;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.chat-options .clear-chat {
    background: none;
    color: #0000;
    border: none;
    font-size: 28px;
    cursor: pointer;
}

.bot-name-container {
    justify-items: center;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: white;
    border-radius: 999px; 
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); 
    margin: 0 auto;
    width: auto;
    height: auto;
    margin-left: 70px;
}

/* ===========================
   5. Ventana de mensajes
   =========================== */
.chat-window {
    background-image: 
        linear-gradient(rgba(250, 250, 248, 0.79), rgba(250, 250, 248, 0.79)),
        url(../imagenes/tajamar.png);
    background-size: cover;
    background-attachment: unset;
    background-position: 50% 50%;
    display: flex;
    flex-direction: column;
    gap: 10px; /* Espacio entre los mensajes */
    padding: 20px;
    overflow-y: auto;
    background-color: #FAFAF8; 
    flex-grow: 1;
}

/* ===========================
   6. Mensajes (usuario y bot)
   =========================== */
.chat-message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 15px;
    font-size: 15px;
    line-height: 1.4;
    max-width: 75%;
    word-wrap: break-word;
    display: inline-block;
    transition: transform 0.3s ease-in-out;
}

/* Estilo de los mensajes del bot */
.chat-message.bot {
    background-color: #ece5dd; /* Gris claro, color típico de los mensajes del bot */
    color: #333;
    margin-right: auto; /* Alinea el mensaje del bot a la izquierda */
    text-align: left;
    border-radius: 20px 20px 20px 0;  /* Burbujas para el bot */
    margin-top: 15px;
    padding: 10px 20px;
    max-width: 75%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); /* Sombra ligera */
}

.chat-message.bot {
    background-color: #ece5dd; /* Gris claro (similar al de WhatsApp) */
    color: #333;
    margin-right: auto;
    text-align: left;
    border-radius: 20px 20px 20px 0;
    margin-top: 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Ajuste para separar las burbujas de usuario y bot */
.chat-message.user + .chat-message.bot, 
.chat-message.bot + .chat-message.user {
    margin-top: 25px; /* Mayor espacio entre los mensajes del usuario y el bot */
}

/* ===========================
   7. Contenedor de la caja de entrada
   =========================== */
.chat-input-container {
    display: flex;
    padding: 10px;
    background-color: #fff;

    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

/* Estilo para la entrada de texto y botón de envío */
.chat-input {
    display: flex;
    /* align-items: center; */
    justify-content: center;
    /* border: 2px solid #0078FF; */
    border-radius: 20px;
    padding: 5px 10px;
    background-color: #FAFAF8;
    width: 80%;
    /* margin-left: 20px; */
    margin-bottom: 50px;
}

.chat-input input {
    border: none;
    outline: none;
    flex-grow: 1;
    font-size: 16px;
    padding: 8px;
    
    
}
/* 122 184 119 */
.chat-input textarea {
    flex-grow: 1;
    overflow: hidden;
    resize: none;
    width: 100%;
    min-height: 38px;
    max-height: 50px;
    font-size: 16px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    outline: none;
    background: #fff;
    transition: border-color 0.2s;
    box-sizing: border-box;
    margin-bottom: 20px;
}

.chat-input textarea:focus {
    border-color: #D2691E;
}

.icons-btn {
    position: absolute;
    top: 0px;
    height: 100%;
    display: flex;
    align-items: flex-end;
    padding-bottom: 10px;
    right: 10px;
    color: rgb(17, 17, 17);
}

/* ===========================
   8. Botón de enviar (estilo especial)
   =========================== */
/* .chat-send-btn {
    background-color: #25d366; 
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
    transition: background-color 0.3s ease;
}

.chat-send-btn:hover {
    background-color: #128c7e; 
} */

/* ===========================
   9. Animaciones
   =========================== */
@keyframes messageIn {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Aplicando animación suave a los mensajes */
.chat-message {
    animation: messageIn 0.5s ease-out;
}

@keyframes chatbot-button-ani{
    0%{
        transform:scale(.5);
        transform-origin:center bottom;
    }
    100%{
        transform:scale(1);
        transform-origin:center bottom;
    }
}

@keyframes scale-down-bottom-right{
    0%{
        transform:scaleY(1);
        transform-origin:right bottom;
    }
    100%{
        transform:scaleY(.1);
        transform-origin:right bottom;
    }
}

.chatbot-container.opening {
    animation:scale-down-bottom-right 0.25s reverse;
}


/* ===========================
   10. Responsividad
   =========================== */
@media (max-width: 480px) {
    .chatbot-container {
        width: 90%;
        height: 450px;
    }

    .chatbot-header {
        font-size: 16px;
    }

    .chat-message {
        font-size: 14px;
    }
}

/* ===========================
   11. Otros estilos auxiliares
   =========================== */
.message-box{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: start;
    width: 100%;
    height: max-content;
    gap: 10px;
}

.title{
    font-weight: bold;
}

/* Haz que el contenedor sea relativo */
.chat-input-relative {
    position: relative;
    width: 100%;
    display: flex;
    align-items: flex-end;
    background: #FAFAF8;
    
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    margin-bottom: 0;
}

/* El textarea ocupa todo el ancho, pero deja espacio a la derecha */
.chat-input-relative textarea {
    flex: 1;
    min-height: 38px;
    max-height: 120px;
    resize: none;
    border: 2px solid #ccc;
    border-radius: 16px;
    padding: 10px 70px 10px 10px; /* padding-right grande para los botones */
    font-size: 16px;
    outline: none;
    background: #fff;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

/* Acciones (botones) sobre el textarea */
.chat-input-actions {
    position: absolute;
    flex-direction: row-reverse;
    right: 18px;
    bottom: 14px;
    display: flex;
    gap: 6px;
    z-index: 2;
    margin-bottom: 20px;
}

/* Botones modernos */
.chat-input-actions button {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-input-actions button:hover {
    background: #f0f0f0;
}

/* Mensaje del bot */
.bot-message, .chat-message.bot {
    background: #E8F5E8;
    color: #2d4a2d;
    align-self: flex-start;
    border-radius: 18px;
    border-bottom-left-radius: 8px;
    border: 1px solid #d4edda;
    max-width: 80%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease-out;
}

/* Mensaje del usuario */
.user-message, .chat-message.user {
    background: #F5F5DC;
    color: #5d4e37;
    align-self: flex-end;
    border-radius: 18px;
    border-bottom-right-radius: 8px;
    border: 1px solid #f0e68c;
    max-width: 80%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   12. Indicador de escritura
   =========================== */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: #E8F5E8;
    border-radius: 18px;
    border-bottom-left-radius: 8px;
    max-width: 80px;
    align-self: flex-start;
    border: 1px solid #d4edda;
    margin-bottom: 10px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #6B8E23;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-10px); opacity: 1; }
}

/* ===========================
   13. Responsive avanzado para chat
   =========================== */
@media (max-width: 900px) {
    .chatbot-container {
        width: 60%;
        right: 10px;
        left: 10px;
        min-width: unset;
        max-width: 98vw;
    }
}
@media (max-width: 600px) {
    .chatbot-container {
        width: 92vw;
        height: 90vh;
        min-width: unset;
        max-width: 98vw;
        left: 4vw !important;
        right: 4vw !important;
        bottom: 4vh !important;
        border-radius: 18px !important;
        box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    }
    .chatbot-header {
        border-top-left-radius: 18px !important;
        border-top-right-radius: 18px !important;
        padding: 8px 8px;
        font-size: 15px;
    }
    .chat-window {
        padding: 8px;
        font-size: 14px;
        min-height: 200px;
    }
    .chat-input, .chat-input-relative {
        padding: 4px 4px;
        margin-bottom: 0;
        width: 100%;
    }
    .chat-input textarea {
        font-size: 15px;
        min-height: 32px;
        max-height: 80px;
        padding: 8px 50px 8px 8px;
    }
    .chat-input-actions {
        right: 8px;
        bottom: 8px;
        gap: 2px;
        margin-bottom: 20px;
    }
    .chatbot-video {
        width: 70px;
        height: 70px;
        bottom: 10px;
        right: 10px;
    }
    .bot-message, .chat-message.bot, .user-message, .chat-message.user {
        font-size: 13px;
        padding: 8px 10px;
        max-width: 95%;
    }
}
@media (max-width: 400px) {
    .chatbot-container {
        width: 98vw;
        height: 96vh;
        left: 1vw !important;
        right: 1vw !important;
        bottom: 2vh !important;
        border-radius: 14px !important;
    }
    .chatbot-header {
        font-size: 13px;
        padding: 4px 2px;
    }
    .chat-window {
        padding: 4px;
    }
}
