/* ===================================================================
   AI All-K — Widget Frontend · Light-first Adaptive  v4
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&display=swap');

/* ── Design tokens (clair par défaut) ───────────────────────────── */
:root {
    --rag-primary:          #7C3AED;
    --rag-primary-b:        #2563EB;
    --rag-accent:           #06B6D4;
    --rag-plasma:           #F472B6;
    --rag-text:             #1e1b2e;

    --rag-bubble-size:      58px;
    --rag-width:            390px;
    --rag-height:           580px;
    --rag-radius:           22px;
    --rag-font-size:        13.5px;
    --rag-bottom-offset:    28px;
    --rag-side-offset:      28px;

    --rag-void:             #f4f5f9;
    --rag-deep:             #ffffff;
    --rag-surface:          rgba(255, 255, 255, 0.98);
    --rag-glass:            rgba(15, 12, 35, 0.04);
    --rag-glass-border:     rgba(15, 12, 35, 0.08);
    --rag-msgs-bg:          transparent;
    --rag-input-bg:         #ffffff;
    --rag-border:           rgba(15, 12, 35, 0.1);

    --rag-header-bg:        rgba(255, 255, 255, 0.92);
    --rag-header-text:      #1e1b2e;
    --rag-header-muted:     rgba(30, 27, 46, 0.48);
    --rag-close-bg:         rgba(15, 12, 35, 0.05);
    --rag-close-border:     rgba(15, 12, 35, 0.08);
    --rag-close-color:      rgba(30, 27, 46, 0.45);
    --rag-close-hover-bg:   rgba(15, 12, 35, 0.09);
    --rag-close-hover-color:#1e1b2e;

    --rag-bot-bg:           #eef0f5;
    --rag-bot-text:         #2a2640;
    --rag-bot-border:       rgba(15, 12, 35, 0.08);
    --rag-bot-shadow:       0 2px 10px rgba(15, 12, 35, 0.06);
    --rag-list-color:       rgba(42, 38, 64, 0.78);

    --rag-source-bg:        rgba(124, 58, 237, 0.08);
    --rag-source-color:     #6d28d9;
    --rag-source-border:    rgba(124, 58, 237, 0.2);

    --rag-qa-bg:            rgba(15, 12, 35, 0.03);
    --rag-qa-border:        rgba(15, 12, 35, 0.1);
    --rag-qa-color:         rgba(30, 27, 46, 0.62);
    --rag-qa-hover-bg:      rgba(124, 58, 237, 0.08);
    --rag-qa-hover-border:  rgba(124, 58, 237, 0.32);
    --rag-qa-hover-color:   #6d28d9;

    --rag-contact-bg:       rgba(15, 12, 35, 0.03);
    --rag-contact-border:   rgba(15, 12, 35, 0.07);
    --rag-contact-btn-bg:   #ffffff;
    --rag-contact-btn-border: rgba(15, 12, 35, 0.1);
    --rag-contact-btn-color: rgba(30, 27, 46, 0.5);

    --rag-input-area-bg:    rgba(255, 255, 255, 0.88);
    --rag-input-border:     rgba(15, 12, 35, 0.12);
    --rag-input-color:      #1e1b2e;
    --rag-input-placeholder: rgba(30, 27, 46, 0.38);
    --rag-input-focus-bg:   #ffffff;
    --rag-caret:            #7C3AED;

    --rag-footer-bg:        rgba(244, 245, 249, 0.95);
    --rag-clear-color:      rgba(30, 27, 46, 0.38);
    --rag-powered-color:    rgba(30, 27, 46, 0.32);

    --rag-pricing-card-bg:  #ffffff;
    --rag-pricing-name:     #1e1b2e;
    --rag-pricing-desc:     rgba(30, 27, 46, 0.45);
    --rag-pricing-feature:  rgba(30, 27, 46, 0.58);
    --rag-pricing-intro:    #2a2640;

    --rag-bubble-bg:
        linear-gradient(145deg, rgba(124, 58, 237, 0.92) 0%, rgba(37, 99, 235, 0.92) 100%);
    --rag-bubble-border:    rgba(124, 58, 237, 0.35);
    --rag-bubble-shadow:
        0 8px 28px rgba(124, 58, 237, 0.32),
        0 2px 8px rgba(15, 12, 35, 0.12);
    --rag-notif-border:     #ffffff;

    --rag-noise-opacity:    0.018;
    --rag-separator:
        linear-gradient(
            90deg,
            transparent 0%,
            rgba(124, 58, 237, 0.28) 25%,
            rgba(6, 182, 212, 0.22) 60%,
            rgba(244, 114, 182, 0.16) 80%,
            transparent 100%
        );

    --glow-violet:          rgba(124, 58, 237, 0.22);
    --glow-cyan:            rgba(6, 182, 212, 0.14);
    --glow-pink:            rgba(244, 114, 182, 0.12);

    --rag-shadow:
        0 24px 64px rgba(15, 12, 35, 0.14),
        0 0 0 1px rgba(15, 12, 35, 0.06),
        0 8px 28px rgba(124, 58, 237, 0.08);

    --ease-spring:          cubic-bezier(.34, 1.56, .64, 1);
    --ease-out:             cubic-bezier(.4, 0, .2, 1);
    --t-fast:               .18s var(--ease-out);
    --t-spring:             .38s var(--ease-spring);
}

