﻿/* ══════════════════════════════════════════════════════════════
   EngineOS Live Chat Widget — Dribbble-style Floating Chat Widget
   Rebuilt to match "Floating Chat Widget" by Aryabh (Dribbble shot
   21652548). One cohesive floating panel: gradient header, bot
   greeting bubble, primary CTA + quick-option tiles, channel pills,
   search composer, and a conversation window with pill composer.

   The root element is created with id="eos-chat-widget" and the
   dedicated class alias .chat-support-widget is applied on the same
   element. Every selector is prefixed with the unique #eos-chat-widget
   id so that reset blocks and the host page's global CSS can never
   override the widget's own spacing/typography (specificity > any
   page-wide class/type selector). Nothing leaks in or out.
   ══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────── 1. Root & Design Tokens ─────────────────────────────── */

#eos-chat-widget,
.chat-support-widget {
    all: initial;
    position: fixed;
    z-index: 99999;
    display: block;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 13.5px;
    line-height: 1.5;
    color: #0f172a;
    direction: ltr;
    text-align: left;
    box-sizing: border-box;
    overscroll-behavior: contain;
    -webkit-font-smoothing: antialiased;
    isolation: isolate;

    /* Brand — runtime-configurable accent & gradient (set inline by JS) */
    --eos-chat-color: #1a1a2e;
    --eos-chat-accent: #2563eb;
    --eos-chat-home-grad: linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%);

    /* Surfaces */
    --eos-white:   #ffffff;
    --eos-page:    #f8fafc;
    --eos-fill:    #f1f5f9;
    --eos-fill-2:  #e6edf5;
    --eos-line:    #e3e8ef;
    --eos-line-2:  #d6dee9;

    /* Text */
    --eos-ink:     #0f172a;
    --eos-ink-2:   #334155;
    --eos-muted:   #64748b;
    --eos-muted-2: #94a3b8;

    /* Status / accents */
    --eos-online: #34d399;
    --eos-danger: #ef4444;
    --eos-danger-bg: #fef2f2;
    --eos-danger-line: #fecaca;

    /* Option tiles */
    --eos-contact-c: #059669;  --eos-contact-bg: #ecfdf5;
    --eos-faq-c:     #4f46e5;  --eos-faq-bg:     #eef2ff;
    --eos-chat-c:    #4f46e5;  --eos-chat-bg:    #eef2ff;

    /* Channels */
    --eos-wa-c: #1ebe5d;
    --eos-fb-c: #1877f2;

    /* Radii */
    --eos-radius-panel: 20px;
    --eos-radius-lg: 14px;
    --eos-radius-md: 12px;
    --eos-radius-bubble: 16px;
    --eos-radius-tile: 12px;
    --eos-radius-pill: 999px;
    --eos-radius-full: 50%;

    /* Focus */
    --eos-ring: rgba(43, 79, 255, 0.22);

    /* Elevation */
    --eos-shadow-launcher: 0 12px 26px -6px rgba(2, 6, 23, 0.45);
    --eos-shadow-panel: 0 24px 60px -12px rgba(15, 23, 42, 0.30),
                        0 12px 26px -16px rgba(15, 23, 42, 0.22),
                        0 0 0 1px rgba(15, 23, 42, 0.05);
    --eos-shadow-tile: 0 1px 2px rgba(15, 23, 42, 0.05);
}

/* Global-ish resets, kept as low-leverage as possible; component rules
   are id-prefixed (#eos-chat-widget …) so they always win over these. */
#eos-chat-widget *,
#eos-chat-widget *::before,
#eos-chat-widget *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#eos-chat-widget button,
#eos-chat-widget textarea,
#eos-chat-widget input {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

#eos-chat-widget button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#eos-chat-widget button:focus-visible,
#eos-chat-widget input:focus-visible,
#eos-chat-widget textarea:focus-visible {
    outline: 2px solid var(--eos-chat-accent, #2563eb);
    outline-offset: 2px;
}

#eos-chat-widget.bottom-right { bottom: 58px; right: 18px; }
#eos-chat-widget.bottom-left  { bottom: 58px; left: 18px; }

/* ─────────────────────────────── 2. Shared Floating Panel ─────────────────────────────── */

