/* ═══════════════════════════════════════════════
   AI CHATBOT PLUGIN STYLESHEET (chatbot.css)
   ═══════════════════════════════════════════════ */

/* Font Import for Standalone Use */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&family=Outfit:wght@300;400;500;600;700&display=swap');

/* Chat Widget Base Reset scoped strictly to the launcher and window */
.chat-launcher, .chat-window {
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
}
.chat-launcher *, .chat-launcher *::before, .chat-launcher *::after,
.chat-window *, .chat-window *::before, .chat-window *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Floating Action Button Launcher */
.chat-launcher {
    position: fixed;
    bottom: 1.75rem;
    right: 1.75rem;
    z-index: 9999;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px rgba(124, 58, 237, .45);
    transition: transform .2s, box-shadow .2s;
}
.chat-launcher:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 40px rgba(124, 58, 237, .55);
}
.launcher-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}
.launcher-icon svg {
    width: 24px;
    height: 24px;
}
.launcher-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    transition: opacity .2s, transform .2s;
}
.launcher-badge.hidden {
    opacity: 0;
    transform: scale(0);
}

/* Chat Main Dialog Box Window */
.chat-window {
    position: fixed;
    bottom: 5.5rem;
    right: 1.75rem;
    z-index: 9998;
    width: 380px;
    height: 640px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 24px 80px rgba(0,0,0,.18), 0 4px 20px rgba(0,0,0,.08);
    transform: translateY(24px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform .28s cubic-bezier(.34, 1.56, .64, 1), opacity .22s ease;
}
.chat-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Header UI Elements */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1.1rem;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    flex-shrink: 0;
}
.chat-header-left {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.bot-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}
.bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, .35);
}
.online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #34d399;
    border: 2px solid #4f46e5;
}
.bot-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: .95rem;
    color: #fff;
}
.bot-status {
    font-size: .7rem;
    color: rgba(255, 255, 255, .65);
    margin-top: 1px;
}
.header-btn {
    background: rgba(255, 255, 255, .15);
    border: none;
    color: #fff;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .18s;
}
.header-btn:hover {
    background: rgba(255, 255, 255, .28);
}
.header-btn svg {
    width: 16px;
    height: 16px;
}

/* Messages Scroller Window */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    scroll-behavior: smooth;
    background: #fafafa;
}
.chat-messages::-webkit-scrollbar {
    width: 4px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 4px;
}

/* Timeline/Date UI Splitting Dividers */
.date-divider {
    text-align: center;
    font-size: .68rem;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: .25rem 0;
}
.date-divider::before, .date-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e8e8e8;
}

/* Message Rows & Speech Balloons Layouts */
.message-row {
    display: flex;
    align-items: flex-end;
    gap: .5rem;
}
.message-row.user {
    flex-direction: row-reverse;
}
.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 700;
}
.message-row.bot .msg-avatar {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
}
.message-row.user .msg-avatar {
    background: #e5e7eb;
    color: #6b7280;
}
.message-bubble {
    max-width: 80%;
    padding: .65rem .85rem;
    border-radius: 16px;
    font-size: .84rem;
    line-height: 1.6;
    position: relative;
    word-break: break-word;
}
.message-row.bot .message-bubble {
    background: #fff;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 6px rgba(0,0,0,.07);
    border: 1px solid #f0f0f0;
}
.message-row.user .message-bubble {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.msg-time {
    display: block;
    font-size: .62rem;
    opacity: .5;
    margin-top: .35rem;
    text-align: right;
}

/* Typing Thinking Placeholder Animation */
.typing-bubble {
    background: #fff;
    border: 1px solid #f0f0f0;
    box-shadow: 0 1px 6px rgba(0,0,0,.07);
    padding: .75rem 1rem;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 52px;
}
.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #bbb;
    animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); background: #7c3aed; }
}

/* Quick Replies Horizontally Scrolling Triggers Container */
.quick-replies {
    display: flex;
    gap: .5rem;
    padding: .6rem .85rem;
    overflow-x: auto;
    flex-shrink: 0;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
}
.quick-replies::-webkit-scrollbar {
    height: 0;
    display: none;
}
.qr-btn {
    flex-shrink: 0;
    padding: .4rem .8rem;
    border-radius: 20px;
    border: 1.5px solid #e0d5ff;
    background: #faf7ff;
    color: #6d28d9;
    font-size: .76rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .18s;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}
.qr-btn:hover {
    background: #ede9fe;
    border-color: #7c3aed;
}

/* Footer Controls Input Console Container */
.chat-input-bar {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.chat-input {
    flex: 1;
    border: 1.5px solid #ebebeb;
    border-radius: 22px;
    padding: .55rem 1rem;
    font-size: .85rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    background: #fafafa;
    color: #1a1a1a;
    transition: border-color .18s;
}
.chat-input:focus {
    border-color: #7c3aed;
    background: #fff;
}
.chat-input:disabled {
    opacity: .55;
    cursor: not-allowed;
}
.send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform .15s;
}
.send-btn:hover { transform: scale(1.08); }
.send-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.send-btn svg { width: 16px; height: 16px; }

.chat-footer-note {
    text-align: center;
    font-size: .67rem;
    color: #bbb;
    padding: .4rem;
    background: #fff;
    flex-shrink: 0;
}
.chat-footer-note strong { color: #9a75ff; }

/* Business Struct Metadata Card Renderer Formatting Markup Blocks */
.card-label {
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #7c3aed;
    background: #f0ebff;
    padding: 2px 8px;
    border-radius: 20px;
    margin-bottom: .5rem;
}
.card-item {
    display: block;
    background: #f8f7ff;
    border-left: 3px solid #c4b5fd;
    border-radius: 0 8px 8px 0;
    padding: .45rem .65rem;
    margin: .3rem 0;
    font-size: .82rem;
    line-height: 1.5;
}
.card-row {
    margin: .2rem 0;
    font-size: .83rem;
}

/* Responsiveness adjustments for smaller handheld displays breakpoints */
@media(max-width: 420px) {
    .chat-window {
        right: .75rem;
        left: .75rem;
        width: auto;
        bottom: 5rem;
        height: calc(100vh - 100px);
    }
    .chat-launcher {
        right: .75rem;
        bottom: .75rem;
    }
}