/* ============================================= */
/* ESTILOS DEL CHATBOT CYAVNL */
/* ============================================= */

/* Botón flotante para abrir/cerrar el chat */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: #0C5C35;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(12, 92, 53, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
}

.chatbot-toggle:hover {
    background-color: #0f6e40;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(12, 92, 53, 0.5);
}

.chatbot-toggle svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* Contenedor principal del chat */
.chat-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    max-width: calc(100vw - 60px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: none;
    flex-direction: column;
    height: 600px;
    max-height: calc(100vh - 150px);
    z-index: 999;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-container.active {
    display: flex;
}

/* Encabezado del chat */
.chat-header {
    background-color: #0C5C35;
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

.chat-header h2 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
}

.chat-header p {
    margin: 5px 0 0;
    font-size: 0.8em;
    opacity: 0.9;
}

/* Botón cerrar chat */
.close-chat {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    line-height: 1;
}

.close-chat:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Área de mensajes */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9f9f9;
}

/* Mensaje individual */
.message {
    margin-bottom: 15px;
    display: flex;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    justify-content: flex-start;
}

.message.user {
    justify-content: flex-end;
}

/* Contenido del mensaje */
.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 15px;
    word-wrap: break-word;
    font-size: 0.9em;
    line-height: 1.4;
}

.message.bot .message-content {
    background-color: #0C5C35;
    color: white;
    border-bottom-left-radius: 5px;
}

.message.user .message-content {
    background-color: #e9ecef;
    color: #333;
    border-bottom-right-radius: 5px;
}

/* Opciones rápidas */
.quick-options {
    padding: 10px 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.quick-btn {
    padding: 6px 12px;
    background-color: #0C5C35;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.75em;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.quick-btn:hover {
    background-color: #b9b9a5ed;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(12, 92, 53, 0.3);
}

/* Contenedor del input */
.chat-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
}

/* Campo de texto */
.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.chat-input:focus {
    border-color: #0C5C35;
}

/* Botón enviar */
.send-btn {
    padding: 10px 20px;
    background-color: #0C5C35;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.3s ease;
}

.send-btn:hover {
    background-color: #0f6e40;
    transform: scale(1.05);
}

/* Indicador de escritura */
.typing-indicator {
    display: none;
    padding: 10px 15px;
    background-color: #32835b;
    border-radius: 15px;
    width: fit-content;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: white;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Scrollbar personalizado */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #0C5C35;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #2b8559;
}

/* ============================================= */
/* RESPONSIVE DESIGN */
/* ============================================= */

/* Tablets y dispositivos medianos */
@media (max-width: 768px) {
    .chat-container {
        width: 380px;
        height: 550px;
    }
}

/* Móviles */
@media (max-width: 480px) {
    .chat-container {
        bottom: 100px;
        right: 15px;
        left: 15px;
        width: auto;
        height: 500px;
        max-height: calc(100vh - 130px);
    }

    .chatbot-toggle {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }

    .chatbot-toggle svg {
        width: 26px;
        height: 26px;
    }

    .chat-header h2 {
        font-size: 1.1em;
    }

    .chat-header p {
        font-size: 0.75em;
    }

    .message-content {
        max-width: 85%;
        font-size: 0.85em;
    }

    .quick-btn {
        font-size: 0.7em;
        padding: 5px 10px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 360px) {
    .chat-container {
        height: 450px;
    }

    .quick-options {
        padding: 8px 10px;
        gap: 4px;
    }

    .chat-input-container {
        padding: 12px;
    }
}