/* ── Tokens sombre (système + site) ─────────────────────────────── */
@media (prefers-color-scheme: dark) {
    :root:not(.rag-theme-light) {
        --rag-text:             #ffffff;
        --rag-void:             #07060f;
        --rag-deep:             #0c0a1c;
        --rag-surface:          rgba(10, 8, 22, 0.97);
        --rag-glass:            rgba(255, 255, 255, 0.04);
        --rag-glass-border:     rgba(255, 255, 255, 0.07);
        --rag-input-bg:         rgba(255, 255, 255, 0.05);
        --rag-border:           rgba(255, 255, 255, 0.07);

        --rag-header-bg:        rgba(10, 8, 22, 0.82);
        --rag-header-text:      #ffffff;
        --rag-header-muted:     rgba(255, 255, 255, 0.42);
        --rag-close-bg:         rgba(255, 255, 255, 0.06);
        --rag-close-border:     rgba(255, 255, 255, 0.07);
        --rag-close-color:      rgba(255, 255, 255, 0.5);
        --rag-close-hover-bg:   rgba(255, 255, 255, 0.11);
        --rag-close-hover-color:#fff;

        --rag-bot-bg:           rgba(255, 255, 255, 0.052);
        --rag-bot-text:         rgba(255, 255, 255, 0.88);
        --rag-bot-border:       rgba(255, 255, 255, 0.08);
        --rag-bot-shadow:
            0 2px 14px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
        --rag-list-color:       rgba(255, 255, 255, 0.78);

        --rag-source-bg:        rgba(124, 58, 237, 0.1);
        --rag-source-color:     rgba(167, 139, 250, 0.85);
        --rag-source-border:    rgba(124, 58, 237, 0.22);

        --rag-qa-bg:            rgba(255, 255, 255, 0.04);
        --rag-qa-border:        rgba(255, 255, 255, 0.09);
        --rag-qa-color:         rgba(255, 255, 255, 0.55);
        --rag-qa-hover-bg:      rgba(124, 58, 237, 0.14);
        --rag-qa-hover-border:  rgba(124, 58, 237, 0.38);
        --rag-qa-hover-color:   rgba(196, 181, 253, 0.95);

        --rag-contact-bg:       rgba(0, 0, 0, 0.28);
        --rag-contact-border:   rgba(255, 255, 255, 0.05);
        --rag-contact-btn-bg:   rgba(255, 255, 255, 0.04);
        --rag-contact-btn-border: rgba(255, 255, 255, 0.07);
        --rag-contact-btn-color: rgba(255, 255, 255, 0.45);

        --rag-input-area-bg:    rgba(0, 0, 0, 0.22);
        --rag-input-border:     rgba(255, 255, 255, 0.09);
        --rag-input-color:      rgba(255, 255, 255, 0.9);
        --rag-input-placeholder: rgba(255, 255, 255, 0.22);
        --rag-input-focus-bg:   rgba(255, 255, 255, 0.07);
        --rag-caret:            #A78BFA;

        --rag-footer-bg:        rgba(0, 0, 0, 0.18);
        --rag-clear-color:      rgba(255, 255, 255, 0.28);
        --rag-powered-color:    rgba(255, 255, 255, 0.22);

        --rag-pricing-card-bg:  rgba(255, 255, 255, 0.04);
        --rag-pricing-name:     rgba(255, 255, 255, 0.88);
        --rag-pricing-desc:     rgba(255, 255, 255, 0.32);
        --rag-pricing-feature:  rgba(255, 255, 255, 0.5);
        --rag-pricing-intro:    rgba(255, 255, 255, 0.82);

        --rag-bubble-bg:
            linear-gradient(145deg, rgba(124, 58, 237, 0.25) 0%, rgba(37, 99, 235, 0.2) 100%),
            var(--rag-deep);
        --rag-bubble-border:    rgba(124, 58, 237, 0.38);
        --rag-bubble-shadow:
            0 8px 32px rgba(124, 58, 237, 0.45),
            0 2px 8px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.09);
        --rag-notif-border:     #07060f;

        --rag-noise-opacity:    0.035;
        --rag-separator:
            linear-gradient(
                90deg,
                transparent 0%,
                rgba(124, 58, 237, 0.45) 25%,
                rgba(6, 182, 212, 0.4) 60%,
                rgba(244, 114, 182, 0.25) 80%,
                transparent 100%
            );

        --glow-violet:          rgba(124, 58, 237, 0.4);
        --glow-cyan:            rgba(6, 182, 212, 0.25);
        --glow-pink:            rgba(244, 114, 182, 0.2);

        --rag-shadow:
            0 40px 100px rgba(0, 0, 0, 0.75),
            0 0 0 1px rgba(255, 255, 255, 0.06),
            0 8px 40px rgba(124, 58, 237, 0.18);
    }
}

