/* ==========================================================================
   BHUTAN TRAVEL AI CHATBOT STYLES
   File Path: assets/clients/css/chatbot.css
   ========================================================================== */

/* ==========================================
   CRITICAL FIX: Chatbot Takes NO Space
   ========================================== */

#bhutan-chatbot-container,
.bhutan-chat-widget {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    left: auto !important;
    top: auto !important;
    z-index: 999999 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    overflow: visible !important;
    background: transparent !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

#bhutan-chatbot-container .chatbot-toggle,
#bhutan-chatbot-container #chatbotWindow,
#bhutan-chatbot-container .bhutan-chat-widget {
    pointer-events: auto !important;
}

:root {
    --bhutan-chat-primary: #024731;
    --bhutan-chat-accent: #831835;
    --bhutan-chat-status: #8bd2af;
    --bhutan-chat-bg-light: #f8fafc;
    --bhutan-chat-border: #e2e8f0;
    --bhutan-chat-border-dark: #cbd5e1;
    --bhutan-chat-bot-bubble: #e2e8f0;
    --bhutan-chat-text-dark: #0f172a;
    --bhutan-chat-text-muted: #64748b;
    --bhutan-chat-z-index: 999999;
}

#bhutan-chatbot-container,
#bhutan-chatbot-container * {
    box-sizing: border-box;
}

/* ==========================================
   FLOATING LAUNCHER BUTTON
   ========================================== */
.chatbot-toggle {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50%;
    background-color: var(--bhutan-chat-primary);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    z-index: var(--bhutan-chat-z-index) !important;
    font-size: 22px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s ease;
    animation: chatbot-launcher-pulse 2.5s infinite;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto !important;
}

.chatbot-toggle:hover {
    transform: scale(1.05);
}

.chatbot-toggle:focus-visible {
    outline: 3px solid var(--bhutan-chat-accent);
    outline-offset: 2px;
}

@keyframes chatbot-launcher-pulse {
    0% { box-shadow: 0 0 0 0 rgba(2, 71, 49, 0.5), 0 4px 16px rgba(0, 0, 0, 0.25); }
    70% { box-shadow: 0 0 0 14px rgba(2, 71, 49, 0), 0 4px 16px rgba(0, 0, 0, 0.25); }
    100% { box-shadow: 0 0 0 0 rgba(2, 71, 49, 0), 0 4px 16px rgba(0, 0, 0, 0.25); }
}

.chatbot-toggle .close-icon { display: none; }
.chatbot-toggle.active .chat-icon { display: none; }
.chatbot-toggle.active .close-icon { display: inline; }

/* ==========================================
   CHATBOT WINDOW
   ========================================== */
#bhutan-chatbot-container #chatbotWindow,
#chatbotWindow {
    position: fixed !important;
    bottom: 90px !important;
    right: 24px !important;
    width: 380px !important;
    max-width: calc(100vw - 32px);
    height: 520px !important;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    z-index: calc(var(--bhutan-chat-z-index) + 1) !important;
    pointer-events: auto !important;
    
    /* Hidden state */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(20px) scale(0.92);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), visibility 0.25s ease;
}

#bhutan-chatbot-container #chatbotWindow.open,
#bhutan-chatbot-container #chatbotWindow.is-active,
#chatbotWindow.open,
#chatbotWindow.is-active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translateY(0) scale(1) !important;
}

/* ==========================================
   HEADER
   ========================================== */
.chatbot-header {
    background-color: var(--bhutan-chat-primary);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

.assistant-avatar { 
    font-size: 20px; 
}

.status-online { 
    display: block; 
    font-size: 11px; 
    color: var(--bhutan-chat-status); 
}

.btn-chat-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: opacity 0.2s ease;
}

.btn-chat-close:hover {
    opacity: 0.8;
}

.btn-chat-close:focus-visible {
    outline: 2px solid #ffffff;
}

/* ==========================================
   MESSAGES CONTAINER
   ========================================== */
.chatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: var(--bhutan-chat-bg-light);
    overscroll-behavior: contain;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
}

