/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Botón flotante del chatbot */
.chatbot-button {
    position: fixed;
    bottom: 10px;  /* Debajo del botón de WhatsApp (que está en 80px) */
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #7BC200, #69A600);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
    transition: all 0.3s ease;
    z-index: 998;  /* Debajo del WhatsApp (999) pero el modal será 1000 */
    color: white;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 102, 204, 0.5);
}

.chatbot-button.active {
    transform: scale(0.9);
    opacity: 0;
}

.chatbot-notification {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4444;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid white;
}

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

/* Contenedor del chatbot */
.chatbot-container {
    position: fixed;
    bottom: 10px;  /* Alineado con el botón del chatbot */
    right: 24px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transform: scale(0) translateY(20px);
    transform-origin: bottom right;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;  /* Por encima del WhatsApp (999) y del botón del chatbot (998) */
    overflow: hidden;
}

.chatbot-container.active {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Header del chatbot */
.chatbot-header {
    background: linear-gradient(135deg, #7BC200, #69A600);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.chatbot-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Área de mensajes */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

/* Mensajes */
.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: messageSlideIn 0.3s ease;
}

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

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
}

.bot-message .message-content {
    background: white;
    color: #2d3748;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.user-message .message-content {
    background: #7BC200;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #718096;
    margin-top: 4px;
    padding: 0 8px;
}

.user-message .message-time {
    text-align: right;
}

/* Opciones rápidas */
.quick-options {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-options.hidden {
    display: none;
}

.quick-option {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    color: #2d3748;
    font-weight: 500;
}

.quick-option:hover {
    background: #7BC200;
    color: white;
    border-color: #7BC200;
    transform: translateY(-1px);
}

/* Input de mensaje */
.chatbot-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.chatbot-input:focus {
    border-color: #7BC200;
}

.chatbot-send {
    width: 40px;
    height: 40px;
    background: #7BC200;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-send:hover {
    background: #69A600;
    transform: scale(1.05);
}

.chatbot-send:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: scale(1);
}

/* Indicador de escritura */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #cbd5e0;
    border-radius: 50%;
    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);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Formulario de contacto */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.contact-form input {
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.contact-form input:focus {
    border-color: #7BC200;
}

.contact-form button {
    padding: 12px;
    background: #7BC200;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.contact-form button:hover {
    background: #69A600;
}

.contact-form button:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
    .chatbot-container {
        width: calc(100vw - 32px);
        height: calc(100vh - 32px);
        bottom: 16px;
        right: 16px;
    }

    .chatbot-button {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
    }
}

/* Estados de éxito */
.success-message {
    background: #48bb78;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    text-align: center;
    font-size: 14px;
    animation: messageSlideIn 0.3s ease;
}

.error-message {
    background: #f56565;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    text-align: center;
    font-size: 14px;
    animation: messageSlideIn 0.3s ease;
}