/* Forçage clair (site light alors que l’OS est dark) */
:root.rag-theme-light,
html.rag-theme-light,
#rag-chatbot-root.rag-theme-light {
    --rag-text:             #1e1b2e;
    --rag-void:             #f4f5f9;
    --rag-deep:             #ffffff;
    --rag-surface:          rgba(255, 255, 255, 0.98);
    --rag-glass:            rgba(15, 12, 35, 0.04);
    --rag-glass-border:     rgba(15, 12, 35, 0.08);
    --rag-input-bg:         #ffffff;
    --rag-border:           rgba(15, 12, 35, 0.1);

    --rag-header-bg:        rgba(255, 255, 255, 0.92);
    --rag-header-text:      #1e1b2e;
    --rag-header-muted:     rgba(30, 27, 46, 0.48);
    --rag-close-bg:         rgba(15, 12, 35, 0.05);
    --rag-close-border:     rgba(15, 12, 35, 0.08);
    --rag-close-color:      rgba(30, 27, 46, 0.45);
    --rag-close-hover-bg:   rgba(15, 12, 35, 0.09);
    --rag-close-hover-color:#1e1b2e;

    --rag-bot-bg:           #eef0f5;
    --rag-bot-text:         #2a2640;
    --rag-bot-border:       rgba(15, 12, 35, 0.08);
    --rag-bot-shadow:       0 2px 10px rgba(15, 12, 35, 0.06);
    --rag-list-color:       rgba(42, 38, 64, 0.78);

    --rag-source-bg:        rgba(124, 58, 237, 0.08);
    --rag-source-color:     #6d28d9;
    --rag-source-border:    rgba(124, 58, 237, 0.2);

    --rag-qa-bg:            rgba(15, 12, 35, 0.03);
    --rag-qa-border:        rgba(15, 12, 35, 0.1);
    --rag-qa-color:         rgba(30, 27, 46, 0.62);
    --rag-qa-hover-bg:      rgba(124, 58, 237, 0.08);
    --rag-qa-hover-border:  rgba(124, 58, 237, 0.32);
    --rag-qa-hover-color:   #6d28d9;

    --rag-contact-bg:       rgba(15, 12, 35, 0.03);
    --rag-contact-border:   rgba(15, 12, 35, 0.07);
    --rag-contact-btn-bg:   #ffffff;
    --rag-contact-btn-border: rgba(15, 12, 35, 0.1);
    --rag-contact-btn-color: rgba(30, 27, 46, 0.5);

    --rag-input-area-bg:    rgba(255, 255, 255, 0.88);
    --rag-input-border:     rgba(15, 12, 35, 0.12);
    --rag-input-color:      #1e1b2e;
    --rag-input-placeholder: rgba(30, 27, 46, 0.38);
    --rag-input-focus-bg:   #ffffff;
    --rag-caret:            #7C3AED;

    --rag-footer-bg:        rgba(244, 245, 249, 0.95);
    --rag-clear-color:      rgba(30, 27, 46, 0.38);
    --rag-powered-color:    rgba(30, 27, 46, 0.32);

    --rag-pricing-card-bg:  #ffffff;
    --rag-pricing-name:     #1e1b2e;
    --rag-pricing-desc:     rgba(30, 27, 46, 0.45);
    --rag-pricing-feature:  rgba(30, 27, 46, 0.58);
    --rag-pricing-intro:    #2a2640;

    --rag-bubble-bg:
        linear-gradient(145deg, rgba(124, 58, 237, 0.92) 0%, rgba(37, 99, 235, 0.92) 100%);
    --rag-bubble-border:    rgba(124, 58, 237, 0.35);
    --rag-bubble-shadow:
        0 8px 28px rgba(124, 58, 237, 0.32),
        0 2px 8px rgba(15, 12, 35, 0.12);
    --rag-notif-border:     #ffffff;

    --rag-noise-opacity:    0.018;
    --rag-separator:
        linear-gradient(
            90deg,
            transparent 0%,
            rgba(124, 58, 237, 0.28) 25%,
            rgba(6, 182, 212, 0.22) 60%,
            rgba(244, 114, 182, 0.16) 80%,
            transparent 100%
        );

    --glow-violet:          rgba(124, 58, 237, 0.22);
    --glow-cyan:            rgba(6, 182, 212, 0.14);
    --glow-pink:            rgba(244, 114, 182, 0.12);

    --rag-shadow:
        0 24px 64px rgba(15, 12, 35, 0.14),
        0 0 0 1px rgba(15, 12, 35, 0.06),
        0 8px 28px rgba(124, 58, 237, 0.08);
}

