/* AI Chatbot Pro - Frontend Styles */

:root {
    --acp-primary: #6366f1;
    --acp-primary-dark: #4f46e5;
    --acp-white: #ffffff;
    --acp-gray-50: #f8fafc;
    --acp-gray-100: #f1f5f9;
    --acp-gray-200: #e2e8f0;
    --acp-gray-400: #94a3b8;
    --acp-gray-600: #475569;
    --acp-gray-800: #1e293b;
    --acp-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 4px 20px rgba(0,0,0,0.1);
    --acp-radius: 20px;
    --acp-radius-sm: 12px;
    --acp-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Wrapper */
#acp-chatbot-wrapper {
    position: fixed;
    bottom: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
#acp-chatbot-wrapper.acp-right { right: 24px; }
#acp-chatbot-wrapper.acp-left  { left: 24px; }

/* Toggle Button */
#acp-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--acp-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(99,102,241,0.4);
    transition: var(--acp-transition);
    color: #fff;
    margin-left: auto;
}
#acp-toggle-btn:hover {
    background: var(--acp-primary-dark);
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(99,102,241,0.5);
}
#acp-toggle-btn svg {
    width: 26px;
    height: 26px;
}

/* Pulse animation on toggle */
#acp-toggle-btn::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--acp-primary);
    opacity: 0.4;
    animation: acp-pulse 2s infinite;
}
@keyframes acp-pulse {
    0%   { transform: scale(1); opacity: 0.4; }
    70%  { transform: scale(1.4); opacity: 0; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* Chat Window */
#acp-chat-window {
    position: absolute;
    bottom: 80px;
    width: 360px;
    max-height: 520px;
    background: var(--acp-white);
    border-radius: var(--acp-radius);
    box-shadow: var(--acp-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--acp-gray-200);
    animation: acp-slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#acp-chatbot-wrapper.acp-right #acp-chat-window { right: 0; }
#acp-chatbot-wrapper.acp-left  #acp-chat-window { left: 0; }

@keyframes acp-slideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

#acp-chat-window.acp-open {
    display: flex;
}

/* Header */
#acp-chat-header {
    background: var(--acp-primary);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.acp-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.acp-header-name {
    font-weight: 600;
    font-size: 15px;
}
.acp-header-status {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 2px;
    color: #a5f3fc;
}
#acp-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #fff;
    margin-left: auto;
    padding: 4px;
    display: flex;
    opacity: 0.8;
    transition: opacity 0.2s;
}
#acp-close-btn:hover { opacity: 1; }
#acp-close-btn svg { width: 18px; height: 18px; }

/* Messages */
#acp-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--acp-gray-50);
    scroll-behavior: smooth;
}
#acp-messages::-webkit-scrollbar { width: 4px; }
#acp-messages::-webkit-scrollbar-track { background: transparent; }
#acp-messages::-webkit-scrollbar-thumb { background: var(--acp-gray-200); border-radius: 4px; }

.acp-message {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    animation: acp-fadeIn 0.25s ease;
}
@keyframes acp-fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.acp-message.acp-bot  { flex-direction: row; }
.acp-message.acp-user { flex-direction: row-reverse; }

.acp-message-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
}
.acp-bot .acp-message-bubble {
    background: var(--acp-white);
    color: var(--acp-gray-800);
    border: 1px solid var(--acp-gray-200);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.acp-user .acp-message-bubble {
    background: var(--acp-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.acp-bot-icon {
    width: 28px;
    height: 28px;
    background: var(--acp-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Typing indicator */
.acp-typing .acp-message-bubble {
    padding: 12px 16px;
}
.acp-typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}
.acp-typing-dots span {
    width: 7px;
    height: 7px;
    background: var(--acp-gray-400);
    border-radius: 50%;
    animation: acp-bounce 1.2s infinite;
}
.acp-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.acp-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes acp-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%            { transform: translateY(-6px); }
}

/* Input Area */
#acp-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--acp-white);
    border-top: 1px solid var(--acp-gray-200);
}
#acp-user-input {
    flex: 1;
    border: 1px solid var(--acp-gray-200);
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 13.5px;
    outline: none;
    color: var(--acp-gray-800);
    background: var(--acp-gray-50);
    transition: border-color 0.2s;
    font-family: inherit;
}
#acp-user-input:focus {
    border-color: var(--acp-primary);
    background: #fff;
}
#acp-user-input::placeholder { color: var(--acp-gray-400); }

#acp-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--acp-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: var(--acp-transition);
    flex-shrink: 0;
}
#acp-send-btn:hover   { background: var(--acp-primary-dark); transform: scale(1.05); }
#acp-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
#acp-send-btn svg { width: 17px; height: 17px; }

/* Footer */
#acp-footer {
    text-align: center;
    font-size: 10.5px;
    color: var(--acp-gray-400);
    padding: 6px;
    background: var(--acp-white);
}

/* Mobile */
@media (max-width: 480px) {
    #acp-chat-window {
        width: calc(100vw - 32px);
        bottom: 76px;
    }
    #acp-chatbot-wrapper.acp-right { right: 16px; }
    #acp-chatbot-wrapper.acp-left  { left: 16px; }
}
