/* 
 * AI ChatBot PRO v2.0 - Estilos del Widget Frontend
 * Ruta: assets/css/chatbot.css
 */

/* Variables CSS */
:root {
    --chatbot-primary: #0084ff;
    --chatbot-text: #1c1e21;
    --chatbot-bg: #ffffff;
    --chatbot-user-bg: #0084ff;
    --chatbot-bot-bg: #f0f0f0;
}

/* Contenedor principal */
#ai-chatbot-widget {
    --primary-color: var(--chatbot-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    z-index: 999999;
}

/* Posiciones */
.ai-chatbot-position-bottom-right {
    position: fixed;
    bottom: 20px;
    right: 20px;
}

.ai-chatbot-position-bottom-left {
    position: fixed;
    bottom: 20px;
    left: 20px;
}

/* Botón flotante */
.ai-chatbot-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.ai-chatbot-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.ai-chatbot-trigger svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.ai-chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
}

/* Ventana de chat */
.ai-chatbot-window {
    position: fixed;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-chatbot-position-bottom-right .ai-chatbot-window {
    bottom: 100px;
    right: 20px;
}

.ai-chatbot-position-bottom-left .ai-chatbot-window {
    bottom: 100px;
    left: 20px;
}

/* Header */
.ai-chatbot-header {
    background: var(--primary-color);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.ai-chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-chatbot-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-chatbot-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.ai-chatbot-close-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Área de mensajes */
.ai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ai-chatbot-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.ai-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mensajes */
.ai-chatbot-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-chatbot-message-bot {
    align-self: flex-start;
}

.ai-chatbot-message-user {
    align-self: flex-end;
}

.ai-chatbot-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.ai-chatbot-message-bot .ai-chatbot-message-content {
    background: white;
    color: var(--chatbot-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ai-chatbot-message-user .ai-chatbot-message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-chatbot-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 6px;
}

.ai-chatbot-message-user .ai-chatbot-message-time {
    text-align: right;
}

/* Indicador de escritura */
.ai-chatbot-typing {
    padding: 0 20px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chatbot-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.ai-chatbot-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite;
}

.ai-chatbot-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-chatbot-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;
    }
}

/* Área de input */
.ai-chatbot-input-area {
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 16px;
}

#ai-chatbot-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

#ai-chatbot-input {
    flex: 1;
    border: 1px solid #e9ecef;
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

#ai-chatbot-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.1);
}

#ai-chatbot-send {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#ai-chatbot-send:hover {
    background: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 132, 255, 0.3);
}

#ai-chatbot-send:active {
    transform: scale(0.95);
}

/* Opción de WhatsApp */
.ai-chatbot-whatsapp-option {
    margin-top: 12px;
    text-align: center;
}

.ai-chatbot-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #25D366;
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.ai-chatbot-whatsapp-btn:hover {
    background: #128C7E;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

/* Footer */
.ai-chatbot-footer {
    padding: 8px 16px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.ai-chatbot-footer small {
    font-size: 11px;
    color: #999;
}

/* Responsive */
@media (max-width: 480px) {
    .ai-chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        border-radius: 12px 12px 0 0;
    }

    .ai-chatbot-position-bottom-right .ai-chatbot-window,
    .ai-chatbot-position-bottom-left .ai-chatbot-window {
        bottom: 0;
        left: 10px;
        right: 10px;
    }
}

/* Animaciones de entrada/salida */
.ai-chatbot-window.show {
    animation: slideUp 0.3s ease;
}

.ai-chatbot-window.hide {
    animation: slideDown 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideDown {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
}