/* ═══════════════════════════════════════
   GROUPSMIX AI CHATBOT — Widget Styles
   ═══════════════════════════════════════ */

/* ── Floating Action Button (removed — chatbot now opens from bottom nav) ── */
.chatbot-fab {
    display: none !important;
}

/* ── Chat Window ─────────────────────── */
.chatbot-window {
    position: fixed;
    bottom: 70px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: var(--bg-primary, #0f0f17);
    border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(99, 102, 241, 0.1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ── Header ──────────────────────────── */
.chatbot-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-card, #16161f);
    border-bottom: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
    flex-shrink: 0;
}

.chatbot-header__avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--gradient-accent, linear-gradient(135deg, #6366f1, #8b5cf6));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-header__avatar svg {
    width: 20px;
    height: 20px;
    color: #fff;
}

.chatbot-header__info {
    flex: 1;
    min-width: 0;
}

.chatbot-header__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #f0f0f5);
    line-height: 1.2;
}

.chatbot-header__status {
    font-size: 11px;
    color: var(--text-tertiary, #6b7280);
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-header__status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
}

.chatbot-header__close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-tertiary, #6b7280);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-header__close:hover {
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.06));
    color: var(--text-primary, #f0f0f5);
}

.chatbot-header__close svg {
    width: 18px;
    height: 18px;
}

/* ── Messages Area ───────────────────── */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* ── Message Bubbles ─────────────────── */
.chatbot-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.55;
    word-wrap: break-word;
    animation: chatbot-msg-in 0.3s ease;
}

@keyframes chatbot-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chatbot-msg--bot {
    align-self: flex-start;
    background: var(--bg-card, #16161f);
    color: var(--text-primary, #f0f0f5);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.06));
}

.chatbot-msg--user {
    align-self: flex-end;
    background: var(--gradient-accent, linear-gradient(135deg, #6366f1, #8b5cf6));
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* ── Markdown inside bot messages ────── */
.chatbot-msg--bot p {
    margin: 0 0 8px 0;
}

.chatbot-msg--bot p:last-child {
    margin-bottom: 0;
}

.chatbot-msg--bot a {
    color: var(--accent-primary, #6366f1);
    text-decoration: underline;
    text-decoration-color: rgba(99, 102, 241, 0.4);
    transition: text-decoration-color 0.2s ease;
}

.chatbot-msg--bot a:hover {
    text-decoration-color: var(--accent-primary, #6366f1);
}

.chatbot-msg--bot strong {
    font-weight: 600;
    color: var(--text-primary, #f0f0f5);
}

.chatbot-msg--bot ul, .chatbot-msg--bot ol {
    margin: 6px 0;
    padding-left: 18px;
}

.chatbot-msg--bot li {
    margin-bottom: 4px;
}

.chatbot-msg--bot code {
    background: rgba(99, 102, 241, 0.1);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
}

/* ── Typing Indicator ────────────────── */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
}

.chatbot-typing__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-tertiary, #6b7280);
    animation: chatbot-typing-bounce 1.4s infinite;
}

.chatbot-typing__dot:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing__dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatbot-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Quick Actions (Welcome) ─────────── */
.chatbot-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.chatbot-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.04));
    color: var(--text-secondary, #a1a1aa);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chatbot-quick-btn:hover {
    border-color: var(--accent-primary, #6366f1);
    color: var(--accent-primary, #6366f1);
    background: rgba(99, 102, 241, 0.08);
}

/* ── Input Area ──────────────────────── */
.chatbot-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
    background: var(--bg-card, #16161f);
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    min-height: 38px;
    max-height: 100px;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
    background: var(--bg-primary, #0f0f17);
    color: var(--text-primary, #f0f0f5);
    font-size: 13.5px;
    line-height: 1.4;
    resize: none;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.chatbot-input::placeholder {
    color: var(--text-tertiary, #6b7280);
}

.chatbot-input:focus {
    border-color: var(--accent-primary, #6366f1);
}

.chatbot-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--gradient-accent, linear-gradient(135deg, #6366f1, #8b5cf6));
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    opacity: 0.5;
    pointer-events: none;
}

.chatbot-send-btn--active {
    opacity: 1;
    pointer-events: auto;
}

.chatbot-send-btn--active:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

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

/* ── Powered By Footer ───────────────── */
.chatbot-footer {
    text-align: center;
    padding: 6px;
    font-size: 10px;
    color: var(--text-tertiary, #6b7280);
    background: var(--bg-card, #16161f);
    border-top: 1px solid var(--border-primary, rgba(255, 255, 255, 0.04));
    flex-shrink: 0;
}

/* ── Light Theme Overrides ───────────── */
[data-theme="light"] .chatbot-window {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(99, 102, 241, 0.08);
}

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

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

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

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

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

/* ── Mobile Responsive ───────────────── */
@media (max-width: 480px) {
    .chatbot-window {
        bottom: 60px;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: calc(100% - 60px);
        max-height: calc(100% - 60px);
        border-radius: 16px 16px 0 0;
    }
}
