/* KiaGostar live AI chat widget */
:root {
    --kia-chat-bg: #07111f;
    --kia-chat-bg-2: #0d1b30;
    --kia-chat-line: rgba(125, 211, 252, 0.18);
    --kia-chat-accent: #22d3ee;
    --kia-chat-accent-2: #8dc63f;
    --kia-chat-violet: #7c5cff;
    --kia-chat-text: #e8f1ff;
    --kia-chat-muted: #93a4c0;
}

.kia-live-chat {
    position: fixed;
    right: 28px;
    left: auto;
    bottom: 30px;
    z-index: 10040;
    font-family: inherit;
    direction: rtl;
}

.kia-live-chat.is-open {
    z-index: 11050;
}

.kia-live-chat__fab {
    position: relative;
    width: 62px;
    height: 62px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(145deg, #22d3ee 0%, #6366f1 52%, #8dc63f 100%);
    box-shadow: 0 10px 30px rgba(34, 211, 238, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.12);
    display: grid;
    place-items: center;
    overflow: visible;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.kia-live-chat__fab:hover,
.kia-live-chat.is-open .kia-live-chat__fab {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 16px 36px rgba(99, 102, 241, 0.38);
}

.kia-live-chat__fab-icon {
    width: 28px;
    height: 28px;
    z-index: 2;
}

.kia-live-chat__fab-icon svg {
    width: 100%;
    height: 100%;
}

.kia-live-chat__fab-rings,
.kia-live-chat__fab-rings::before,
.kia-live-chat__fab-rings::after {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(34, 211, 238, 0.35);
    animation: kiaChatPulse 2.4s ease-out infinite;
}

.kia-live-chat__fab-rings::before,
.kia-live-chat__fab-rings::after {
    content: "";
    inset: 0;
}

.kia-live-chat__fab-rings::before { animation-delay: 0.6s; }
.kia-live-chat__fab-rings::after { animation-delay: 1.2s; }

.kia-live-chat.is-open .kia-live-chat__fab-rings {
    display: none;
}

.kia-live-chat__fab-label {
    position: absolute;
    right: 72px;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(7, 17, 31, 0.92);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 12px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(7, 17, 31, 0.28);
    pointer-events: none;
}

.kia-live-chat.is-open .kia-live-chat__fab-label {
    display: none;
}

.kia-live-chat__panel {
    position: absolute;
    right: 0;
    left: auto;
    bottom: 78px;
    width: min(400px, calc(100vw - 24px));
    height: min(680px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 28px;
    background:
        radial-gradient(1200px 280px at 100% -10%, rgba(124, 92, 255, 0.28), transparent 55%),
        radial-gradient(900px 240px at -10% 0%, rgba(34, 211, 238, 0.2), transparent 50%),
        linear-gradient(180deg, var(--kia-chat-bg-2), var(--kia-chat-bg));
    border: 1px solid var(--kia-chat-line);
    box-shadow: 0 30px 80px rgba(3, 7, 18, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);
    color: var(--kia-chat-text);
}

.kia-live-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
}

.kia-live-chat__identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.kia-live-chat__avatar {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    display: grid;
    grid-template-columns: repeat(3, 6px);
    gap: 3px;
    place-content: center;
    background: linear-gradient(145deg, rgba(34, 211, 238, 0.9), rgba(141, 198, 63, 0.85));
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12);
}

.kia-live-chat__avatar span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #07111f;
    animation: kiaChatDots 1.1s infinite ease-in-out;
}

.kia-live-chat__avatar span:nth-child(2) { animation-delay: 0.15s; }
.kia-live-chat__avatar span:nth-child(3) { animation-delay: 0.3s; }

.kia-live-chat__identity strong,
.kia-live-chat__identity em {
    display: block;
}

.kia-live-chat__identity strong {
    font-size: 14px;
    font-weight: 800;
}

.kia-live-chat__identity em {
    font-style: normal;
    font-size: 11px;
    color: #86efac;
}

.kia-live-chat__close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #dbeafe;
    cursor: pointer;
}

.kia-live-chat__close svg {
    width: 16px;
    height: 16px;
}

.kia-live-chat__gate,
.kia-live-chat__room {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.kia-live-chat__gate {
    padding: 12px 16px 10px;
    gap: 8px;
    overflow: hidden;
}

.kia-live-chat__gate-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
}

.kia-live-chat__gate-hero {
    margin-bottom: 0;
}

.kia-live-chat__eyebrow {
    margin: 0 0 4px;
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--kia-chat-accent);
    font-weight: 800;
}

.kia-live-chat__gate h3 {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 800;
}

.kia-live-chat__gate p {
    margin: 0;
    color: var(--kia-chat-muted);
    font-size: 12px;
    line-height: 1.6;
}

.kia-live-chat__names {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.kia-live-chat__gate label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: #c5d4ee;
}