/* ==========================================
   MESSAGE BUBBLES
   ========================================== */
.message {
    max-width: 90%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    flex-shrink: 0;
}

.bot-message { 
    background-color: var(--bhutan-chat-bot-bubble); 
    color: var(--bhutan-chat-text-dark); 
    align-self: flex-start; 
    border-bottom-left-radius: 2px; 
}

.bot-message strong {
    color: var(--bhutan-chat-text-dark);
    font-weight: 600;
}

.bot-message ul, 
.bot-message ol {
    margin: 4px 0 6px 0 !important;
    padding-left: 18px !important;
}

.bot-message li {
    margin-bottom: 2px !important;
    line-height: 1.35 !important;
}

.bot-message p {
    margin: 0 0 4px 0 !important;
    line-height: 1.35 !important;
}

.bot-message br {
    display: inline !important;
    content: normal !important;
}

.bot-message br + br {
    display: none !important;
}

.user-message { 
    background-color: var(--bhutan-chat-primary); 
    color: #ffffff; 
    align-self: flex-end; 
    border-bottom-right-radius: 2px; 
}

/* ==========================================
   TYPING INDICATOR
   ========================================== */
.typing-dots { 
    display: inline-flex; 
    align-items: center; 
    gap: 4px; 
}

.typing-dots span {
    width: 6px; 
    height: 6px; 
    background-color: var(--bhutan-chat-text-muted); 
    border-radius: 50%;
    animation: typingBlink 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBlink { 
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); } 
    40% { opacity: 1; transform: scale(1.1); } 
}

/* ==========================================
   QUICK SUGGESTIONS
   ========================================== */
.chatbot-suggestions {
    display: flex; 
    gap: 6px; 
    padding: 8px 12px; 
    background: #ffffff;
    overflow-x: auto; 
    border-top: 1px solid var(--bhutan-chat-border); 
    flex-shrink: 0;
    scrollbar-width: none;
}

.chatbot-suggestions::-webkit-scrollbar {
    display: none;
}

.chip-btn {
    background: var(--bhutan-chat-bg-light); 
    border: 1px solid var(--bhutan-chat-border-dark); 
    border-radius: 20px;
    padding: 4px 10px; 
    font-size: 11px; 
    white-space: nowrap; 
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.chip-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.chip-btn:focus-visible {
    outline: 2px solid var(--bhutan-chat-primary);
}

/* ==========================================
   INPUT FORM
   ========================================== */
.chatbot-input-container {
    display: flex; 
    padding: 10px 12px; 
    background: #ffffff;
    border-top: 1px solid var(--bhutan-chat-border); 
    gap: 8px; 
    align-items: center; 
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

.chatbot-input-container input {
    flex: 1; 
    border: 1px solid var(--bhutan-chat-border-dark); 
    border-radius: 20px;
    padding: 8px 14px; 
    font-size: 13px; 
    outline: none;
    transition: border-color 0.2s ease;
}

.chatbot-input-container input:focus { 
    border-color: var(--bhutan-chat-primary); 
}

.btn-chat-send {
    background-color: var(--bhutan-chat-accent); 
    color: #ffffff; 
    border: none;
    border-radius: 50%; 
    width: 34px; 
    height: 34px; 
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    flex-shrink: 0;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.btn-chat-send:hover {
    transform: scale(1.05);
}

.btn-chat-send:focus-visible {
    outline: 2px solid var(--bhutan-chat-accent);
    outline-offset: 2px;
}

/* ==========================================
   CHATBOT DIVIDER
   ========================================== */
.chatbot-divider {
    margin: 8px 10px;
    border-top: 1px dashed #d1d5db;
    flex-shrink: 0;
}

/* ==========================================
   EMAIL CAPTURE - ULTRA COMPACT (70% smaller width)
   ========================================== */

.chatbot-email-capture {
    padding: 3px 6px !important;
    margin: 2px 4px 3px 4px !important;
    background: #f0fdf4;
    border: 2px solid #22c55e;
    border-radius: 4px !important;
    flex-shrink: 0;
    align-self: stretch;
    animation: slideUp 0.2s ease;
    max-width: 100% !important;
}

.email-capture-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.email-capture-icon {
    font-size: 11px !important;
    margin-bottom: 0 !important;
    display: inline-block;
    margin-right: 2px;
}

.email-capture-content h4 {
    margin: 0 !important;
    font-size: 9px !important;
    color: #0f172a;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.email-capture-content p {
    margin: 0 !important;
    font-size: 7px !important;
    color: #64748b;
    line-height: 1;
    white-space: nowrap;
}

.email-capture-form {
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 100%;
}

.email-input-group {
    display: flex;
    gap: 2px;
    width: 100%;
}

.email-input-group input[type="email"] {
    flex: 1;
    padding: 1px 4px !important;
    border: 1px solid #cbd5e1;
    border-radius: 2px !important;
    font-size: 8px !important;
    outline: none;
    min-height: 14px !important;
    height: 14px !important;
    width: 60% !important;
    min-width: 40px !important;
}

.email-input-group input[type="email"]:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.1);
}

.btn-email-send {
    padding: 1px 4px !important;
    background: #22c55e;
    color: #ffffff;
    border: none;
    border-radius: 2px !important;
    font-size: 8px !important;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    min-height: 14px !important;
    height: 14px !important;
    width: auto !important;
    min-width: 30px !important;
    transition: background 0.2s, transform 0.1s;
}

.btn-email-send:hover {
    background: #16a34a;
}

.btn-email-send:active {
    transform: scale(0.95);
}

#email-capture-message {
    font-size: 6px !important;
    font-weight: 500;
    min-height: 10px;
    margin-top: 1px;
    line-height: 1;
}

