/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    --chat-border-radius: 0.75rem;
    --chat-window-width: 400px;
    --chat-window-height: 600px;
    --quick-question-bg: color-mix(
        in srgb,
        var(--primary-color) 90%,
        transparent
    );
    --quick-question-color: var(--bg-color);
    --chat-user-msg-bg: var(--primary-color-opacity);
    --chat-user-msg-text: var(--primary-color);
    --chat-assistant-msg-bg: var(--primary-color-opacity);
    --chat-assistant-msg-text: var(--primary-color);
    --chat-msg-radius: 1rem;
    --chat-toggle-bg-color: var(--primary-color);
    --chat-send-icon-color: var(--primary-color);
}

/* ============================================
   TOGGLE BUTTON (Botón flotante)
   ============================================ */
.chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: var(--bg-color);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
    z-index: 9998;
}

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

/* ============================================
   CHAT WINDOW (Ventana del chat)
   ============================================ */
.chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: var(--chat-window-width);
    max-width: 95vw;
    height: var(--chat-window-height);
    max-height: 85vh;
    background: var(--bg-color);
    border-radius: var(--chat-border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    border: 2px solid rgba(201, 171, 129, 0.2);
    font-family: var(--font);
}

/* ============================================
   HEADER
   ============================================ */
.chatbot-header {
    padding: 20px;
    background-color: var(--bg-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--chat-border-radius) var(--chat-border-radius) 0 0;
}

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

.chatbot-header-icon {
    padding: 3px;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    color: var(--bg-color);
    background-color: var(--primary-color);
}

.chatbot-header .chatbot-header-title {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.chatbot-close {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

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

/* ============================================
   MESSAGES CONTAINER
   ============================================ */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: var(--bg-color);
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ============================================
   MESSAGE BUBBLES
   ============================================ */
.chatbot-message {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    align-items: flex-end;
}

.bot-message {
    align-items: flex-start;
}

.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: var(--chat-msg-radius);
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
}

.user-message .message-bubble {
    background-color: var(--primary-color);
    color: var(--bg-color);
    border-bottom-right-radius: 4px;
}

.bot-message .message-bubble {
    background-color: var(--chat-assistant-msg-bg);
    color: var(--chat-assistant-msg-text);
    border-bottom-left-radius: 4px;
}

/* ============================================
   RECOMMENDED ITEMS
   ============================================ */
.recommended-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
    width: 100%;
}

.chatbot-dish-wrapper,
.chatbot-beer-wrapper,
.chatbot-wine-wrapper,
.chatbot-cocktail-wrapper,
.chatbot-combined-wrapper {
    width: 100%;
    max-width: 280px;
}

/* ============================================
   QUICK QUESTIONS
   ============================================ */
.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 12px 20px;
    background-color: var(--bg-color);
}

.quick-question-btn {
    padding: 8px 16px;
    background-color: var(--quick-question-bg);
    color: var(--quick-question-color);
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-question-btn:hover {
    opacity: 80%;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================
   INPUT CONTAINER
   ============================================ */
.chatbot-input-container {
    position: relative;
    padding: 16px;
    background: var(--bg-color);
}

.chatbot-input {
    width: 100%;
    padding: 12px 50px 12px 16px;
    border: 1.5px solid var(--primary-color);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: var(--bg-color);
    color: var(--primary-color);
}

.chatbot-input:focus {
    border-color: var(--primary-color);
    font-weight: 600;
}

.chatbot-input::placeholder {
    color: var(--primary-color);
}

.chatbot-send-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.chatbot-send-btn:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: var(--bg-color);
    transform: translateY(-50%) scale(1.05);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-send-btn .chat-send-icon {
    color: var(--bg-color);
    width: 18px;
    height: 18px;
}

/* ============================================
   LOADING INDICATOR
   ============================================ */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background-color: var(--chat-assistant-msg-bg);
    border-radius: var(--chat-msg-radius);
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #9ca3af;
    animation: typingAnimation 1.4s infinite;
}

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

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

@keyframes typingAnimation {
    0%,
    60%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
.chat-slide-enter-active,
.chat-slide-leave-active {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-slide-enter-from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
}

.chat-slide-leave-to {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .chatbot-toggle {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }

    .chatbot-header {
        border-radius: 0;
    }

    .message-bubble {
        max-width: 85%;
    }
}

/* ============================================
   DISH COMPONENT IN CHATBOT
   ============================================ */
.chatbot-dish-wrapper .dish {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

.chatbot-dish-wrapper .dish > div {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.chatbot-dish-wrapper .dish-image-container {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
}

.chatbot-dish-wrapper .dish-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbot-dish-wrapper .dish-info-container {
    flex: 1;
    min-width: 0;
}

.chatbot-dish-wrapper .dish-title {
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
}

.chatbot-dish-wrapper .dish-subtitle {
    font-family: var(--font);
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-top: 0 !important;
    margin-bottom: 8px !important;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-dish-wrapper .allergens-menu {
    margin-left: -4px;
    font-size: 1.4rem;
}

.chatbot-dish-wrapper .menu .allergens-menu {
    margin-left: 0;
    justify-content: center;
}

.chatbot-dish-wrapper .dish-footer {
    margin-top: auto;
}

.chatbot-dish-wrapper .dish-prices {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.chatbot-dish-wrapper .dish-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chatbot-dish-wrapper .dish-price-type {
    display: block;
    font-family: var(--font);
    font-size: 0.6rem;
}

.chatbot-dish-wrapper .dish-price-import {
    display: flex;
    gap: 2px;
    align-items: baseline;
}

.chatbot-dish-wrapper .dish-price-import small {
    font-size: 14px !important;
    font-weight: 700;
    color: var(--primary-color);
}

.chatbot-dish-wrapper .not-available small {
    font-size: 11px !important;
    color: #ef4444;
    font-weight: 600;
}

/* Ocultar el botón de modal en el chatbot */
.chatbot-dish-wrapper .modal-dish-trigger {
    display: none !important;
}

/* Footer para menús */
.chatbot-dish-wrapper .dish-footer-menu {
    margin-top: 8px;
}

.chatbot-dish-wrapper .extra-price small {
    font-size: 11px !important;
    color: #6b7280;
}

/* Animación de fade-in para items */
.recommended-items > div {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
