.chatbot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary, #2563eb);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37,99,235,0.4);
    z-index: 9998;
    transition: transform 0.2s, box-shadow 0.2s;
}
.chatbot-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(37,99,235,0.5);
}
.chatbot-fab.has-unread::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #dc2626;
    border-radius: 50%;
    border: 2px solid white;
}

.chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: var(--panel, white);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chatbot-window.open {
    display: flex;
    animation: chatbotSlideIn 0.2s ease;
}

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

.chatbot-header {
    padding: 14px 18px;
    background: var(--primary, #2563eb);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
}
.chatbot-header-info span:first-child {
    font-size: 1.2rem;
}
.chatbot-header-info span:last-child {
    font-weight: 700;
    font-size: 0.95rem;
}
.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}
.chatbot-close:hover {
    background: rgba(255,255,255,0.2);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.chatbot-msg.user {
    align-self: flex-end;
    background: var(--primary, #2563eb);
    color: white;
    border-bottom-right-radius: 4px;
}
.chatbot-msg.assistant {
    align-self: flex-start;
    background: #f1f5f9;
    color: var(--text, #0f172a);
    border-bottom-left-radius: 4px;
}
[data-theme="dark"] .chatbot-msg.assistant {
    background: #334155;
}

.chatbot-typing {
    align-self: flex-start;
    padding: 10px 14px;
    background: #f1f5f9;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    color: var(--muted, #64748b);
    font-size: 0.85rem;
    font-style: italic;
}
[data-theme="dark"] .chatbot-typing {
    background: #334155;
}

.chatbot-input-area {
    padding: 12px;
    border-top: 1px solid var(--border, #e2e8f0);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.chatbot-input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    font-size: 0.9rem;
    background: var(--panel, white);
    color: var(--text, #0f172a);
}
.chatbot-input-area input:focus {
    outline: none;
    border-color: var(--primary, #2563eb);
}
.chatbot-send {
    padding: 10px 16px;
    background: var(--primary, #2563eb);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.chatbot-send:hover {
    background: var(--primary-dark, #1d4ed8);
}
.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-footer {
    padding: 6px 12px;
    text-align: center;
    font-size: 0.7rem;
    color: var(--muted, #64748b);
    background: var(--bg, #f8fafc);
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    .chatbot-fab {
        bottom: 16px;
        right: 16px;
    }
}
