.chatbot-bubble {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent-2, #6366F1);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(99,102,241,0.35);
    z-index: 9000;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chatbot-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(99,102,241,0.45);
}

.chatbot-bubble svg {
    width: 24px;
    height: 24px;
}

.chatbot-bubble .cb-icon-close {
    display: none;
}

.chatbot-bubble.cb-open .cb-icon-chat {
    display: none;
}

.chatbot-bubble.cb-open .cb-icon-close {
    display: block;
}

.chatbot-window {
    position: fixed;
    bottom: 5.5rem;
    right: 1.5rem;
    width: 360px;
    max-height: 480px;
    background: var(--bg-card, #131726);
    border: 1px solid var(--border, #1E293B);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    z-index: 8999;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.96);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    overflow: hidden;
}

.chatbot-window.cb-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chatbot-header {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border, #1E293B);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.chatbot-header-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green, #34D399);
    flex-shrink: 0;
}

.chatbot-header-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text, #E2E8F0);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 200px;
    max-height: 340px;
}

.chatbot-msg {
    max-width: 85%;
    padding: 0.6rem 0.85rem;
    border-radius: 12px;
    font-size: 0.82rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-msg-bot {
    background: var(--bg-input, #1a1f33);
    color: var(--text, #E2E8F0);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chatbot-msg-bot a {
    color: var(--accent, #818CF8);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chatbot-msg-bot a:hover {
    color: var(--green, #34D399);
}

.chatbot-msg-user {
    background: var(--accent-2, #6366F1);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chatbot-msg-typing {
    align-self: flex-start;
    background: var(--bg-input, #1a1f33);
    padding: 0.7rem 1rem;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.chatbot-msg-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted, #64748B);
    animation: cb-bounce 1.2s infinite;
}

.chatbot-msg-typing span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-msg-typing span:nth-child(3) { animation-delay: 0.3s; }

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

.chatbot-input-wrap {
    padding: 0.65rem 0.75rem;
    border-top: 1px solid var(--border, #1E293B);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    background: var(--bg-input, #1a1f33);
    border: 1px solid var(--border, #1E293B);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    color: var(--text, #E2E8F0);
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.chatbot-input:focus {
    border-color: var(--accent, #818CF8);
}

.chatbot-input::placeholder {
    color: var(--text-muted, #64748B);
}

.chatbot-send {
    background: var(--accent-2, #6366F1);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.chatbot-send:hover {
    background: var(--accent, #818CF8);
}

.chatbot-send:disabled {
    opacity: 0.4;
    cursor: default;
}

.chatbot-send svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 480px) {
    .chatbot-window {
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
        bottom: 5rem;
        max-height: 70vh;
    }

    .chatbot-bubble {
        bottom: 1rem;
        right: 1rem;
    }
}

[data-theme="light"] .chatbot-bubble {
    box-shadow: 0 4px 16px rgba(99,102,241,0.25);
}

[data-theme="light"] .chatbot-window {
    background: #fff;
    border-color: #e2e8f0;
    box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}

[data-theme="light"] .chatbot-header {
    border-color: #e2e8f0;
}

[data-theme="light"] .chatbot-msg-bot {
    background: #f1f5f9;
    color: #1e293b;
}

[data-theme="light"] .chatbot-msg-bot a {
    color: #4f46e5;
}

[data-theme="light"] .chatbot-msg-bot a:hover {
    color: #059669;
}

[data-theme="light"] .chatbot-input {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #1e293b;
}

[data-theme="light"] .chatbot-input-wrap {
    border-color: #e2e8f0;
}

[data-theme="light"] .chatbot-msg-typing span {
    background: #94a3b8;
}
