/*
 * Update id: HUQF
 */

.v2-ai-chat {
    --ai-accent: #f58220;
    --ai-accent-bright: #ff9f3d;
    --ai-accent-dark: #c95700;
    --ai-panel: #17130f;
    --ai-panel-soft: #292018;
    --ai-border: rgba(255, 255, 255, .14);
    --ai-text: #f8fafc;
    --ai-muted: #aeb9c9;
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 2147482000;
    color: var(--ai-text);
    font: 400 15px/1.45 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.v2-ai-chat * { box-sizing: border-box; }
.v2-ai-chat[hidden], .v2-ai-chat [hidden] { display: none !important; }

.v2-ai-chat__launcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 0 19px;
    border: 0;
    border-radius: 999px;
    color: #1b1205;
    background: linear-gradient(135deg, #ffad54, #f36f00);
    box-shadow: 0 18px 42px rgba(190, 75, 0, .30);
    cursor: pointer;
    font: inherit;
    font-weight: 750;
}

.v2-ai-chat__launcher:hover { transform: translateY(-1px); }
.v2-ai-chat__launcher:focus-visible,
.v2-ai-chat button:focus-visible,
.v2-ai-chat textarea:focus-visible {
    outline: 3px solid rgba(245, 158, 11, .38);
    outline-offset: 2px;
}

.v2-ai-chat__launcher-mark {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: rgba(17, 24, 39, .92);
    font-size: 13px;
    letter-spacing: -.02em;
}

.v2-ai-chat__panel {
    display: flex;
    width: min(400px, calc(100vw - 28px));
    height: min(640px, calc(100vh - 44px));
    overflow: hidden;
    flex-direction: column;
    border: 1px solid var(--ai-border);
    border-radius: 22px;
    background: var(--ai-panel);
    box-shadow: 0 26px 70px rgba(0, 0, 0, .42);
}

.v2-ai-chat__header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    padding: 15px 16px;
    border-bottom: 1px solid var(--ai-border);
    border-top: 3px solid var(--ai-accent);
    background: linear-gradient(135deg, #3a2415, #1c1713);
}

.v2-ai-chat__avatar {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 14px;
    color: #191107;
    background: linear-gradient(135deg, #ffb45f, #f36f00);
    font-weight: 850;
}

.v2-ai-chat__identity { min-width: 0; flex: 1; }
.v2-ai-chat__identity strong { display: block; font-size: 16px; }
.v2-ai-chat__identity small { display: block; overflow: hidden; color: var(--ai-muted); text-overflow: ellipsis; white-space: nowrap; }
.v2-ai-chat__header-actions { display: flex; gap: 4px; }

.v2-ai-chat__icon-button {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 0;
    border-radius: 10px;
    color: var(--ai-muted);
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: 21px;
}

.v2-ai-chat__icon-button:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.v2-ai-chat__messages {
    display: flex;
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    flex-direction: column;
    gap: 12px;
    padding: 18px 14px;
    scroll-behavior: smooth;
}

.v2-ai-chat__messages {
    scrollbar-width: thin;
    scrollbar-color: var(--ai-accent) #221a14;
}

.v2-ai-chat__messages::-webkit-scrollbar { width: 10px; }
.v2-ai-chat__messages::-webkit-scrollbar-track {
    border-left: 1px solid rgba(255, 255, 255, .06);
    background: #221a14;
}
.v2-ai-chat__messages::-webkit-scrollbar-thumb {
    border: 2px solid #221a14;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--ai-accent-bright), var(--ai-accent-dark));
}
.v2-ai-chat__messages::-webkit-scrollbar-thumb:hover {
    background: var(--ai-accent-bright);
}

.v2-ai-chat__message {
    max-width: 88%;
    padding: 10px 13px;
    border-radius: 16px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.v2-ai-chat__message--agent {
    align-self: flex-start;
    border: 1px solid var(--ai-border);
    border-bottom-left-radius: 5px;
    background: var(--ai-panel-soft);
}

.v2-ai-chat__handoff {
    display: block;
    width: fit-content;
    margin-top: 10px;
    padding: 8px 11px;
    border: 1px solid rgba(255, 159, 61, .55);
    border-radius: 10px;
    color: #1d1306;
    background: linear-gradient(135deg, #ffb45f, var(--ai-accent));
    text-decoration: none;
    white-space: normal;
    font-weight: 750;
}

.v2-ai-chat__handoff:hover {
    color: #130c03;
    background: linear-gradient(135deg, #ffc37d, var(--ai-accent-bright));
    text-decoration: none;
}

.v2-ai-chat__message--customer {
    align-self: flex-end;
    border-bottom-right-radius: 5px;
    color: #211603;
    background: linear-gradient(135deg, #ffbd70, #f58220);
}

.v2-ai-chat__message--system {
    align-self: center;
    max-width: 95%;
    padding: 7px 10px;
    color: var(--ai-muted);
    background: transparent;
    text-align: center;
    font-size: 13px;
}

.v2-ai-chat__typing { display: inline-flex; gap: 4px; padding: 13px 15px; }
.v2-ai-chat__typing i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ai-muted);
    animation: v2-ai-chat-pulse 1.15s infinite ease-in-out;
}
.v2-ai-chat__typing i:nth-child(2) { animation-delay: .14s; }
.v2-ai-chat__typing i:nth-child(3) { animation-delay: .28s; }

@keyframes v2-ai-chat-pulse {
    0%, 60%, 100% { opacity: .35; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

.v2-ai-chat__composer {
    padding: 12px;
    border-top: 1px solid var(--ai-border);
    background: #130f0c;
}

.v2-ai-chat__composer-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.v2-ai-chat__composer textarea {
    width: 100%;
    min-height: 46px;
    max-height: 128px;
    resize: none;
    padding: 11px 12px;
    border: 1px solid var(--ai-border);
    border-radius: 13px;
    color: var(--ai-text);
    background: #241b15;
    font: inherit;
}

.v2-ai-chat__composer textarea::placeholder { color: #8995a6; }

.v2-ai-chat__send {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    border: 0;
    border-radius: 13px;
    color: #1e1404;
    background: var(--ai-accent);
    cursor: pointer;
    font: inherit;
    font-size: 19px;
    font-weight: 850;
}
.v2-ai-chat__send:disabled { opacity: .45; cursor: wait; }

.v2-ai-chat__legal {
    margin: 8px 2px 0;
    color: var(--ai-muted);
    text-align: center;
    font-size: 11px;
}
.v2-ai-chat__legal a { color: #f6b643; }

@media (max-width: 560px) {
    .v2-ai-chat { right: 10px; bottom: 10px; }
    .v2-ai-chat__panel {
        position: fixed;
        top: 10px;
        right: 10px;
        bottom: 10px;
        left: 10px;
        width: auto;
        height: auto;
        border-radius: 17px;
    }
    .v2-ai-chat__launcher-label { display: none; }
    .v2-ai-chat__launcher { width: 56px; padding: 0; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .v2-ai-chat__launcher:hover { transform: none; }
    .v2-ai-chat__messages { scroll-behavior: auto; }
    .v2-ai-chat__typing i { animation: none; }
}
