/* ======================================
   AI ASSISTANT WIDGET - BotForge
   ====================================== */

#bf-assistant-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 24px;
}

#bf-assistant-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(124, 58, 237, 0.65);
}

#bf-assistant-btn .bf-btn-icon-open  { display: block; }
#bf-assistant-btn .bf-btn-icon-close { display: none; }
#bf-assistant-btn.open .bf-btn-icon-open  { display: none; }
#bf-assistant-btn.open .bf-btn-icon-close { display: block; }

/* Panel */
#bf-assistant-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 360px;
    max-height: 520px;
    background: #0f0f23;
    border: 1px solid rgba(124, 58, 237, 0.35);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    z-index: 8999;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    transform: translateY(12px) scale(0.97);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

#bf-assistant-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Header */
.bf-assistant-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.bf-assistant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.bf-assistant-title {
    flex: 1;
}

.bf-assistant-title strong {
    display: block;
    font-size: 14px;
    color: #fff;
    font-weight: 600;
}

.bf-assistant-title span {
    font-size: 11px;
    color: #a1a1aa;
}

.bf-assistant-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.bf-assistant-page-badge {
    font-size: 10px;
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.bf-clear-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #a1a1aa;
    cursor: pointer;
    font-size: 14px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.bf-clear-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Messages */
.bf-assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(124, 58, 237, 0.3) transparent;
}

.bf-assistant-messages::-webkit-scrollbar {
    width: 4px;
}
.bf-assistant-messages::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.4);
    border-radius: 4px;
}

.bf-msg {
    max-width: 85%;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.bf-msg-assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    color: #e4e4e7;
    border-bottom-left-radius: 4px;
}

.bf-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.bf-msg-typing {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    color: #a1a1aa;
    font-style: italic;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.bf-msg-error {
    align-self: flex-start;
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

/* Input */
.bf-assistant-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

#bf-assistant-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    padding: 8px 12px;
    outline: none;
    resize: none;
    max-height: 80px;
    min-height: 36px;
    font-family: inherit;
    line-height: 1.4;
    transition: border-color 0.15s;
}

#bf-assistant-input:focus {
    border-color: rgba(124, 58, 237, 0.6);
}

#bf-assistant-input::placeholder {
    color: #52525b;
}

#bf-assistant-send {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: flex-end;
    transition: opacity 0.15s;
    font-size: 15px;
}

#bf-assistant-send:disabled {
    opacity: 0.45;
    cursor: default;
}

#bf-assistant-send:not(:disabled):hover {
    opacity: 0.85;
}

/* Mobile */
@media (max-width: 480px) {
    #bf-assistant-panel {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 84px;
    }
    #bf-assistant-btn {
        right: 16px;
        bottom: 16px;
    }
}