/* Forçage sombre via classe (détectée sur le site) */
:root.rag-theme-dark,
html.rag-theme-dark,
#rag-chatbot-root.rag-theme-dark {
    --rag-text:             #ffffff;
    --rag-void:             #07060f;
    --rag-deep:             #0c0a1c;
    --rag-surface:          rgba(10, 8, 22, 0.97);
    --rag-glass:            rgba(255, 255, 255, 0.04);
    --rag-glass-border:     rgba(255, 255, 255, 0.07);
    --rag-input-bg:         rgba(255, 255, 255, 0.05);
    --rag-border:           rgba(255, 255, 255, 0.07);

    --rag-header-bg:        rgba(10, 8, 22, 0.82);
    --rag-header-text:      #ffffff;
    --rag-header-muted:     rgba(255, 255, 255, 0.42);
    --rag-close-bg:         rgba(255, 255, 255, 0.06);
    --rag-close-border:     rgba(255, 255, 255, 0.07);
    --rag-close-color:      rgba(255, 255, 255, 0.5);
    --rag-close-hover-bg:   rgba(255, 255, 255, 0.11);
    --rag-close-hover-color:#fff;

    --rag-bot-bg:           rgba(255, 255, 255, 0.052);
    --rag-bot-text:         rgba(255, 255, 255, 0.88);
    --rag-bot-border:       rgba(255, 255, 255, 0.08);
    --rag-bot-shadow:
        0 2px 14px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --rag-list-color:       rgba(255, 255, 255, 0.78);

    --rag-source-bg:        rgba(124, 58, 237, 0.1);
    --rag-source-color:     rgba(167, 139, 250, 0.85);
    --rag-source-border:    rgba(124, 58, 237, 0.22);

    --rag-qa-bg:            rgba(255, 255, 255, 0.04);
    --rag-qa-border:        rgba(255, 255, 255, 0.09);
    --rag-qa-color:         rgba(255, 255, 255, 0.55);
    --rag-qa-hover-bg:      rgba(124, 58, 237, 0.14);
    --rag-qa-hover-border:  rgba(124, 58, 237, 0.38);
    --rag-qa-hover-color:   rgba(196, 181, 253, 0.95);

    --rag-contact-bg:       rgba(0, 0, 0, 0.28);
    --rag-contact-border:   rgba(255, 255, 255, 0.05);
    --rag-contact-btn-bg:   rgba(255, 255, 255, 0.04);
    --rag-contact-btn-border: rgba(255, 255, 255, 0.07);
    --rag-contact-btn-color: rgba(255, 255, 255, 0.45);

    --rag-input-area-bg:    rgba(0, 0, 0, 0.22);
    --rag-input-border:     rgba(255, 255, 255, 0.09);
    --rag-input-color:      rgba(255, 255, 255, 0.9);
    --rag-input-placeholder: rgba(255, 255, 255, 0.22);
    --rag-input-focus-bg:   rgba(255, 255, 255, 0.07);
    --rag-caret:            #A78BFA;

    --rag-footer-bg:        rgba(0, 0, 0, 0.18);
    --rag-clear-color:      rgba(255, 255, 255, 0.28);
    --rag-powered-color:    rgba(255, 255, 255, 0.22);

    --rag-pricing-card-bg:  rgba(255, 255, 255, 0.04);
    --rag-pricing-name:     rgba(255, 255, 255, 0.88);
    --rag-pricing-desc:     rgba(255, 255, 255, 0.32);
    --rag-pricing-feature:  rgba(255, 255, 255, 0.5);
    --rag-pricing-intro:    rgba(255, 255, 255, 0.82);

    --rag-bubble-bg:
        linear-gradient(145deg, rgba(124, 58, 237, 0.25) 0%, rgba(37, 99, 235, 0.2) 100%),
        var(--rag-deep);
    --rag-bubble-border:    rgba(124, 58, 237, 0.38);
    --rag-bubble-shadow:
        0 8px 32px rgba(124, 58, 237, 0.45),
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.09);
    --rag-notif-border:     #07060f;

    --rag-noise-opacity:    0.035;
    --rag-separator:
        linear-gradient(
            90deg,
            transparent 0%,
            rgba(124, 58, 237, 0.45) 25%,
            rgba(6, 182, 212, 0.4) 60%,
            rgba(244, 114, 182, 0.25) 80%,
            transparent 100%
        );

    --glow-violet:          rgba(124, 58, 237, 0.4);
    --glow-cyan:            rgba(6, 182, 212, 0.25);
    --glow-pink:            rgba(244, 114, 182, 0.2);

    --rag-shadow:
        0 40px 100px rgba(0, 0, 0, 0.75),
        0 0 0 1px rgba(255, 255, 255, 0.06),
        0 8px 40px rgba(124, 58, 237, 0.18);
}

