/**
 * Drip Latino - Chatbot Styles
 * Widget de chat flotante con diseño moderno
 */

/* ==========================================================================
   Variables CSS
   ========================================================================== */
:root {
    --chatbot-primary: #2d3436;
    --chatbot-primary-dark: #1e272e;
    --chatbot-accent: #00b894;
    --chatbot-accent-hover: #00a885;
    --chatbot-bg: rgba(255, 255, 255, 0.98);
    --chatbot-glass: rgba(255, 255, 255, 0.85);
    --chatbot-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --chatbot-radius: 20px;
    --chatbot-radius-sm: 12px;
}

/* ==========================================================================
   Botón Flotante
   ========================================================================== */
.chatbot-toggle {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-toggle-icon {
    font-size: 28px;
    transition: transform 0.3s ease;
}

.chatbot-toggle.active .chatbot-toggle-icon {
    transform: rotate(180deg);
}

/* Pulse animation */
.chatbot-toggle::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--chatbot-accent);
    opacity: 0;
    animation: chatbot-pulse 2s infinite;
}

@keyframes chatbot-pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ==========================================================================
   Ventana de Chat
   ========================================================================== */
.chatbot-window {
    position: fixed;
    bottom: 180px;
    right: 30px;
    width: 380px;
    height: 520px;
    background: var(--chatbot-bg);
    border-radius: var(--chatbot-radius);
    box-shadow: var(--chatbot-shadow);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--chatbot-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.chatbot-header-info {
    flex: 1;
}

.chatbot-header-title {
    font-weight: 700;
    font-size: 1rem;
    margin: 0;
}

.chatbot-header-status {
    font-size: 0.75rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-header-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
    animation: online-pulse 1.5s infinite;
}

@keyframes online-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.chatbot-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

/* ==========================================================================
   Área de Mensajes
   ========================================================================== */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Scrollbar personalizado */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Mensajes */
.chatbot-message {
    display: flex;
    gap: 10px;
    max-width: 90%;
    animation: message-in 0.3s ease;
}

@keyframes message-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

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

.chatbot-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chatbot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--chatbot-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.chatbot-message.user .chatbot-message-avatar {
    background: var(--chatbot-primary);
}

.chatbot-message-bubble {
    background: #e8eaed;
    padding: 12px 16px;
    border-radius: var(--chatbot-radius-sm);
    border-top-left-radius: 4px;
    line-height: 1.5;
    font-size: 0.9rem;
    color: #1a1a1a;
    font-weight: 500;
}

.chatbot-message.user .chatbot-message-bubble {
    background: var(--chatbot-primary);
    color: white;
    border-top-left-radius: var(--chatbot-radius-sm);
    border-top-right-radius: 4px;
}

/* ==========================================================================
   Opciones / Botones
   ========================================================================== */
.chatbot-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.chatbot-option-btn {
    background: white;
    border: 2px solid #e0e0e0;
    padding: 12px 16px;
    border-radius: var(--chatbot-radius-sm);
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-option-btn:hover {
    border-color: var(--chatbot-accent);
    background: rgba(0, 184, 148, 0.05);
    transform: translateX(5px);
}

.chatbot-option-btn:active {
    transform: translateX(5px) scale(0.98);
}

.chatbot-option-icon {
    font-size: 1.2rem;
}

/* ==========================================================================
   Input de Usuario
   ========================================================================== */
.chatbot-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #eee;
    display: none;
}

.chatbot-input-container.visible {
    display: flex;
    gap: 10px;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--chatbot-radius-sm);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: var(--chatbot-accent);
}

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

.chatbot-send-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--chatbot-accent);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.chatbot-send-btn:hover {
    background: var(--chatbot-accent-hover);
    transform: scale(1.05);
}

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

/* ==========================================================================
   Tarjetas de Pedido
   ========================================================================== */
.order-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: var(--chatbot-radius-sm);
    padding: 14px;
    margin-top: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.order-card:hover {
    border-color: var(--chatbot-accent);
    box-shadow: 0 4px 12px rgba(0, 184, 148, 0.15);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.order-card-number {
    font-weight: 700;
    color: var(--chatbot-primary);
}

.order-card-date {
    font-size: 0.75rem;
    color: #888;
}

.order-card-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.order-card-status.pendiente {
    background: #fff3cd;
    color: #856404;
}

.order-card-status.en-proceso,
.order-card-status.en_proceso {
    background: #cce5ff;
    color: #004085;
}

.order-card-status.listo {
    background: #d4edda;
    color: #155724;
}

.order-card-status.entregado {
    background: #e2e3e5;
    color: #383d41;
}

.order-card-products {
    font-size: 0.8rem;
    color: #666;
}

.order-card-total {
    text-align: right;
    font-weight: 700;
    font-size: 1rem;
    color: var(--chatbot-primary);
    margin-top: 8px;
}

/* ==========================================================================
   Indicador de Escritura
   ========================================================================== */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f0f2f5;
    border-radius: var(--chatbot-radius-sm);
    width: fit-content;
}

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

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

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

@keyframes typing-bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-6px);
    }
}

/* ==========================================================================
   FAQ Cards
   ========================================================================== */
.faq-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: var(--chatbot-radius-sm);
    padding: 12px;
    margin-top: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.faq-card:hover {
    border-color: var(--chatbot-accent);
    background: rgba(0, 184, 148, 0.03);
}

.faq-question {
    font-weight: 600;
    color: var(--chatbot-primary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.faq-question::before {
    content: '❓';
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 180px);
        right: 10px;
        bottom: 90px;
        border-radius: var(--chatbot-radius-sm);
    }

    .chatbot-toggle {
        right: 20px;
        bottom: 80px;
        width: 55px;
        height: 55px;
    }
}