/* ==================== CHATBOT WIDGET ==================== */
.chatbot {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Toggle Button */
.chatbot__toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0ea5e9 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(14, 165, 233, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.chatbot__toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(14, 165, 233, 0.5);
}

.chatbot__toggle svg {
    width: 26px;
    height: 26px;
    transition: transform 0.3s;
}

.chatbot__toggle--open svg {
    transform: rotate(90deg);
}

.chatbot__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: chatPulse 2s infinite;
}

@keyframes chatPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Window */
.chatbot__window {
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(12px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
}

.chatbot__window--open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.chatbot__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #0ea5e9 0%, #8b5cf6 100%);
    color: #fff;
    flex-shrink: 0;
}

.chatbot__avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chatbot__header-info {
    flex: 1;
}

.chatbot__header-name {
    font-size: 14px;
    font-weight: 700;
}

.chatbot__header-status {
    font-size: 11px;
    opacity: 0.85;
}

.chatbot__close {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.chatbot__close:hover {
    background: rgba(255,255,255,0.25);
}

/* Messages */
.chatbot__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.chatbot__messages::-webkit-scrollbar { width: 4px; }
.chatbot__messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    animation: msgIn 0.2s ease-out;
}

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

.msg--user {
    align-self: flex-end;
    background: #0ea5e9;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg--bot {
    align-self: flex-start;
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

.msg--error {
    align-self: flex-start;
    background: #fef2f2;
    color: #dc2626;
    font-size: 13px;
}

/* Typing Indicator */
.chatbot__typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f1f5f9;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    animation: msgIn 0.2s ease-out;
}

.chatbot__typing-dots {
    display: flex;
    gap: 3px;
}

.chatbot__typing-dots span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: dotBounce 1.2s infinite;
}

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

@keyframes dotBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Input */
.chatbot__input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #f1f5f9;
    background: #fff;
    flex-shrink: 0;
}

.chatbot__input-field {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    background: #f8fafc;
    min-height: 42px;
}

.chatbot__input-field:focus {
    border-color: #0ea5e9;
    background: #fff;
}

.chatbot__input-field::placeholder {
    color: #94a3b8;
}

.chatbot__send {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0ea5e9;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.15s;
}

.chatbot__send:hover {
    background: #0284c7;
    transform: scale(1.05);
}

.chatbot__send:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

.chatbot__send svg {
    width: 18px;
    height: 18px;
}

/* Quick Replies */
.chatbot__quick {
    display: flex;
    gap: 6px;
    padding: 6px 12px 2px;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}

.chatbot__quick::-webkit-scrollbar { display: none; }

.chatbot__quick-btn {
    flex: 0 0 auto;
    padding: 6px 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 12px;
    font-family: inherit;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.chatbot__quick-btn:hover {
    background: #0ea5e9;
    color: #fff;
    border-color: #0ea5e9;
}

/* Mobile */
@media (max-width: 480px) {
    .chatbot { bottom: 16px; right: 16px; }

    .chatbot__window {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        max-height: none;
        bottom: 64px;
        right: -8px;
        border-radius: 14px;
    }

    .chatbot__toggle {
        width: 50px;
        height: 50px;
    }
}