#eos-chat-widget .eos-chat-home,
#eos-chat-widget .eos-chat-window {
    position: absolute;
    bottom: 78px;
    right: 0;
    width: 372px;
    max-width: calc(100vw - 32px);
    background: var(--eos-white);
    border-radius: var(--eos-radius-panel);
    box-shadow: var(--eos-shadow-panel);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0s linear 0.24s;
    visibility: hidden;
    pointer-events: none;
    z-index: 2;
}

#eos-chat-widget .eos-chat-home.show,
#eos-chat-widget .eos-chat-window.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

#eos-chat-widget.bottom-left .eos-chat-home,
#eos-chat-widget.bottom-left .eos-chat-window {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

#eos-chat-widget .eos-chat-home {
    height: auto;
    max-height: calc(100vh - 110px);
}

#eos-chat-widget .eos-chat-window {
    height: 600px;
    max-height: calc(100vh - 110px);
}

/* ─────────────────────────────── 3. Header (shared) ─────────────────────────────── */

#eos-chat-widget .eos-chat-home-head,
#eos-chat-widget .eos-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px;
    background: var(--eos-chat-home-grad, linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%));
    color: var(--eos-white);
    border-radius: var(--eos-radius-panel) var(--eos-radius-panel) 0 0;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

#eos-chat-widget .eos-chat-home-avatar,
#eos-chat-widget .eos-chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--eos-radius-full);
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#eos-chat-widget .eos-chat-home-avatar svg,
#eos-chat-widget .eos-chat-header-avatar svg {
    width: 20px;
    height: 20px;
    color: var(--eos-white);
}

#eos-chat-widget .eos-chat-home-info,
#eos-chat-widget .eos-chat-header-info {
    flex: 1;
    min-width: 0;
}

#eos-chat-widget .eos-chat-home-title,
#eos-chat-widget .eos-chat-header-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--eos-white);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#eos-chat-widget .eos-chat-home-status,
#eos-chat-widget .eos-chat-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.86);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#eos-chat-widget .eos-chat-status-dot,
#eos-chat-widget .eos-chat-header-status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--eos-radius-full);
    background: var(--eos-online);
    box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.22);
    flex-shrink: 0;
    display: block;
}

#eos-chat-widget .eos-chat-home-close,
#eos-chat-widget .eos-chat-header-close,
#eos-chat-widget .eos-chat-header-back {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--eos-radius-full);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    color: var(--eos-white);
    flex-shrink: 0;
    transition: background 0.15s, transform 0.15s;
    pointer-events: auto;
}

#eos-chat-widget .eos-chat-home-close:hover,
#eos-chat-widget .eos-chat-header-close:hover,
#eos-chat-widget .eos-chat-header-back:hover { background: rgba(255, 255, 255, 0.3); }

#eos-chat-widget .eos-chat-home-close:active,
#eos-chat-widget .eos-chat-header-close:active,
#eos-chat-widget .eos-chat-header-back:active { transform: scale(0.9); }

#eos-chat-widget .eos-chat-home-close svg,
#eos-chat-widget .eos-chat-header-close svg,
#eos-chat-widget .eos-chat-header-back svg { width: 14px; height: 14px; color: var(--eos-white); }

#eos-chat-widget .eos-chat-home-close:focus-visible,
#eos-chat-widget .eos-chat-header-close:focus-visible,
#eos-chat-widget .eos-chat-header-back:focus-visible,
#eos-chat-widget .eos-chat-launcher:focus-visible,
#eos-chat-widget .eos-chat-home-cta:focus-visible,
#eos-chat-widget .eos-chat-home-send:focus-visible,
#eos-chat-widget .eos-chat-send:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.9);
    outline-offset: 2px;
}

/* ─────────────────────────────── 4. Welcome / Home Panel ─────────────────────────────── */

#eos-chat-widget .eos-chat-home-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--eos-line-2) transparent;
}

#eos-chat-widget .eos-chat-home-body::-webkit-scrollbar { width: 5px; }
#eos-chat-widget .eos-chat-home-body::-webkit-scrollbar-track { background: transparent; }
#eos-chat-widget .eos-chat-home-body::-webkit-scrollbar-thumb {
    background: var(--eos-line-2);
    border-radius: 3px;
}