.kia-live-chat__gate label b {
    color: #fda4af;
}

.kia-live-chat__gate input,
.kia-live-chat__composer textarea {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
    font-size: 14px;
}

.kia-live-chat__gate input:focus,
.kia-live-chat__composer textarea:focus {
    border-color: rgba(34, 211, 238, 0.7);
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12);
}

.kia-live-chat__error {
    margin: 0;
    color: #fecaca;
    font-size: 12px;
}

.kia-live-chat__hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.kia-live-chat__captcha {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kia-live-chat__captcha-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kia-live-chat__captcha-art {
    flex: 1;
    min-height: 52px;
    border-radius: 12px;
    overflow: hidden;
    background: #071422;
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.kia-live-chat__captcha-art svg {
    display: block;
    width: 100%;
    height: 52px;
}

.kia-live-chat__captcha-refresh {
    border: 1px solid rgba(125, 211, 252, 0.28);
    background: rgba(14, 165, 233, 0.1);
    color: #bae6fd;
    border-radius: 12px;
    padding: 10px 8px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
}

.kia-live-chat__primary {
    margin-top: 8px;
    flex-shrink: 0;
    border: 0;
    border-radius: 16px;
    padding: 12px 16px;
    color: #041018;
    font-weight: 800;
    cursor: pointer;
    background: linear-gradient(90deg, #22d3ee, #8dc63f);
}

.kia-live-chat__primary[disabled],
.kia-live-chat__composer button[disabled] {
    opacity: 0.6;
    cursor: wait;
}

.kia-live-chat__more {
    margin: 10px 14px 0;
    border: 1px dashed rgba(125, 211, 252, 0.28);
    background: rgba(14, 165, 233, 0.08);
    color: #bae6fd;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
}

.kia-live-chat__thread {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.kia-live-chat__bubble {
    max-width: 88%;
    padding: 11px 13px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.85;
    white-space: pre-wrap;
    word-break: break-word;
}

.kia-live-chat__bubble a {
    color: #67e8f9;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px dashed rgba(103, 232, 249, 0.5);
}

.kia-live-chat__bubble--user {
    margin-right: auto;
    background: linear-gradient(180deg, #8dc63f, #649e2c);
    color: #06210c;
    border-bottom-left-radius: 8px;
}

.kia-live-chat__bubble--assistant {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom-right-radius: 8px;
}

.kia-live-chat__time {
    display: block;
    margin-top: 6px;
    font-size: 10px;
    opacity: 0.65;
}

.kia-live-chat__typing {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    min-height: 18px;
}

.kia-live-chat__typing i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #67e8f9;
    animation: kiaChatDots 1s infinite ease-in-out;
}

.kia-live-chat__typing i:nth-child(2) { animation-delay: 0.15s; }
.kia-live-chat__typing i:nth-child(3) { animation-delay: 0.3s; }

.kia-live-chat__composer {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(2, 6, 23, 0.35);
}

.kia-live-chat__composer textarea {
    resize: none;
    min-height: 46px;
    max-height: 120px;
}

.kia-live-chat__composer button {
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 14px;
    color: #041018;
    background: linear-gradient(145deg, #22d3ee, #8dc63f);
    cursor: pointer;
    flex-shrink: 0;
}

.kia-live-chat__composer button svg {
    width: 18px;
    height: 18px;
}

@keyframes kiaChatPulse {
    0% { transform: scale(0.92); opacity: 0.7; }
    100% { transform: scale(1.28); opacity: 0; }
}

@keyframes kiaChatDots {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
    40% { transform: translateY(-4px); opacity: 1; }
}

html.nav-open .kia-live-chat {
    display: none !important;
}

body:has(.viona-page) .kia-live-chat,
body:has(.showroom) .kia-live-chat,
body:has(.kia-service-page) .kia-live-chat,
body:has(.eq-brand-page) .kia-live-chat,
body:has(.lp-page) .kia-live-chat {
    display: none !important;
}

body.kia-live-chat-open {
    overflow: hidden;
}

body.kia-live-chat-open .mobile-bottom-nav {
    display: none !important;
    pointer-events: none !important;
}

@media (max-width: 767px) {
    .kia-live-chat {
        right: 16px;
        left: auto;
        bottom: calc(var(--mobile-bottom-nav-height, 66px) + 12px);
    }

    .kia-live-chat__fab {
        width: 56px;
        height: 56px;
    }

    .kia-live-chat__fab-label {
        display: none;
    }

    .kia-live-chat.is-open {
        left: 0;
        right: 0;
        bottom: 0;
        top: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        z-index: 11050;
    }

    .kia-live-chat.is-open .kia-live-chat__fab {
        display: none;
    }

    .kia-live-chat__panel {
        inset: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        bottom: 0;
        left: 0;
        border-radius: 0;
    }
}
