/* AI Seller Pro - Chat Widget Styles */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600&display=swap');

:root {
    --aisp-c-primary:   #6C63FF;
    --aisp-c-primary-h: #5a52d5;
    --aisp-c-accent:    #FF6584;
    --aisp-c-bg:        #F8F7FF;
    --aisp-c-card:      #ffffff;
    --aisp-c-text:      #1e1b4b;
    --aisp-c-muted:     #6b7280;
    --aisp-c-border:    #E5E3FF;
    --aisp-c-radius:    16px;
    --aisp-c-shadow:    0 8px 40px rgba(108,99,255,0.22);
    --aisp-c-zindex:    99999;
}

/* ========== FLOATING TOGGLE BUTTON ========== */
.aisp-chat-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: var(--aisp-c-zindex);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6C63FF, #8B5CF6);
    box-shadow: 0 6px 24px rgba(108,99,255,0.45);
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s;
    outline: none;
}

.aisp-chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 32px rgba(108,99,255,0.55);
}

.aisp-chat-fab .aisp-fab-icon {
    color: #fff;
    font-size: 26px;
    line-height: 1;
    transition: transform 0.3s, opacity 0.2s;
    position: absolute;
}

.aisp-chat-fab .aisp-fab-open  { opacity: 1; }
.aisp-chat-fab .aisp-fab-close { opacity: 0; transform: rotate(-90deg); }

.aisp-chat-fab.is-open .aisp-fab-open  { opacity: 0; transform: rotate(90deg); }
.aisp-chat-fab.is-open .aisp-fab-close { opacity: 1; transform: rotate(0deg); }

/* Notification dot */
.aisp-chat-fab .aisp-notif-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 12px;
    height: 12px;
    background: var(--aisp-c-accent);
    border-radius: 50%;
    border: 2px solid #fff;
    animation: aispPulse 2s infinite;
}

@keyframes aispPulse {
    0%,100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.2); opacity: 0.8; }
}

/* ========== CHAT WINDOW ========== */
.aisp-chat-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: var(--aisp-c-zindex);
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 130px);
    background: var(--aisp-c-card);
    border-radius: var(--aisp-c-radius);
    box-shadow: var(--aisp-c-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Plus Jakarta Sans', sans-serif;
    border: 1px solid var(--aisp-c-border);
    transform-origin: bottom right;
    transform: scale(0.85) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s;
}

.aisp-chat-window.is-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ── Header ── */
.aisp-chat-header {
    background: linear-gradient(135deg, #6C63FF 0%, #8B5CF6 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.aisp-chat-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.22);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.aisp-chat-agent-info { flex: 1; }

.aisp-chat-agent-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.aisp-chat-agent-status {
    font-size: 12px;
    color: rgba(255,255,255,0.80);
    display: flex;
    align-items: center;
    gap: 5px;
}

.aisp-chat-agent-status .status-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(74,222,128,0.3);
}

.aisp-chat-close-btn {
    background: rgba(255,255,255,0.18);
    border: none;
    border-radius: 8px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.aisp-chat-close-btn:hover { background: rgba(255,255,255,0.30); }

/* ── Messages ── */
.aisp-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--aisp-c-bg);
}

.aisp-chat-messages::-webkit-scrollbar { width: 4px; }
.aisp-chat-messages::-webkit-scrollbar-track { background: transparent; }
.aisp-chat-messages::-webkit-scrollbar-thumb { background: var(--aisp-c-border); border-radius: 2px; }

.aisp-msg {
    display: flex;
    gap: 8px;
    animation: aispMsgIn 0.3s ease;
}

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

.aisp-msg-ai   { align-items: flex-start; }
.aisp-msg-user { align-items: flex-end; flex-direction: row-reverse; }

.aisp-msg-icon {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #6C63FF, #8B5CF6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.aisp-msg-bubble {
    max-width: 76%;
    padding: 11px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.aisp-msg-ai .aisp-msg-bubble {
    background: #fff;
    color: var(--aisp-c-text);
    border: 1px solid var(--aisp-c-border);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(108,99,255,0.07);
}

.aisp-msg-user .aisp-msg-bubble {
    background: linear-gradient(135deg, #6C63FF, #8B5CF6);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 14px rgba(108,99,255,0.30);
}

/* Typing indicator */
.aisp-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 0;
}

.aisp-typing span {
    width: 7px;
    height: 7px;
    background: var(--aisp-c-primary);
    border-radius: 50%;
    animation: aispTyping 1.2s infinite;
    opacity: 0.5;
}

.aisp-typing span:nth-child(2) { animation-delay: 0.2s; }
.aisp-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes aispTyping {
    0%,60%,100% { transform: translateY(0); opacity: 0.5; }
    30%          { transform: translateY(-6px); opacity: 1; }
}

/* ── Input Area ── */
.aisp-chat-input-wrap {
    padding: 14px 16px;
    border-top: 1px solid var(--aisp-c-border);
    background: #fff;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

.aisp-chat-input {
    flex: 1;
    border: 1.5px solid var(--aisp-c-border);
    border-radius: 24px;
    padding: 10px 16px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    color: var(--aisp-c-text);
    outline: none;
    resize: none;
    background: var(--aisp-c-bg);
    transition: border-color 0.2s;
    line-height: 1.5;
    max-height: 100px;
    overflow-y: auto;
}

.aisp-chat-input:focus {
    border-color: var(--aisp-c-primary);
    background: #fff;
}

.aisp-chat-input::placeholder { color: var(--aisp-c-muted); }

.aisp-send-btn {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #6C63FF, #8B5CF6);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(108,99,255,0.4);
}

.aisp-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(108,99,255,0.5);
}

.aisp-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.aisp-send-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* ── Footer ── */
.aisp-chat-footer {
    padding: 8px 16px;
    text-align: center;
    font-size: 11px;
    color: var(--aisp-c-muted);
    border-top: 1px solid var(--aisp-c-border);
    background: #fff;
}

.aisp-chat-footer a {
    color: var(--aisp-c-primary);
    text-decoration: none;
}

/* ========== INLINE SHORTCODE WIDGET ========== */
.aisp-inline-chat {
    max-width: 540px;
    border: 1px solid var(--aisp-c-border);
    border-radius: var(--aisp-c-radius);
    overflow: hidden;
    box-shadow: var(--aisp-c-shadow);
    font-family: 'Plus Jakarta Sans', sans-serif;
    margin: 20px 0;
}

.aisp-inline-chat .aisp-chat-messages {
    height: 340px;
}

/* Responsive */
@media (max-width: 480px) {
    .aisp-chat-window {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 88px;
    }
    .aisp-chat-fab {
        right: 16px;
        bottom: 20px;
    }
}