/* Bot greeting bubble */
#eos-chat-widget .eos-chat-home-welcome {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding-top: 2px;
}

#eos-chat-widget .eos-chat-home-welcome-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--eos-radius-full);
    background: var(--eos-chat-home-grad, #1a1a2e);
    color: var(--eos-white);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#eos-chat-widget .eos-chat-home-welcome-avatar svg { width: 15px; height: 15px; color: var(--eos-white); }

#eos-chat-widget .eos-chat-home-welcome-bubble {
    background: var(--eos-fill);
    color: var(--eos-ink-2);
    font-size: 13px;
    line-height: 1.5;
    padding: 9px 13px;
    border-radius: var(--eos-radius-bubble) var(--eos-radius-bubble) var(--eos-radius-bubble) 4px;
    max-width: 86%;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Primary CTA — gradient filled tile */
#eos-chat-widget .eos-chat-home-cta {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: var(--eos-radius-lg);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    color: var(--eos-white);
    background: var(--eos-chat-home-grad, linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%));
    font-size: 14px;
    font-weight: 650;
    letter-spacing: 0.01em;
    text-align: left;
    box-shadow: 0 10px 18px -8px rgba(2, 6, 23, 0.5);
    transition: filter 0.15s ease, transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
}

#eos-chat-widget .eos-chat-home-cta svg { width: 18px; height: 18px; color: inherit; flex-shrink: 0; }
#eos-chat-widget .eos-chat-home-cta svg:last-child { margin-left: auto; }

#eos-chat-widget .eos-chat-home-cta:hover { filter: brightness(1.08); }
#eos-chat-widget .eos-chat-home-cta:active { transform: scale(0.98); }

/* Quick-option tiles */
#eos-chat-widget .eos-chat-home-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#eos-chat-widget .eos-chat-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--eos-line);
    border-radius: var(--eos-radius-tile);
    background: var(--eos-white);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    text-align: left;
    color: inherit;
    box-shadow: var(--eos-shadow-tile);
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
    pointer-events: auto;
}

#eos-chat-widget .eos-chat-option:hover {
    border-color: var(--eos-line-2);
    background: #fbfdff;
    transform: translateY(-1px);
}

#eos-chat-widget .eos-chat-option:active { transform: scale(0.99); }

#eos-chat-widget .eos-chat-option > svg {
    width: 16px;
    height: 16px;
    color: var(--eos-muted-2);
    flex-shrink: 0;
    transition: color 0.15s ease;
}

#eos-chat-widget .eos-chat-option:hover > svg { color: var(--eos-muted); }

#eos-chat-widget .eos-chat-option-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--eos-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#eos-chat-widget .eos-chat-option-icon svg { width: 18px; height: 18px; }

#eos-chat-widget .eos-chat-option-icon--contact { color: var(--eos-contact-c); background: var(--eos-contact-bg); }
#eos-chat-widget .eos-chat-option-icon--faq     { color: var(--eos-faq-c);     background: var(--eos-faq-bg); }

#eos-chat-widget .eos-chat-option-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

#eos-chat-widget .eos-chat-option-title {
    font-size: 13.5px;
    font-weight: 650;
    letter-spacing: -0.005em;
    color: var(--eos-ink);
    line-height: 1.3;
}

#eos-chat-widget .eos-chat-option-desc {
    font-size: 12px;
    color: var(--eos-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Channel pills */
#eos-chat-widget .eos-chat-home-channels {
    display: flex;
    gap: 8px;
}

#eos-chat-widget .eos-chat-channel-btn {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 10px;
    border: 1px solid var(--eos-line);
    border-radius: var(--eos-radius-pill);
    background: var(--eos-fill);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    color: var(--eos-ink-2);
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
    pointer-events: auto;
}

#eos-chat-widget .eos-chat-channel-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

#eos-chat-widget .eos-chat-channel-btn[data-channel="native"] svg   { color: var(--eos-chat-c); }
#eos-chat-widget .eos-chat-channel-btn[data-channel="whatsapp"] svg { color: var(--eos-wa-c); }
#eos-chat-widget .eos-chat-channel-btn[data-channel="facebook"] svg { color: var(--eos-fb-c); }