#email-capture-message .error {
    color: #ef4444;
}

#email-capture-message .success {
    color: #22c55e;
}

#email-capture-message .loading {
    color: #f59e0b;
}

.email-privacy-note {
    font-size: 6px !important;
    color: #94a3b8 !important;
    margin-top: 1px !important;
    margin-bottom: 0 !important;
    line-height: 1;
    white-space: nowrap;
}

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

/* ==========================================
   MOBILE RESPONSIVENESS
   ========================================== */
@media (max-width: 480px) {
    #bhutan-chatbot-container #chatbotWindow, 
    #chatbotWindow {
        right: 16px !important; 
        left: 16px !important; 
        bottom: 80px !important;
        width: auto !important; 
        max-width: none !important;
        height: 480px;
    }

    .email-input-group {
        flex-direction: column;
    }

    .btn-email-send {
        width: 100%;
    }

    .chatbot-messages {
        padding: 12px;
    }

    .message {
        max-width: 95%;
        font-size: 12px;
        padding: 8px 12px;
    }

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

    .chatbot-header {
        padding: 10px 14px;
    }

    .assistant-avatar {
        font-size: 16px;
    }

    .chatbot-input-container {
        padding: 8px 10px;
    }

    .chatbot-input-container input {
        font-size: 12px;
        padding: 6px 12px;
    }

    .btn-chat-send {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .chatbot-email-capture {
        padding: 2px 4px !important;
        margin: 1px 3px 2px 3px !important;
    }

    .email-capture-content h4 {
        font-size: 8px !important;
    }

    .email-capture-content p {
        font-size: 6px !important;
    }

    .email-input-group input[type="email"] {
        font-size: 7px !important;
        padding: 1px 3px !important;
        min-height: 12px !important;
        height: 12px !important;
        width: 50% !important;
        min-width: 30px !important;
    }

    .btn-email-send {
        font-size: 7px !important;
        padding: 1px 4px !important;
        min-height: 12px !important;
        height: 12px !important;
        min-width: 20px !important;
    }

    .chip-btn {
        font-size: 10px;
        padding: 3px 8px;
    }
}

@media (max-width: 380px) {
    #bhutan-chatbot-container #chatbotWindow, 
    #chatbotWindow {
        height: 400px;
        bottom: 70px !important;
    }

    .chatbot-messages {
        padding: 10px;
    }

    .message {
        font-size: 11px;
        padding: 6px 10px;
    }
}