/* ==============================================
   CHATBOT WIDGET - Alitas Capi
   ============================================== */

/* Burbuja flotante del robot 3D */
.chatbot-bubble {
    position: fixed;
    bottom: 0px;
    right: 10px;
    width: 160px;
    height: 185px;
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.3s ease;
    padding: 0;
    overflow: hidden;
}

.chatbot-bubble:hover {
    transform: scale(1.07) translateY(-4px);
}

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

/* Anillo de pulso en la base del robot */
.chatbot-bubble::before {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 20px;
    border-radius: 50%;
    background: rgba(227, 6, 19, 0.35);
    filter: blur(8px);
    animation: chatbot-glow 2.5s ease-in-out infinite;
    z-index: -1;
}

@keyframes chatbot-glow {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) scaleX(1); }
    50%       { opacity: 0.9; transform: translateX(-50%) scaleX(1.3); }
}

/* Cubre el watermark "with Spline" del iframe */
.spline-watermark-cover {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 130px;
    height: 24px;
    background: #111;
    z-index: 10;
    pointer-events: none;
}

/* Ventana del chat */
.chatbot-window {
    position: fixed;
    bottom: 110px;
    right: 25px;
    width: 370px;
    max-height: 520px;
    background: #1a1a1a;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header del chat */
.chatbot-header {
    background: linear-gradient(135deg, #E30613, #c00510);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
}

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

.chatbot-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
    position: relative;
}

.chatbot-header-text h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

.chatbot-header-text p {
    margin: 0;
    font-size: 11px;
    opacity: 0.85;
}

.chatbot-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chatbot-close:hover {
    opacity: 1;
}

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

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

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

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

/* Burbujas de mensaje */
.chatbot-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: chatbot-fadeIn 0.3s ease;
}

@keyframes chatbot-fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-msg.bot {
    background: #2a2a2a;
    color: #eee;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chatbot-msg.user {
    background: linear-gradient(135deg, #E30613, #ff2222);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Indicador "escribiendo..." */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #2a2a2a;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 70px;
}

.chatbot-typing span {
    width: 7px;
    height: 7px;
    background: #888;
    border-radius: 50%;
    animation: chatbot-typing-dot 1.4s infinite;
}

.chatbot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chatbot-typing-dot {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Sugerencias rápidas */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 10px;
    background: #111;
}

.chatbot-suggestion {
    background: #2a2a2a;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-suggestion:hover {
    background: #E30613;
    color: #fff;
    border-color: #E30613;
}

/* Input de mensaje */
.chatbot-input-area {
    display: flex;
    padding: 12px;
    background: #1a1a1a;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 24px;
    border: 1px solid #333;
    background: #222;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    font-family: 'Poppins', sans-serif;
}

.chatbot-input::placeholder {
    color: #666;
}

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

.chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #E30613;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}

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

.chatbot-send:disabled {
    background: #444;
    cursor: not-allowed;
    transform: none;
}

/* Responsive */
@media (max-width: 480px) {
    .chatbot-window {
        right: 10px;
        left: 10px;
        bottom: 80px;
        width: auto;
        max-height: 70vh;
    }

    .chatbot-bubble {
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
        font-size: 24px;
    }
}

/* Ocultar en impresión */
@media print {
    .chatbot-bubble,
    .chatbot-window {
        display: none !important;
    }
}

/* ==============================================
   RESPONSIVE CHATBOT
   ============================================== */
@media (max-width: 768px) {
    .chatbot-bubble {
        width: 120px;
        height: 140px;
        right: 0px;
        bottom: 0px;
    }
    
    .chatbot-bubble::before {
        width: 45px;
        height: 15px;
        bottom: 5px;
    }

    .chatbot-window {
        width: calc(100% - 30px);
        right: 15px;
        left: 15px;
        bottom: 120px;
        max-height: 65vh;
    }
}