#eos-chat-widget .eos-chat-channel-btn:hover {
    background: var(--eos-white);
    border-color: var(--eos-line-2);
    transform: translateY(-1px);
}

#eos-chat-widget .eos-chat-channel-btn:active { transform: scale(0.96); }

#eos-chat-widget .eos-chat-channel-btn:focus-visible {
    outline: 2px solid var(--eos-chat-accent, #2563eb);
    outline-offset: 1px;
}

/* Search composer */
#eos-chat-widget .eos-chat-home-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 5px 5px 14px;
    background: var(--eos-fill);
    border: 1px solid var(--eos-line);
    border-radius: var(--eos-radius-pill);
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

#eos-chat-widget .eos-chat-home-search:focus-within {
    border-color: var(--eos-chat-accent, #2563eb);
    background: var(--eos-white);
    box-shadow: 0 0 0 3px var(--eos-ring);
}

#eos-chat-widget .eos-chat-home-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--eos-ink);
    outline: none;
    padding: 9px 0;
    appearance: none;
    -webkit-appearance: none;
    display: block;
}

#eos-chat-widget .eos-chat-home-input::placeholder { color: var(--eos-muted-2); }
#eos-chat-widget .eos-chat-home-input:focus { outline: none; }

#eos-chat-widget .eos-chat-home-send {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: var(--eos-radius-full);
    appearance: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--eos-chat-home-grad, #1a1a2e);
    color: var(--eos-white);
    flex-shrink: 0;
    transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.15s ease;
    pointer-events: auto;
}

#eos-chat-widget .eos-chat-home-send:hover { filter: brightness(1.08); }
#eos-chat-widget .eos-chat-home-send:active { transform: scale(0.9); }
#eos-chat-widget .eos-chat-home-send svg { width: 15px; height: 15px; color: var(--eos-white); }

/* ─────────────────────────────── 5. Conversation Window ─────────────────────────────── */

#eos-chat-widget .eos-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--eos-page);
    scrollbar-width: thin;
    scrollbar-color: var(--eos-line-2) transparent;
    scroll-behavior: smooth;
}

#eos-chat-widget .eos-chat-messages::-webkit-scrollbar { width: 5px; }
#eos-chat-widget .eos-chat-messages::-webkit-scrollbar-track { background: transparent; }
#eos-chat-widget .eos-chat-messages::-webkit-scrollbar-thumb {
    background: var(--eos-line-2);
    border-radius: 3px;
}

#eos-chat-widget .eos-chat-empty {
    display: none;
    margin: auto;
    padding: 16px 0;
    max-width: 230px;
    color: var(--eos-muted-2);
    font-size: 13px;
    text-align: center;
    line-height: 1.55;
}

#eos-chat-widget .eos-chat-empty.show { display: block; }

/* Date divider */
#eos-chat-widget .eos-chat-date {
    align-self: center;
    margin: 2px 0 4px;
}

#eos-chat-widget .eos-chat-date span {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--eos-muted-2);
    background: #eef1f6;
    border-radius: var(--eos-radius-pill);
    padding: 4px 11px;
}

/* Message rows */
#eos-chat-widget .eos-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 84%;
    min-width: 0;
    animation: eosMsgSlide 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes eosMsgSlide {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

#eos-chat-widget .eos-msg--customer { align-self: flex-end; flex-direction: row-reverse; }
#eos-chat-widget .eos-msg--agent    { align-self: flex-start; }
#eos-chat-widget .eos-msg--system   { align-self: center; max-width: 90%; animation: none; }

#eos-chat-widget .eos-msg-avatar {
    width: 26px;
    height: 26px;
    border-radius: var(--eos-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: var(--eos-white);
    background: #1a1a2e;
    flex-shrink: 0;
}

#eos-chat-widget .eos-msg-content { min-width: 0; max-width: 100%; }

#eos-chat-widget .eos-msg-whos {
    font-size: 11px;
    font-weight: 600;
    color: var(--eos-muted);
    margin: 0 2px 3px;
    letter-spacing: 0.01em;
}

#eos-chat-widget .eos-msg-bubble {
    padding: 8px 12px;
    border-radius: var(--eos-radius-bubble);
    font-size: 13.5px;
    line-height: 1.5;
    color: inherit;
    word-break: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
    max-width: 100%;
}

