/* ============================================================
   Stock Utility SaaS — AI Support Chat Widget
   ============================================================ */

/* ── Widget container ─────────────────────────────────────── */
.sus-ai-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Bubble trigger button ───────────────────────────────── */
.sus-ai-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--sus-ai-primary, #4f46e5);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(79,70,229,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform .2s ease, box-shadow .2s ease;
    color: #fff;
    font-size: 24px;
}
.sus-ai-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(79,70,229,.55);
}
.sus-ai-bubble:focus-visible {
    outline: 3px solid #a5b4fc;
    outline-offset: 2px;
}

.sus-ai-unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: sus-pulse 1.5s infinite;
}

@keyframes sus-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ── Chat window ─────────────────────────────────────────── */
.sus-ai-window {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 360px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: sus-chat-in .25s ease;
    border: 1px solid rgba(0,0,0,.08);
}

@keyframes sus-chat-in {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ─────────────────────────────────────────────── */
.sus-ai-header {
    background: var(--sus-ai-primary, #4f46e5);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sus-ai-logo {
    width: auto;
    height: 32px;
    border-radius: 4px;
    object-fit: contain;
    background: rgba(255,255,255,.15);
    padding: 2px 4px;
}

.sus-ai-header-icon {
    font-size: 22px;
    opacity: .9;
}

.sus-ai-header-info {
    flex: 1;
    min-width: 0;
}
.sus-ai-header-info strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sus-ai-status {
    font-size: 11px;
    opacity: .85;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 1px;
}
.sus-ai-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(74,222,128,.3);
}

.sus-ai-close-btn {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    transition: background .15s;
}
.sus-ai-close-btn:hover { background: rgba(255,255,255,.25); }

/* ── Messages area ──────────────────────────────────────── */
.sus-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    background: #f8f9ff;
}

.sus-ai-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    max-width: 90%;
}

.sus-ai-msg.sus-ai-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.sus-ai-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--sus-ai-primary, #4f46e5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.sus-ai-avatar.small { width: 24px; height: 24px; font-size: 11px; }

.sus-ai-user .sus-ai-avatar {
    background: #e5e7eb;
    color: #374151;
}

.sus-ai-bubble-msg {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.sus-ai-bot .sus-ai-bubble-msg {
    background: #fff;
    border-bottom-left-radius: 4px;
    color: #1f2937;
    border: 1px solid #e5e7eb;
}

.sus-ai-user .sus-ai-bubble-msg {
    background: var(--sus-ai-primary, #4f46e5);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.sus-ai-bubble-msg strong {
    font-weight: 600;
}

/* ── Quick action buttons ──────────────────────────────── */
.sus-ai-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: 38px;
}
.sus-ai-quick-btn {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    color: var(--sus-ai-primary, #4f46e5);
    transition: all .15s;
    white-space: nowrap;
}
.sus-ai-quick-btn:hover {
    background: var(--sus-ai-primary, #4f46e5);
    color: #fff;
    border-color: var(--sus-ai-primary, #4f46e5);
}

/* ── Typing indicator ──────────────────────────────────── */
.sus-ai-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f8f9ff;
}
.sus-typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 8px 12px;
}
.sus-typing-dots span {
    width: 7px;
    height: 7px;
    background: #9ca3af;
    border-radius: 50%;
    animation: sus-bounce 1.2s infinite;
}
.sus-typing-dots span:nth-child(2) { animation-delay: .2s; }
.sus-typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes sus-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* ── Input area ────────────────────────────────────────── */
.sus-ai-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.sus-ai-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 22px;
    padding: 9px 16px;
    font-size: 13.5px;
    outline: none;
    background: #f9fafb;
    transition: border-color .15s, box-shadow .15s;
}
.sus-ai-input:focus {
    border-color: var(--sus-ai-primary, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
    background: #fff;
}

.sus-ai-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--sus-ai-primary, #4f46e5);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: transform .15s, background .15s;
}
.sus-ai-send-btn:hover { transform: scale(1.08); background: #4338ca; }
.sus-ai-send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Footer note ───────────────────────────────────────── */
.sus-ai-footer-note {
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    padding: 4px 12px 8px;
    background: #fff;
}
.sus-ai-footer-note a {
    color: var(--sus-ai-primary, #4f46e5);
    text-decoration: none;
}

/* ── Scrollbar ─────────────────────────────────────────── */
.sus-ai-messages::-webkit-scrollbar { width: 4px; }
.sus-ai-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 480px) {
    .sus-ai-widget { bottom: 16px; right: 16px; }
    .sus-ai-window {
        width: calc(100vw - 32px);
        max-height: 75vh;
        right: -8px;
    }
}