/* ── Reset ──────────────────────────────────────────────────────── */
#rag-chatbot-root *,
#rag-chatbot-root *::before,
#rag-chatbot-root *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Root ───────────────────────────────────────────────────────── */
#rag-chatbot-root {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: var(--rag-font-size);
    line-height: 1.5;
    z-index: 999999;
    color: var(--rag-text);
    color-scheme: light;
}
#rag-chatbot-root.rag-theme-dark { color-scheme: dark; }
#rag-chatbot-root.rag-theme-light { color-scheme: light; }
@media (prefers-color-scheme: dark) {
    #rag-chatbot-root:not(.rag-theme-light) { color-scheme: dark; }
}

/* ── Float positioning ──────────────────────────────────────────── */
.rag-chatbot-floating            { position: fixed; bottom: var(--rag-bottom-offset); }
.rag-chatbot-pos-bottom-right    { right: var(--rag-side-offset); }
.rag-chatbot-pos-bottom-left     { left:  var(--rag-side-offset); }

/* ── Inline mode ────────────────────────────────────────────────── */
.rag-chatbot-inline {
    position: relative;
    width: 100%;
    max-width: var(--rag-width);
}
.rag-chatbot-inline .rag-chatbot-window {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    left:  auto !important;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: all !important;
    display: flex !important;
}

/* ════════════════════════════════════════════════════════════════
   FLOATING BUBBLE
   ════════════════════════════════════════════════════════════════ */

.rag-chatbot-bubble {
    width:  var(--rag-bubble-size);
    height: var(--rag-bubble-size);
    border-radius: 18px;
    background: var(--rag-bubble-bg);
    color: #fff;
    border: 1px solid var(--rag-bubble-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--rag-bubble-shadow);
    transition: transform var(--t-spring), box-shadow var(--t-fast), border-color var(--t-fast);
    position: relative;
    overflow: visible;
}

.rag-chatbot-bubble::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 24px;
    background: linear-gradient(145deg, var(--glow-violet), var(--glow-cyan));
    filter: blur(14px);
    opacity: 0;
    transition: opacity .3s var(--ease-out);
    z-index: -1;
    pointer-events: none;
}

.rag-chatbot-bubble:hover {
    transform: scale(1.08) translateY(-3px);
    border-color: rgba(124, 58, 237, 0.6);
    box-shadow:
        0 16px 48px rgba(124, 58, 237, 0.4),
        0 4px 16px rgba(15, 12, 35, 0.14);
}
.rag-chatbot-bubble:hover::before { opacity: 1; }
.rag-chatbot-bubble:active { transform: scale(.93) translateY(0); }

.rag-chatbot-bubble:not(.is-open)::after {
    content: '';
    position: absolute;
    inset: -9px;
    border-radius: 27px;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(124, 58, 237, 0.7) 50deg,
        rgba(6, 182, 212, 0.5) 110deg,
        rgba(244, 114, 182, 0.35) 180deg,
        transparent 230deg,
        transparent 360deg
    );
    animation: rag-orbit 5s linear infinite;
    pointer-events: none;
    mask:        radial-gradient(circle at center, transparent 60%, black 63%, black 70%, transparent 73%);
    -webkit-mask:radial-gradient(circle at center, transparent 60%, black 63%, black 70%, transparent 73%);
}
@keyframes rag-orbit {
    to { transform: rotate(360deg); }
}

.rag-bubble-notif {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #F472B6, #EC4899);
    border-radius: 50%;
    border: 2px solid var(--rag-notif-border);
    z-index: 2;
}
.rag-bubble-notif::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: rgba(244, 114, 182, 0.35);
    animation: rag-notif-ripple 2.2s ease-out infinite;
}
@keyframes rag-notif-ripple {
    0%   { transform: scale(1); opacity: .7; }
    100% { transform: scale(2.4); opacity: 0; }
}

.rag-chatbot-bubble-icon,
.rag-chatbot-bubble-close {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .22s var(--ease-out), transform .3s var(--ease-spring);
}
.rag-chatbot-bubble-close {
    opacity: 0;
    transform: rotate(-90deg) scale(.65);
}
.rag-chatbot-bubble.is-open .rag-chatbot-bubble-icon {
    opacity: 0;
    transform: rotate(90deg) scale(.65);
}
.rag-chatbot-bubble.is-open .rag-chatbot-bubble-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* ════════════════════════════════════════════════════════════════
   CHAT WINDOW
   ════════════════════════════════════════════════════════════════ */

.rag-chatbot-window {
    width: var(--rag-width);
    height: var(--rag-height);
    background:
        radial-gradient(ellipse at 18% 2%,  rgba(124, 58, 237, 0.08) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 95%, rgba(6, 182, 212, 0.05)  0%, transparent 55%),
        var(--rag-void);
    border-radius: var(--rag-radius);
    box-shadow: var(--rag-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--rag-glass-border);
    position: relative;
}