#eos-chat-widget .eos-msg--customer .eos-msg-bubble {
    background: var(--eos-chat-home-grad, linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%));
    color: var(--eos-white);
    border-radius: var(--eos-radius-bubble) var(--eos-radius-bubble) 4px var(--eos-radius-bubble);
    box-shadow: 0 2px 6px -2px rgba(2, 6, 23, 0.28);
}

#eos-chat-widget .eos-msg--agent .eos-msg-bubble {
    background: var(--eos-fill);
    color: var(--eos-ink-2);
    border-radius: var(--eos-radius-bubble) var(--eos-radius-bubble) var(--eos-radius-bubble) 4px;
}

#eos-chat-widget .eos-msg--system .eos-msg-bubble {
    background: transparent;
    color: var(--eos-muted);
    font-size: 11.5px;
    text-align: center;
    border-radius: var(--eos-radius-pill);
    padding: 4px 10px;
}

#eos-chat-widget .eos-msg-time {
    font-size: 10.5px;
    color: var(--eos-muted-2);
    margin-top: 3px;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 3px;
    max-width: 100%;
    overflow-wrap: anywhere;
}

#eos-chat-widget .eos-msg--customer .eos-msg-time { justify-content: flex-end; }
#eos-chat-widget .eos-msg--agent .eos-msg-time   { justify-content: flex-start; }

#eos-chat-widget .eos-chat-tick {
    display: inline-flex;
    align-items: center;
    color: var(--eos-muted-2);
    line-height: 0;
}

#eos-chat-widget .eos-msg--customer .eos-chat-tick svg { color: rgba(255, 255, 255, 0.75); }

/* Pending (sending) bubble */
#eos-chat-widget .eos-msg--pending {
    align-self: flex-end;
    animation: none;
}

#eos-chat-widget .eos-msg--pending .eos-msg-bubble {
    background: var(--eos-chat-home-grad, #1a1a2e);
    border-radius: var(--eos-radius-bubble) var(--eos-radius-bubble) 4px var(--eos-radius-bubble);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

#eos-chat-widget .eos-msg--pending .eos-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--eos-radius-full);
    background: var(--eos-white);
    opacity: 0.9;
    animation: eosTyping 1.2s ease-in-out infinite;
}

#eos-chat-widget .eos-msg--pending .eos-typing-dot:nth-child(2) { animation-delay: 0.15s; }
#eos-chat-widget .eos-msg--pending .eos-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes eosTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-3px); opacity: 1; }
}

/* ─────────────────────────────── 6. Composer ─────────────────────────────── */

#eos-chat-widget .eos-chat-composer {
    padding: 10px 14px 14px;
    border-top: 1px solid #eef1f6;
    background: var(--eos-white);
    flex-shrink: 0;
}

#eos-chat-widget .eos-chat-composer--busy {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

#eos-chat-widget .eos-chat-error {
    display: none;
    font-size: 12px;
    line-height: 1.4;
    color: var(--eos-danger);
    background: var(--eos-danger-bg);
    border: 1px solid var(--eos-danger-line);
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 8px;
}

#eos-chat-widget .eos-chat-error.show { display: block; }

#eos-chat-widget .eos-chat-composer-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--eos-fill);
    border: 1px solid var(--eos-line);
    border-radius: var(--eos-radius-pill);
    padding: 5px 5px 5px 14px;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    min-width: 0;
}

#eos-chat-widget .eos-chat-composer-wrap:focus-within {
    border-color: var(--eos-chat-accent, #2563eb);
    background: var(--eos-white);
    box-shadow: 0 0 0 3px var(--eos-ring);
}

#eos-chat-widget .eos-chat-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--eos-ink);
    outline: none;
    resize: none;
    overflow-y: auto;
    padding: 9px 0;
    max-height: 96px;
    scrollbar-width: thin;
    appearance: none;
    -webkit-appearance: none;
    display: block;
}

#eos-chat-widget .eos-chat-input::placeholder { color: var(--eos-muted-2); }
#eos-chat-widget .eos-chat-input:focus { outline: none; }

