/* Quick2Tech live chat widget. Logical properties, so it mirrors itself in RTL. */
.q2c {
    --q2c-navy: #0b1730;
    --q2c-blue: #2563eb;
    --q2c-cyan: #22c7f2;
    --q2c-line: #e5e9f2;
    --q2c-soft: #f5f7fb;
    --q2c-text: #0f172a;
    --q2c-muted: #64748b;
    position: fixed;
    inset-block-end: 24px;
    inset-inline-end: 24px;
    z-index: 9990;
    font-family: inherit;
    color: var(--q2c-text);
    line-height: 1.6;
}
.q2c *, .q2c *::before, .q2c *::after { box-sizing: border-box; }
body.has-q2c #scroll-percentage { bottom: 104px !important; }

/* Launcher */
.q2c-launcher {
    position: relative;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 0;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--q2c-blue), var(--q2c-cyan));
    box-shadow: 0 14px 34px rgba(37, 99, 235, .45);
    display: grid;
    place-items: center;
    transition: transform .3s cubic-bezier(.2, .9, .3, 1.3), box-shadow .3s;
}
.q2c-launcher:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 18px 40px rgba(37, 99, 235, .55); }
.q2c-launcher:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }
.q2c-launcher::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(34, 199, 242, .6);
    animation: q2c-pulse 2.4s ease-out infinite;
}
.q2c.is-open .q2c-launcher::before { animation: none; opacity: 0; }
.q2c-launcher svg { width: 28px; height: 28px; transition: transform .35s, opacity .25s; position: absolute; }
.q2c-launcher .q2c-ico-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.q2c.is-open .q2c-launcher .q2c-ico-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.q2c.is-open .q2c-launcher .q2c-ico-close { opacity: 1; transform: none; }
.q2c-badge {
    position: absolute;
    inset-block-start: -2px;
    inset-inline-end: -2px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: none;
    place-items: center;
    border: 2px solid #fff;
}
.q2c.has-unread .q2c-badge { display: grid; }
@keyframes q2c-pulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.55); opacity: 0; } }

/* Teaser */
.q2c-teaser {
    position: absolute;
    inset-block-end: 76px;
    inset-inline-end: 0;
    width: max-content;
    max-width: 250px;
    padding: 12px 34px 12px 16px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px) scale(.96);
    pointer-events: none;
    transition: opacity .35s, transform .35s;
}
[dir="rtl"] .q2c-teaser { padding: 12px 16px 12px 34px; }
.q2c-teaser.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.q2c-teaser button { position: absolute; inset-block-start: 6px; inset-inline-end: 8px; border: 0; background: none; color: var(--q2c-muted); font-size: 16px; cursor: pointer; line-height: 1; }

/* Panel */
.q2c-panel {
    position: absolute;
    inset-block-end: 78px;
    inset-inline-end: 0;
    width: 390px;
    height: min(640px, calc(100vh - 120px));
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 30px 70px rgba(11, 23, 48, .32);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(.97);
    transform-origin: bottom right;
    pointer-events: none;
    visibility: hidden;
    transition: opacity .3s, transform .35s cubic-bezier(.2, .9, .3, 1.1), visibility 0s .35s;
}
[dir="rtl"] .q2c-panel { transform-origin: bottom left; }
.q2c.is-open .q2c-panel { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }

.q2c-head {
    position: relative;
    padding: 18px 18px 16px;
    color: #fff;
    background: radial-gradient(120% 140% at 0% 0%, #1d4ed8 0%, #0b1730 62%);
    display: flex;
    align-items: center;
    gap: 12px;
}
.q2c-head::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(60% 80% at 100% 0%, rgba(34, 199, 242, .35), transparent 70%);
    pointer-events: none;
}
.q2c-avatar { position: relative; flex: none; width: 46px; height: 46px; border-radius: 15px; background: #fff; display: grid; place-items: center; }
.q2c-avatar img { width: 30px; height: 30px; }
.q2c-avatar::after { content: ""; position: absolute; inset-block-end: -2px; inset-inline-end: -2px; width: 13px; height: 13px; border-radius: 50%; background: #22c55e; border: 2px solid #0b1730; }
.q2c-head__text { flex: 1; min-width: 0; position: relative; z-index: 1; }
.q2c-head__text strong { display: block; font-size: 16px; font-weight: 800; }
.q2c-head__text span { display: block; font-size: 12.5px; opacity: .8; }
.q2c-head__actions { display: flex; gap: 6px; position: relative; z-index: 1; }
.q2c-icon-btn { width: 36px; height: 36px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #fff; display: grid; place-items: center; cursor: pointer; transition: background .2s; text-decoration: none; }
.q2c-icon-btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.q2c-icon-btn svg { width: 18px; height: 18px; }
.q2c-icon-btn--wa { background: #25d366; border-color: #25d366; }
.q2c-icon-btn--wa:hover { background: #1ebe5b; }

.q2c-body { flex: 1; overflow-y: auto; padding: 18px 16px 8px; background: var(--q2c-soft); display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain; }
.q2c-msg { display: flex; flex-direction: column; max-width: 86%; animation: q2c-in .3s ease both; }
.q2c-msg--visitor { align-self: flex-end; align-items: flex-end; }
.q2c-msg--ai, .q2c-msg--agent { align-self: flex-start; }
.q2c-msg--system { align-self: center; max-width: 92%; }
.q2c-bubble { padding: 10px 14px; border-radius: 18px; font-size: 14.5px; white-space: pre-line; overflow-wrap: anywhere; }
.q2c-msg--visitor .q2c-bubble { background: linear-gradient(135deg, var(--q2c-blue), #1d9bf0); color: #fff; border-end-end-radius: 6px; }
.q2c-msg--ai .q2c-bubble, .q2c-msg--agent .q2c-bubble { background: #fff; border: 1px solid var(--q2c-line); border-end-start-radius: 6px; }
.q2c-msg--agent .q2c-bubble { border-color: #bbf7d0; background: #f0fdf4; }
.q2c-msg--system .q2c-bubble { background: transparent; color: var(--q2c-muted); font-size: 12.5px; text-align: center; padding: 4px 8px; }
.q2c-bubble a { color: inherit; text-decoration: underline; font-weight: 600; }
.q2c-msg--ai .q2c-bubble a, .q2c-msg--agent .q2c-bubble a { color: var(--q2c-blue); }
.q2c-author { font-size: 11.5px; font-weight: 700; color: #15803d; margin: 0 6px 3px; }
.q2c-time { font-size: 10.5px; color: var(--q2c-muted); margin: 3px 6px 0; }
@keyframes q2c-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.q2c-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.q2c-chip { border: 1px solid #bfdbfe; background: #fff; color: var(--q2c-blue); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s, transform .2s; font-family: inherit; }
.q2c-chip:hover { background: var(--q2c-blue); color: #fff; transform: translateY(-1px); }

.q2c-typing { display: inline-flex; gap: 4px; padding: 13px 16px; background: #fff; border: 1px solid var(--q2c-line); border-radius: 18px; border-end-start-radius: 6px; align-self: flex-start; }
.q2c-typing span { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: q2c-dot 1.2s infinite; }
.q2c-typing span:nth-child(2) { animation-delay: .15s; }
.q2c-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes q2c-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-4px); opacity: 1; } }

.q2c-form { align-self: stretch; background: #fff; border: 1px solid var(--q2c-line); border-radius: 18px; padding: 14px; display: grid; gap: 8px; animation: q2c-in .3s ease both; }
.q2c-form strong { font-size: 14px; }
.q2c-form input { width: 100%; border: 1px solid var(--q2c-line); background: var(--q2c-soft); border-radius: 12px; padding: 9px 12px; font-size: 14px; font-family: inherit; color: inherit; }
.q2c-form input:focus { outline: 2px solid #93c5fd; border-color: transparent; }
.q2c-form input[type="tel"], .q2c-form input[type="email"] { direction: ltr; text-align: start; }
[dir="rtl"] .q2c-form input[type="tel"], [dir="rtl"] .q2c-form input[type="email"] { text-align: right; }
.q2c-form button { border: 0; border-radius: 12px; padding: 10px; font-weight: 700; font-family: inherit; color: #fff; background: linear-gradient(135deg, var(--q2c-blue), var(--q2c-cyan)); cursor: pointer; }
.q2c-form .q2c-form__error { color: #dc2626; font-size: 12.5px; }
.q2c-form.is-sent { opacity: .7; }

.q2c-foot { padding: 10px 12px 12px; background: #fff; border-top: 1px solid var(--q2c-line); }
.q2c-compose { display: flex; align-items: flex-end; gap: 8px; background: var(--q2c-soft); border: 1px solid var(--q2c-line); border-radius: 18px; padding: 6px 6px 6px 14px; transition: border-color .2s, box-shadow .2s; }
[dir="rtl"] .q2c-compose { padding: 6px 14px 6px 6px; }
.q2c-compose:focus-within { border-color: #93c5fd; box-shadow: 0 0 0 4px rgba(37, 99, 235, .1); }
.q2c-compose textarea { flex: 1; border: 0; background: transparent; resize: none; font-family: inherit; font-size: 14.5px; color: inherit; padding: 8px 0; max-height: 120px; outline: none; line-height: 1.5; }
.q2c-send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 13px; color: #fff; background: linear-gradient(135deg, var(--q2c-blue), var(--q2c-cyan)); display: grid; place-items: center; cursor: pointer; transition: transform .2s, opacity .2s; }
.q2c-send:disabled { opacity: .45; cursor: default; }
.q2c-send:not(:disabled):hover { transform: scale(1.06); }
.q2c-send svg { width: 18px; height: 18px; }
[dir="rtl"] .q2c-send svg { transform: scaleX(-1); }
.q2c-note { margin: 8px 4px 0; font-size: 11px; color: var(--q2c-muted); text-align: center; }
.q2c-alert { margin: 0 4px 8px; font-size: 12.5px; color: #b91c1c; }

@media (max-width: 575px) {
    .q2c { inset-block-end: 16px; inset-inline-end: 16px; }
    .q2c-panel { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; }
    .q2c.is-open .q2c-launcher { display: none; }
    body.q2c-locked { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
    .q2c-launcher::before, .q2c-msg, .q2c-form, .q2c-typing span { animation: none; }
    .q2c-panel, .q2c-teaser, .q2c-launcher { transition: none; }
}