.rag-chatbot-window::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
    background-size: 150px;
    opacity: calc(var(--rag-noise-opacity) / 0.035);
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
}

.rag-chatbot-floating .rag-chatbot-window {
    position: fixed;
    bottom: calc(var(--rag-bottom-offset) + var(--rag-bubble-size) + 14px);
    opacity: 0;
    transform: translateY(24px) scale(.9);
    pointer-events: none;
    transition:
        opacity  .32s var(--ease-out),
        transform .42s var(--ease-spring);
    transform-origin: bottom right;
}
.rag-chatbot-pos-bottom-right .rag-chatbot-window { right: var(--rag-side-offset); }
.rag-chatbot-pos-bottom-left  .rag-chatbot-window { left:  var(--rag-side-offset); transform-origin: bottom left; }

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

/* ════════════════════════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════════════════════════ */

.rag-chatbot-header {
    background: var(--rag-header-bg);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    color: var(--rag-header-text);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.rag-chatbot-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--rag-separator);
}

.rag-chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
    min-width: 0;
}

.rag-chatbot-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.18), rgba(6, 182, 212, 0.12));
    border-radius: 12px;
    border: 1px solid rgba(124, 58, 237, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    color: var(--rag-primary);
    box-shadow: 0 0 16px rgba(124, 58, 237, 0.12);
}
.rag-chatbot-avatar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
}

.rag-chatbot-name {
    display: block;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.25;
    letter-spacing: -.025em;
    color: var(--rag-header-text);
}

.rag-chatbot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    color: var(--rag-header-muted);
    font-weight: 400;
    margin-top: 3px;
    letter-spacing: .025em;
    text-transform: uppercase;
}
.rag-chatbot-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #22C55E;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
    animation: rag-status-pulse 2.5s ease infinite;
}
@keyframes rag-status-pulse {
    0%   { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0.45); }
    70%  { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0); }
}

.rag-chatbot-close-btn {
    background: var(--rag-close-bg);
    border: 1px solid var(--rag-close-border);
    color: var(--rag-close-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-fast);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}
.rag-chatbot-close-btn:hover {
    background: var(--rag-close-hover-bg);
    border-color: var(--rag-close-border);
    color: var(--rag-close-hover-color);
    transform: scale(1.06);
}

/* ════════════════════════════════════════════════════════════════
   MESSAGES
   ════════════════════════════════════════════════════════════════ */

.rag-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    position: relative;
    z-index: 1;
}
.rag-chatbot-messages::-webkit-scrollbar       { width: 3px; }
.rag-chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.rag-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.28);
    border-radius: 4px;
}