#eos-chat-widget .eos-chat-send {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--eos-radius-full);
    appearance: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--eos-chat-home-grad, linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%));
    color: var(--eos-white);
    flex-shrink: 0;
    transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.15s ease,
                filter 0.15s ease;
    pointer-events: auto;
}

#eos-chat-widget .eos-chat-send:hover:not(:disabled) { filter: brightness(1.08); }
#eos-chat-widget .eos-chat-send:active:not(:disabled) { transform: scale(0.9); transition-duration: 0.06s; }
#eos-chat-widget .eos-chat-send:disabled { opacity: 0.3; cursor: not-allowed; }
#eos-chat-widget .eos-chat-send:disabled:hover { transform: none; }

#eos-chat-widget .eos-chat-send svg { width: 16px; height: 16px; color: var(--eos-white); }

#eos-chat-widget .eos-chat-send .eos-send-spinner {
    display: none;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: var(--eos-white);
    border-radius: var(--eos-radius-full);
    animation: eosSpin 0.6s linear infinite;
}

#eos-chat-widget .eos-chat-send.sending .eos-send-icon { display: none; }
#eos-chat-widget .eos-chat-send.sending .eos-send-spinner { display: block; }

@keyframes eosSpin {
    to { transform: rotate(360deg); }
}

/* ─────────────────────────────── 7. Floating Launcher ─────────────────────────────── */

#eos-chat-widget .eos-chat-launcher {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: var(--eos-radius-full);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--eos-chat-home-grad, linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%));
    color: var(--eos-white);
    box-shadow: var(--eos-shadow-launcher);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease;
    pointer-events: auto;
    will-change: transform;
}

#eos-chat-widget .eos-chat-launcher:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 16px 32px -8px rgba(2, 6, 23, 0.5);
}

#eos-chat-widget .eos-chat-launcher:active {
    transform: scale(0.93);
    transition-duration: 0.06s;
}

#eos-chat-widget .eos-chat-launcher svg {
    width: 24px;
    height: 24px;
    color: var(--eos-white);
    transition: transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.16s ease;
}

#eos-chat-widget .eos-chat-launcher .eos-chat-close { display: none; }
#eos-chat-widget .eos-chat-launcher.eos-open .eos-chat-icon { display: none; }
#eos-chat-widget .eos-chat-launcher.eos-open .eos-chat-close {
    display: block;
    transform: rotate(90deg);
}

#eos-chat-widget .eos-chat-launcher-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 18px;
    height: 18px;
    border-radius: var(--eos-radius-pill);
    background: #f02849;
    color: var(--eos-white);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid var(--eos-white);
}

#eos-chat-widget .eos-chat-launcher-badge.show { display: flex; }

/* ─────────────────────────────── 8. Responsive ─────────────────────────────── */

@media (max-width: 480px) {
    #eos-chat-widget { bottom: 52px; }
    #eos-chat-widget.bottom-right {
        right: max(12px, env(safe-area-inset-right));
    }
    #eos-chat-widget.bottom-left {
        left: max(12px, env(safe-area-inset-left));
    }

    #eos-chat-widget .eos-chat-home,
    #eos-chat-widget .eos-chat-window {
        width: calc(100vw - 24px);
        max-width: none;
        bottom: 70px;
    }

    #eos-chat-widget .eos-chat-window {
        height: calc(100vh - 108px);
        height: calc(100dvh - 108px);
        max-height: none;
    }

    #eos-chat-widget .eos-chat-home {
        max-height: calc(100dvh - 108px);
    }

    #eos-chat-widget .eos-chat-launcher {
        width: 54px;
        height: 54px;
    }

    #eos-chat-widget .eos-chat-launcher svg { width: 23px; height: 23px; }

    #eos-chat-widget .eos-chat-home-head,
    #eos-chat-widget .eos-chat-header { padding: 13px 12px; }

    #eos-chat-widget .eos-chat-home-body { padding: 12px 12px 14px; gap: 9px; }
    #eos-chat-widget .eos-chat-messages { padding: 12px 12px 10px; }
    #eos-chat-widget .eos-chat-composer { padding: 9px 12px 12px; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    #eos-chat-widget *,
    #eos-chat-widget *::before,
    #eos-chat-widget *::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
        scroll-behavior: auto;
    }
}