/* =====================================================
   CHATBOT IA - WIDGET STYLES
   ===================================================== */

/* Contenedor del botón de chat */
.chatbot-trigger {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
}

.chatbot-trigger-btn {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chatbot-trigger-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(59, 130, 246, 0.5);
}

.chatbot-trigger-btn i {
    color: white;
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.chatbot-trigger-btn.open i {
    transform: rotate(180deg);
}

/* Animación de pulso */
.chatbot-trigger-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.5);
    animation: chatPulse 2s infinite;
}

@keyframes chatPulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.3);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* Tooltip */
.chatbot-tooltip {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 1rem;
    background: #1e293b;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.chatbot-trigger:hover .chatbot-tooltip {
    opacity: 1;
}

.chatbot-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -0.5rem;
    transform: translateY(-50%);
    border: 0.5rem solid transparent;
    border-left-color: #1e293b;
}

/* Ventana del chat */
.chatbot-window {
    position: fixed;
    bottom: 6rem;
    right: 1.5rem;
    width: 380px;
    max-width: calc(100vw - 2rem);
    height: 500px;
    max-height: calc(100vh - 10rem);
    background: linear-gradient(to bottom, #0f172a, #1e293b);
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Header del chat */
.chatbot-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chatbot-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5b401 0%, #fbbf24 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-avatar i {
    color: #0f172a;
    font-size: 1.25rem;
}

.chatbot-header-text h3 {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.chatbot-header-text p {
    color: #34d399;
    font-size: 0.75rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.chatbot-header-text p::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    background: #34d399;
    border-radius: 50%;
    animation: statusPulse 1.5s infinite;
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.chatbot-close:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Área de mensajes */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Mensajes */
.chatbot-message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    animation: messageIn 0.3s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message.bot {
    align-self: flex-start;
    background: rgba(59, 130, 246, 0.15);
    color: #e2e8f0;
    border-bottom-left-radius: 0.25rem;
}

.chatbot-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

/* Links en mensajes */
.chatbot-message a {
    color: #fbbf24;
    text-decoration: underline;
}

.chatbot-message a:hover {
    color: #f5b401;
}

/* PRODUCTOS EN EL CHAT (NUEVO) */
.chatbot-product-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-product-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.chatbot-product-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #0f172a;
}

/* Indicador de escritura */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 1rem;
    align-self: flex-start;
}

.chatbot-typing span {
    width: 0.5rem;
    height: 0.5rem;
    background: #60a5fa;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

.chatbot-typing span:nth-child(1) {
    animation-delay: 0s;
}

.chatbot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Área de input */
.chatbot-input-area {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 0.5rem;
}

.chatbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 0.75rem 1rem;
    color: white;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.chatbot-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chatbot-input:focus {
    border-color: #3b82f6;
}

.chatbot-send {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.chatbot-send:hover {
    transform: scale(1.1);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Sugerencias rápidas */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.2);
}

.chatbot-suggestion {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 1rem;
    padding: 0.375rem 0.75rem;
    color: #93c5fd;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chatbot-suggestion:hover {
    background: rgba(59, 130, 246, 0.3);
    color: white;
}

/* Responsive */
@media (max-width: 480px) {
    .chatbot-window {
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chatbot-trigger {
        bottom: 1rem;
        right: 1rem;
    }
}