/* CQ AI Support — front-end widget.
   Scoped under .cqai- prefixes and uses its own font stack fallbacks so it renders the same
   whether or not the page's Tailwind build is present. Sits bottom-right; the site's WhatsApp
   button is pinned right-centre, so the two do not collide. */

.cqai-root {
    --cqai-primary: #0a1f44;
    --cqai-accent: #16a34a;
    --cqai-surface: #f8fafc;
    --cqai-border: #e2e8f0;
    --cqai-text: #0f172a;
    --cqai-muted: #64748b;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9998;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* --- avatar --- */

.cqai-avatar {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
}

.cqai-avatar-mono {
    display: grid;
    place-items: center;
    background: var(--cqai-accent);
    color: #fff;
}

.cqai-avatar-mono svg { width: 17px; height: 17px; }

.cqai-header .cqai-avatar {
    width: 36px;
    height: 36px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.cqai-launcher .cqai-avatar { width: 28px; height: 28px; }

.cqai-row-bot .cqai-avatar { width: 26px; height: 26px; margin-top: 2px; }
.cqai-row-bot .cqai-avatar-mono svg { width: 15px; height: 15px; }

/* --- launcher --- */

.cqai-launcher {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 54px;
    padding: 0 22px 0 13px;
    border: 0;
    border-radius: 999px;
    background: var(--cqai-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(10, 31, 68, 0.28);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.cqai-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(10, 31, 68, 0.34);
}

.cqai-root[data-open="true"] .cqai-launcher { display: none; }

/* --- panel --- */

.cqai-panel {
    display: none;
    flex-direction: column;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border: 1px solid var(--cqai-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.cqai-root[data-open="true"] .cqai-panel {
    display: flex;
    animation: cqai-rise 0.2s ease-out;
}

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

.cqai-header {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 16px 16px 15px;
    background: var(--cqai-primary);
    color: #fff;
}

.cqai-header-text { flex: 1; min-width: 0; }

.cqai-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.cqai-subtitle {
    margin: 3px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.72);
}

.cqai-close {
    flex: none;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.cqai-close:hover { background: rgba(255, 255, 255, 0.22); }

/* --- messages --- */

.cqai-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--cqai-surface);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cqai-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
}

.cqai-row-user { justify-content: flex-end; }

.cqai-msg {
    max-width: 84%;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.6;
}

.cqai-msg-body { white-space: pre-wrap; word-wrap: break-word; }

.cqai-msg-bot {
    background: #fff;
    border: 1px solid var(--cqai-border);
    color: var(--cqai-text);
    border-top-left-radius: 4px;
}

.cqai-msg-user {
    background: var(--cqai-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.cqai-msg-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.cqai-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid var(--cqai-border);
}

.cqai-source {
    font-size: 11px;
    font-weight: 600;
    color: var(--cqai-accent);
    text-decoration: none;
    padding: 2px 8px;
    border: 1px solid rgba(22, 163, 74, 0.28);
    border-radius: 999px;
}

.cqai-source:hover { background: rgba(22, 163, 74, 0.08); }

/* --- suggested prompts --- */

.cqai-prompts {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    padding-left: 34px;
}

.cqai-prompt {
    max-width: 100%;
    padding: 8px 13px;
    border: 1px solid rgba(22, 163, 74, 0.35);
    border-radius: 999px;
    background: #fff;
    color: var(--cqai-primary);
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.cqai-prompt:hover {
    background: rgba(22, 163, 74, 0.07);
    border-color: var(--cqai-accent);
}

/* typing indicator */

.cqai-typing { display: inline-flex; gap: 4px; align-items: center; padding: 3px 0; }
.cqai-typing span {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--cqai-muted);
    animation: cqai-bounce 1.2s infinite ease-in-out;
}
.cqai-typing span:nth-child(2) { animation-delay: 0.15s; }
.cqai-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes cqai-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* --- composer --- */

.cqai-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border-top: 1px solid var(--cqai-border);
}

.cqai-input {
    flex: 1;
    resize: none;
    max-height: 96px;
    padding: 9px 12px;
    font-size: 13.5px;
    font-family: inherit;
    line-height: 1.5;
    color: var(--cqai-text);
    border: 1px solid var(--cqai-border);
    border-radius: 10px;
    background: #fff;
}

.cqai-input:focus {
    outline: none;
    border-color: var(--cqai-primary);
    box-shadow: 0 0 0 3px rgba(10, 31, 68, 0.1);
}

.cqai-send {
    flex: none;
    width: 40px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: var(--cqai-accent);
    color: #fff;
    cursor: pointer;
}

.cqai-send:hover { background: #15803d; }
.cqai-send:disabled { opacity: 0.5; cursor: default; }
.cqai-send svg { width: 18px; height: 18px; }

.cqai-note {
    padding: 0 12px 10px;
    margin: 0;
    font-size: 10.5px;
    line-height: 1.4;
    color: var(--cqai-muted);
    background: #fff;
    text-align: center;
}

@media (max-width: 480px) {
    .cqai-root { right: 16px; bottom: 16px; }
    .cqai-panel { width: calc(100vw - 32px); height: min(580px, calc(100vh - 100px)); }
    .cqai-launcher span { display: none; }
    .cqai-launcher { padding: 0 13px; }
}