.rag-msg {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    animation: rag-msg-in .32s var(--ease-spring) both;
}
@keyframes rag-msg-in {
    from { opacity: 0; transform: translateY(14px) scale(.94); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.rag-msg--user { align-self: flex-end;   align-items: flex-end; }
.rag-msg--bot  { align-self: flex-start; align-items: flex-start; }

.rag-msg__bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: var(--rag-font-size);
    line-height: 1.65;
    word-break: break-word;
    white-space: pre-wrap;
}

.rag-msg--user .rag-msg__bubble {
    background: linear-gradient(135deg, #7C3AED 0%, #2563EB 100%);
    color: #fff;
    border-bottom-right-radius: 5px;
    border: 1px solid rgba(124, 58, 237, 0.25);
    box-shadow:
        0 4px 16px rgba(124, 58, 237, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.rag-msg--bot .rag-msg__bubble {
    background: var(--rag-bot-bg);
    color: var(--rag-bot-text);
    border-bottom-left-radius: 5px;
    border: 1px solid var(--rag-bot-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--rag-bot-shadow);
}

.rag-msg--bot .rag-list-item {
    display: block;
    padding-left: 4px;
    margin-top: 4px;
    color: var(--rag-list-color);
}

.rag-msg__sources {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.rag-msg__source-chip {
    font-size: 10px;
    padding: 4px 10px;
    background: var(--rag-source-bg);
    color: var(--rag-source-color);
    border-radius: 20px;
    border: 1px solid var(--rag-source-border);
    cursor: default;
    font-weight: 500;
    letter-spacing: .01em;
    transition: background var(--t-fast);
}
.rag-msg__source-chip:hover {
    background: rgba(124, 58, 237, 0.16);
}

.rag-typing .rag-msg__bubble {
    background: var(--rag-bot-bg);
    border: 1px solid var(--rag-bot-border);
    padding: 14px 18px;
    display: flex;
    gap: 5px;
    align-items: center;
}
.rag-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7C3AED, #06B6D4);
    animation: rag-dot-wave .95s ease infinite;
    flex-shrink: 0;
}
.rag-typing-dot:nth-child(2) { animation-delay: .15s; }
.rag-typing-dot:nth-child(3) { animation-delay: .30s; }
@keyframes rag-dot-wave {
    0%, 60%, 100% { transform: translateY(0);   opacity: .35; }
    30%            { transform: translateY(-6px); opacity: 1; }
}

/* ════════════════════════════════════════════════════════════════
   QUICK ACTIONS
   ════════════════════════════════════════════════════════════════ */

.rag-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 16px 14px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.rag-quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 20px;
    background: var(--rag-qa-bg);
    border: 1px solid var(--rag-qa-border);
    color: var(--rag-qa-color);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--t-fast);
    white-space: nowrap;
    backdrop-filter: blur(8px);
    letter-spacing: .01em;
}
.rag-quick-action-btn:hover {
    background: var(--rag-qa-hover-bg);
    border-color: var(--rag-qa-hover-border);
    color: var(--rag-qa-hover-color);
    box-shadow: 0 0 18px rgba(124, 58, 237, 0.12);
    transform: translateY(-1px);
}
.rag-quick-action-btn--pricing {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.28);
    color: #6d28d9;
    font-weight: 600;
}
.rag-quick-action-btn--pricing:hover {
    background: rgba(124, 58, 237, 0.14);
    border-color: rgba(124, 58, 237, 0.45);
    box-shadow: 0 0 22px rgba(124, 58, 237, 0.18);
}

/* ════════════════════════════════════════════════════════════════
   CONTACT STRIP
   ════════════════════════════════════════════════════════════════ */

.rag-contact-strip {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    background: var(--rag-contact-bg);
    border-top: 1px solid var(--rag-contact-border);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.rag-contact-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 6px;
    border-radius: 11px;
    background: var(--rag-contact-btn-bg);
    border: 1px solid var(--rag-contact-btn-border);
    cursor: pointer;
    text-decoration: none;
    color: var(--rag-contact-btn-color);
    font-size: 10.5px;
    font-weight: 600;
    font-family: inherit;
    transition: all var(--t-fast);
    letter-spacing: .025em;
    text-transform: uppercase;
    min-width: 0;
}
.rag-contact-btn:hover { transform: translateY(-2px); }

.rag-contact-btn--phone:hover {
    background: rgba(124, 58, 237, 0.1);
    border-color: rgba(124, 58, 237, 0.28);
    color: #6d28d9;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.14);
}
.rag-contact-btn--whatsapp {
    background: rgba(37, 211, 102, 0.08);
    border-color: rgba(37, 211, 102, 0.2);
    color: #16a34a;
}
.rag-contact-btn--whatsapp:hover {
    background: rgba(37, 211, 102, 0.14);
    border-color: rgba(37, 211, 102, 0.36);
    color: #15803d;
    box-shadow: 0 4px 18px rgba(37, 211, 102, 0.16);
}
.rag-contact-btn--facebook {
    background: rgba(24, 119, 242, 0.08);
    border-color: rgba(24, 119, 242, 0.2);
    color: #2563eb;
}
.rag-contact-btn--facebook:hover {
    background: rgba(24, 119, 242, 0.14);
    border-color: rgba(24, 119, 242, 0.36);
    color: #1d4ed8;
    box-shadow: 0 4px 18px rgba(24, 119, 242, 0.16);
}
.rag-contact-btn--email:hover {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.28);
    color: #b45309;
    box-shadow: 0 4px 14px rgba(251, 191, 36, 0.14);
}

/* ════════════════════════════════════════════════════════════════
   INPUT AREA
   ════════════════════════════════════════════════════════════════ */

.rag-chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--rag-border);
    background: var(--rag-input-area-bg);
    backdrop-filter: blur(12px);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.rag-chatbot-input {
    flex: 1;
    resize: none;
    border: 1px solid var(--rag-input-border);
    border-radius: 14px;
    padding: 11px 14px;
    font-size: var(--rag-font-size);
    font-family: inherit;
    background: var(--rag-input-bg);
    color: var(--rag-input-color);
    outline: none;
    max-height: 110px;
    min-height: 42px;
    overflow-y: auto;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
    line-height: 1.45;
    caret-color: var(--rag-caret);
}
.rag-chatbot-input::placeholder { color: var(--rag-input-placeholder); }
.rag-chatbot-input:focus {
    border-color: rgba(124, 58, 237, 0.45);
    box-shadow:
        0 0 0 3px rgba(124, 58, 237, 0.1),
        inset 0 0 0 1px rgba(124, 58, 237, 0.06);
    background: var(--rag-input-focus-bg);
}
.rag-chatbot-input::-webkit-scrollbar       { width: 3px; }
.rag-chatbot-input::-webkit-scrollbar-thumb { background: rgba(124, 58, 237, 0.28); border-radius: 3px; }

