/* Sigma Assistant - floating visitor chat widget */

:root {
    --sg-blue: #2563eb;
    --sg-blue-dark: #1d4ed8;
    --sg-red: #ef4444;
    --sg-dark: #0f172a;
    --sg-muted: #64748b;
    --sg-line: #e2e8f0;
    --sg-bot: #f1f5f9;
}

/* Keep the site's back-to-top button clear of the assistant */
.back-to-top { bottom: 96px !important; }

#sg-assistant-root,
#sg-assistant-root * { box-sizing: border-box; }

#sg-assistant-root { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; }

.sg-launcher {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 2147483000;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 0 20px 0 16px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--sg-blue) 0%, #1e40af 60%, var(--sg-dark) 100%);
    box-shadow: 0 12px 30px -8px rgba(37, 99, 235, .55), 0 2px 8px rgba(15, 23, 42, .18);
    font: 700 14px/1 'Inter', system-ui, sans-serif;
    letter-spacing: .2px;
    transition: transform .18s ease, box-shadow .18s ease;
}
.sg-launcher:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -10px rgba(37, 99, 235, .6); }
.sg-launcher:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }
.sg-launcher svg { width: 24px; height: 24px; flex: none; }
.sg-launcher .sg-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .25);
}

.sg-panel {
    position: fixed;
    right: 22px;
    bottom: 92px;
    z-index: 2147483001;
    width: 384px;
    max-width: calc(100vw - 24px);
    height: min(580px, calc(100vh - 130px));
    display: none;
    flex-direction: column;
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--sg-line);
    box-shadow: 0 30px 70px -20px rgba(15, 23, 42, .45), 0 8px 20px rgba(15, 23, 42, .12);
    animation: sg-pop .18s ease-out;
}
.sg-panel.sg-open { display: flex; }

@keyframes sg-pop {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.sg-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    color: #fff;
    background: linear-gradient(120deg, #0f172a 0%, #1e3a8a 55%, #1d4ed8 100%);
}
.sg-avatar {
    width: 38px; height: 38px; flex: none;
    display: grid; place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    font-weight: 800; font-size: 17px;
}
.sg-head h2 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: .2px; }
.sg-head p { margin: 2px 0 0; font-size: 11.5px; color: #cbd5e1; display: flex; align-items: center; gap: 6px; }
.sg-status { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; }
.sg-close {
    margin-left: auto;
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border: 0; border-radius: 10px;
    background: transparent; color: #e2e8f0; cursor: pointer;
    font-size: 20px; line-height: 1;
}
.sg-close:hover { background: rgba(255, 255, 255, .12); }
.sg-close:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

.sg-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 8px;
    background: #f8fafc;
    scrollbar-width: thin;
}

.sg-msg { display: flex; gap: 10px; margin-bottom: 14px; align-items: flex-end; }
.sg-msg.sg-user { flex-direction: row-reverse; }
.sg-bubble {
    max-width: 82%;
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    color: #0f172a;
    background: #fff;
    border: 1px solid var(--sg-line);
    white-space: pre-wrap;
    word-break: break-word;
}
.sg-user .sg-bubble {
    background: var(--sg-blue);
    border-color: var(--sg-blue);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.sg-bot .sg-bubble { border-bottom-left-radius: 4px; }
.sg-bubble a { color: var(--sg-blue-dark); font-weight: 600; }
.sg-user .sg-bubble a { color: #dbeafe; }

/* Answer feedback (helpful / not helpful) */
.sg-stack { max-width: 82%; display: flex; flex-direction: column; gap: 6px; }
.sg-stack .sg-bubble { max-width: 100%; }
.sg-feedback { display: flex; align-items: center; gap: 6px; padding-left: 3px; min-height: 28px; }
.sg-fb-q { font-size: 10.5px; color: #94a3b8; margin-right: 2px; }
.sg-fb {
    width: 28px; height: 28px;
    display: grid; place-items: center;
    border: 1px solid var(--sg-line);
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.sg-fb:hover { border-color: #93c5fd; color: var(--sg-blue); }
.sg-fb:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.sg-fb:disabled { cursor: default; opacity: .55; }
.sg-fb svg { width: 15px; height: 15px; }
.sg-fb.down svg { transform: rotate(180deg); }
.sg-fb.sg-fb-on { border-color: #10b981; background: #ecfdf5; color: #047857; opacity: 1; }
.sg-fb.sg-fb-on.down { border-color: #ef4444; background: #fef2f2; color: #b91c1c; }
.sg-fb-note { font-size: 10.5px; color: #94a3b8; }

.sg-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 12px; background: #f8fafc; }
.sg-chip {
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #1e3a8a;
    border-radius: 999px;
    padding: 7px 12px;
    font: 600 12px/1 'Inter', system-ui, sans-serif;
    cursor: pointer;
}
.sg-chip:hover { background: #e0e7ff; }
.sg-chip:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

.sg-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--sg-line);
    background: #fff;
}
.sg-input {
    flex: 1;
    min-height: 44px;
    max-height: 110px;
    resize: none;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font: 400 14px/1.4 'Inter', system-ui, sans-serif;
    color: #0f172a;
    background: #fff;
}
.sg-input:focus { outline: none; border-color: var(--sg-blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.sg-send {
    width: 44px; height: 44px; flex: none;
    display: grid; place-items: center;
    border: 0; border-radius: 12px;
    background: var(--sg-blue); color: #fff; cursor: pointer;
}
.sg-send:hover { background: var(--sg-blue-dark); }
.sg-send:disabled { background: #94a3b8; cursor: not-allowed; }
.sg-send:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.sg-send svg { width: 20px; height: 20px; }

.sg-note {
    padding: 0 12px 10px;
    font-size: 10.5px;
    color: #94a3b8;
    text-align: center;
    background: #fff;
}

/* Typing indicator */
.sg-typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.sg-typing span {
    width: 7px; height: 7px; border-radius: 50%; background: #94a3b8;
    animation: sg-bounce 1.2s infinite ease-in-out;
}
.sg-typing span:nth-child(2) { animation-delay: .15s; }
.sg-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes sg-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .6; }
    30% { transform: translateY(-5px); opacity: 1; }
}

@media (max-width: 520px) {
    .sg-launcher { right: 14px; bottom: 14px; height: 52px; padding: 0 16px; font-size: 13px; }
    .sg-launcher .sg-label { display: none; }
    .back-to-top { bottom: 84px !important; }
    .sg-panel {
        right: 10px; left: 10px; bottom: 76px;
        width: auto;
        height: min(78vh, 640px);
        border-radius: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sg-panel { animation: none; }
    .sg-launcher { transition: none; }
    .sg-typing span { animation: none; }
}
