/* ai-chat.css */
:root {
    --ai-primary: #00e5ff;
    --ai-secondary: #001a2c;
    --ai-bg: rgba(255, 255, 255, 0.9);
    --ai-text: #1e293b;
    --ai-glass: rgba(255, 255, 255, 0.7);
}

#ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px !important;
    left: auto !important;
    z-index: 999999 !important;
    pointer-events: none;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Global fix for geometric overlays */
.elegant-shape {
    pointer-events: none !important;
}

#ai-chat-bubble,
#ai-chat-window {
    pointer-events: auto;
    /* Permitir clicks solo cuando el widget lo permita */
}

#ai-chat-bubble {
    width: 65px;
    /* Un poco mas grande */
    height: 65px;
    background: white url('bot-avatar.png') center/cover no-repeat;
    border-radius: 50%;
    border: 3px solid var(--ai-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#ai-chat-bubble i {
    display: none;
    /* Ocultamos el icono de lucide */
}

#ai-chat-bubble:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 30px rgba(0, 229, 255, 0.4);
}

#ai-chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 320px;
    height: 450px;
    /* Mas compacto para evitar el header */
    background: var(--ai-bg);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    /* Evita que bloquee clicks cuando está invisible */
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#ai-chat-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.ai-chat-header {
    padding: 1.25rem;
    background: var(--ai-secondary);
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-header img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid var(--ai-primary);
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.ai-chat-header p {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

#ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-chat-message {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 85%;
    font-size: 0.95rem;
    line-height: 1.4;
    user-select: text;
    cursor: text;
    /* Indica claramente que es copiable */
    position: relative;
}

.ai-chat-message.user {
    align-self: flex-end;
    background: var(--ai-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-chat-message.bot {
    align-self: flex-start;
    background: #f1f5f9;
    color: var(--ai-text);
    border-bottom-left-radius: 4px;
}

/* Botones y Links en el Chat */
.chat-btn {
    display: inline-block;
    background: var(--ai-primary);
    color: #001a2c !important;
    /* Azul oscuro para contraste con cian */
    padding: 8px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 800;
    margin-top: 10px;
    font-size: 0.8rem;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(0, 229, 255, 0.2);
    border: none;
    width: 100%;
    text-align: center;
}

.chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 229, 255, 0.4);
    filter: brightness(1.1);
}

.chat-link {
    color: #009ee2;
    font-weight: 600;
    text-decoration: underline;
}

.ai-chat-footer {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

#ai-chat-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem;
    outline: none;
    transition: border-color 0.3s;
}

#ai-chat-input:focus {
    border-color: var(--ai-primary);
}

#ai-chat-send {
    background: var(--ai-primary);
    color: white;
    border: none;
    border-radius: 10px;
    width: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.3s;
}

#ai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.typing-indicator {
    padding: 0.75rem 1rem;
    background: #f1f5f9;
    border-radius: 15px;
    display: flex;
    gap: 4px;
    width: fit-content;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    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);
    }

    30% {
        transform: translateY(-4px);
    }
}

@media (max-width: 768px) {
    #ai-chat-window {
        bottom: 0px !important;
        right: -10px !important;
        left: auto !important;
        width: 95vw !important;
        height: 70vh !important;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    }

    #ai-chat-widget {
        right: 15px !important;
        bottom: 20px !important;
        left: auto !important;
    }
}