
/* ------------------------------------------------------------------ */
/* AIForge Chat Widget                                                 */
/* ------------------------------------------------------------------ */

/* Floating launcher — sibling of .whatsapp-float, sits above it */
.chat-launcher {
    position: fixed;
    right: 22px;
    bottom: 90px;            /* clears the WhatsApp float */
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--cta-grad);
    color: #fff;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--cta-glow);
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
    z-index: 999;
}

.chat-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -8px rgba(79, 70, 229, 0.65),
                0 4px 10px rgba(79, 70, 229, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.chat-launcher svg {
    width: 26px;
    height: 26px;
}

/* tiny unread dot */
.chat-launcher-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gold);
    border: 2px solid #fff;
    display: none;
}
.chat-launcher.is-unread .chat-launcher-dot { display: block; }

/* Panel */
.chat-panel {
    position: fixed;
    right: 22px;
    bottom: 158px;
    width: 340px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 180px);
    background: #0b1020;                    /* deep ink */
    color: #e8eaf6;
    border-radius: 16px;
    box-shadow: 0 24px 60px -12px rgba(11, 16, 32, 0.45),
                0 8px 24px rgba(11, 16, 32, 0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    font-family: var(--font-body);
    animation: chat-pop 0.22s var(--ease-out);
}

.chat-panel.is-open { display: flex; }

@keyframes chat-pop {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #1f2540 0%, #0b1020 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cta-grad);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-header-meta { flex: 1; min-width: 0; }
.chat-header-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
    line-height: 1.2;
}
.chat-header-status {
    font-size: 0.78rem;
    color: #22c55e;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}
.chat-header-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.chat-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.chat-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.chat-close svg { width: 14px; height: 14px; }

/* Messages area */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #0b1020;
}

.chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-bubble.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    color: #e8eaf6;
    border-bottom-left-radius: 4px;
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--cta-grad);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Quick-action buttons inside the first bot message */
.chat-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.chat-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.14);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, transform 0.15s;
}
.chat-action-btn:hover {
    background: rgba(34, 197, 94, 0.22);
    transform: translateY(-1px);
}
.chat-action-btn svg { width: 16px; height: 16px; }

/* Composer */
.chat-composer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #e8eaf6;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.chat-input::placeholder { color: #94a3b8; }
.chat-input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.06);
}

.chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #22c55e;
    color: #fff;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
}
.chat-send:hover { background: #16a34a; transform: scale(1.05); }
.chat-send svg { width: 18px; height: 18px; }

/* Typing dots */
.chat-typing {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    padding: 12px 16px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    display: inline-flex;
    gap: 4px;
}
.chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: chat-typing 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-typing {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30%           { opacity: 1;   transform: translateY(-3px); }
}

/* Responsive — stack above WhatsApp on small screens */
@media (max-width: 480px) {
    .chat-panel {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 150px;
        height: calc(100vh - 200px);
    }
    .chat-launcher {
        right: 30px;
        bottom: 82px;
        width: 50px;
        height: 50px;
    }
}