.rag-chatbot-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: linear-gradient(135deg, #7C3AED, #2563EB);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: center;
    transition: all var(--t-spring);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.32);
    position: relative;
    overflow: hidden;
}
.rag-chatbot-send-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), transparent 55%);
    opacity: .6;
}
.rag-chatbot-send-btn:hover:not(:disabled) {
    transform: scale(1.08) translateY(-1px);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.42);
}
.rag-chatbot-send-btn:active:not(:disabled) { transform: scale(.93); }
.rag-chatbot-send-btn:disabled {
    opacity: .3;
    cursor: default;
    box-shadow: none;
}

/* ════════════════════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════════════════════ */

.rag-chatbot-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px 14px;
    background: var(--rag-footer-bg);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.rag-chatbot-clear-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--rag-clear-color);
    font-size: 11px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    transition: all var(--t-fast);
    font-family: inherit;
    letter-spacing: .02em;
}
.rag-chatbot-clear-btn:hover {
    color: rgba(220, 38, 38, 0.85);
    background: rgba(239, 68, 68, 0.08);
}

.rag-chatbot-powered {
    font-size: 10px;
    color: var(--rag-powered-color);
    letter-spacing: .05em;
    font-weight: 500;
    text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════════════
   PRICING CARDS IN CHAT
   ════════════════════════════════════════════════════════════════ */

.rag-pricing-msg            { align-self: stretch !important; max-width: 100% !important; }
.rag-pricing-msg .rag-msg__bubble {
    width: 100%;
    background: var(--rag-bot-bg);
    border-color: var(--rag-bot-border);
}

.rag-pricing-intro {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 12px;
    color: var(--rag-pricing-intro);
    letter-spacing: -.015em;
}

.rag-pricing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.rag-pricing-card {
    background: var(--rag-pricing-card-bg);
    border: 1px solid var(--rag-border);
    border-radius: 12px;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: all var(--t-fast);
}
.rag-pricing-card:hover {
    border-color: rgba(124, 58, 237, 0.35);
    background: rgba(124, 58, 237, 0.05);
    box-shadow: 0 4px 18px rgba(124, 58, 237, 0.1);
}
.rag-pricing-card--featured {
    border-color: rgba(124, 58, 237, 0.32);
    background: rgba(124, 58, 237, 0.06);
}

.rag-pricing-card__badge {
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #7C3AED, #2563EB);
    border-radius: 10px;
    padding: 2px 7px;
    display: inline-block;
    margin-bottom: 3px;
    width: fit-content;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.rag-pricing-card__name {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: var(--rag-pricing-name);
}
.rag-pricing-card__price {
    font-family: 'Syne', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #7C3AED;
    line-height: 1.2;
}
.rag-pricing-card__desc  { font-size: 10px; color: var(--rag-pricing-desc); line-height: 1.35; }

.rag-pricing-card__features {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.rag-pricing-card__features li {
    font-size: 10px;
    color: var(--rag-pricing-feature);
    display: flex;
    align-items: flex-start;
    gap: 4px;
    line-height: 1.35;
}
.rag-pricing-card__features li::before {
    content: '✓';
    color: #22C55E;
    font-weight: 700;
    font-size: 9px;
    flex-shrink: 0;
    margin-top: 1px;
}

.rag-pricing-card__cta {
    width: 100%;
    margin-top: 10px;
    padding: 8px 6px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.85), rgba(37, 99, 235, 0.85));
    color: #fff;
    border: 1px solid rgba(124, 58, 237, 0.25);
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--t-fast);
    letter-spacing: .025em;
}
.rag-pricing-card__cta:hover {
    background: linear-gradient(135deg, #7C3AED, #2563EB);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.32);
    transform: translateY(-1px);
}

/* ════════════════════════════════════════════════════════════════
   MISC
   ════════════════════════════════════════════════════════════════ */

.rag-chatbot-notice {
    padding: 14px 18px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.28);
    border-radius: 10px;
    color: #92400e;
    font-size: 13px;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .rag-chatbot-floating {
        bottom: 0 !important;
        right:  0 !important;
        left:   0 !important;
    }
    .rag-chatbot-pos-bottom-right,
    .rag-chatbot-pos-bottom-left { right: auto; left: auto; }

    .rag-chatbot-floating .rag-chatbot-window {
        width:  100vw !important;
        height: 82vh !important;
        border-radius: var(--rag-radius) var(--rag-radius) 0 0;
        bottom: calc(var(--rag-bubble-size) + 20px + 16px) !important;
        right:  auto !important;
        left:   0 !important;
        transform-origin: bottom center !important;
    }
    .rag-chatbot-bubble { margin: 0 16px 16px; }
    .rag-chatbot-messages { padding: 18px 14px; gap: 12px; }
    .rag-chatbot-header { padding: 14px 16px; }
    .rag-chatbot-input-area { padding: 12px 14px; }
    .rag-chatbot-footer { padding: 8px 14px 16px; }
    .rag-msg { max-width: 88%; }
}
