/* TokiQR AI Assistant - Chatbot UI */

.chatbot-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1100;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #2563EB;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chatbot-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(37, 99, 235, 0.4);
}
.chatbot-fab svg { width: 24px; height: 24px; }
.chatbot-fab::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.4);
    animation: chatbot-pulse 2s ease-out 3;
    pointer-events: none;
}
@keyframes chatbot-pulse {
    0%   { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.chatbot-panel {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    z-index: 1101;
    width: 360px;
    height: 520px;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
}
.chatbot-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: #2563EB;
    color: #fff;
    flex-shrink: 0;
}
.chatbot-header-title {
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.chatbot-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0.2rem;
    opacity: 0.8;
    transition: opacity 0.2s;
    line-height: 1;
}
.chatbot-close:hover { opacity: 1; }
.chatbot-close svg { width: 18px; height: 18px; }

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: #F8FAFC;
}

.chatbot-msg {
    max-width: 85%;
    padding: 0.6rem 0.9rem;
    border-radius: 0.8rem;
    font-size: 0.84rem;
    line-height: 1.7;
    word-break: break-word;
}
.chatbot-msg a {
    color: #2563EB;
    text-decoration: none;
}
.chatbot-msg a:hover { text-decoration: underline; }
.chatbot-msg-user {
    align-self: flex-end;
    background: #2563EB;
    color: #fff;
    border-bottom-right-radius: 0.2rem;
}
.chatbot-msg-assistant {
    align-self: flex-start;
    background: #fff;
    color: #1E293B;
    border: 1px solid #E2E8F0;
    border-bottom-left-radius: 0.2rem;
}
.chatbot-msg-error {
    align-self: center;
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
    font-size: 0.78rem;
    text-align: center;
}

.chatbot-typing {
    align-self: flex-start;
    padding: 0.6rem 0.9rem;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 0.8rem;
    border-bottom-left-radius: 0.2rem;
    font-size: 0.84rem;
    color: #94A3B8;
}
.chatbot-typing-dots::after {
    content: '';
    animation: chatbot-dots 1.2s infinite;
}
@keyframes chatbot-dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
}

.chatbot-input-area {
    display: flex;
    align-items: flex-end;
    padding: 0.6rem;
    border-top: 1px solid #E2E8F0;
    background: #fff;
    flex-shrink: 0;
    gap: 0.4rem;
}
.chatbot-input {
    flex: 1;
    border: 1px solid #E2E8F0;
    border-radius: 0.6rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.84rem;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
}
.chatbot-input:focus { border-color: #2563EB; }
.chatbot-input::placeholder { color: #94A3B8; }
.chatbot-send {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    background: #2563EB;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.chatbot-send:hover { background: #1D4ED8; }
.chatbot-send:disabled { background: #94A3B8; cursor: not-allowed; }
.chatbot-send svg { width: 16px; height: 16px; }

/* Mobile */
@media (max-width: 600px) {
    .chatbot-panel {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }
    .chatbot-fab {
        bottom: 1rem;
        right: 1rem;
    }
}
