/* LOHRASBI live AI chat — light, minimal, tech */
:root {
    --loh-chat-bg: #f4f7fb;
    --loh-chat-bg-2: #ffffff;
    --loh-chat-line: #e2e8f0;
    --loh-chat-accent: #E8720F;
    --loh-chat-accent-2: #c9610c;
    --loh-chat-text: #0f172a;
    --loh-chat-muted: #64748b;
    --loh-chat-soft: #f1f5f9;
    --loh-chat-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

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

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

.loh-live-chat__fab {
    position: relative;
    z-index: 2;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(145deg, #E8720F 0%, #c9610c 100%);
    box-shadow: 0 10px 28px rgba(232, 114, 15, 0.28);
    display: grid;
    place-items: center;
    overflow: visible;
    pointer-events: auto;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.loh-live-chat__fab:hover,
.loh-live-chat.is-open .loh-live-chat__fab {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 14px 32px rgba(201, 97, 12, 0.28);
}

.loh-live-chat__fab-icon {
    width: 26px;
    height: 26px;
    z-index: 2;
}

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

.loh-live-chat__fab-rings,
.loh-live-chat__fab-rings::before,
.loh-live-chat__fab-rings::after {
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 1px solid rgba(232, 114, 15, 0.28);
    animation: lohChatPulse 2.4s ease-out infinite;
}

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

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

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

.loh-live-chat__fab-label {
    position: absolute;
    right: 68px;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    background: #0f172a;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 12px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
    pointer-events: none;
}

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

.loh-live-chat__panel {
    position: absolute;
    right: 0;
    left: auto;
    bottom: 74px;
    width: min(400px, calc(100vw - 24px));
    height: min(680px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 22px;
    background:
        radial-gradient(900px 220px at 100% -20%, rgba(232, 114, 15, 0.1), transparent 55%),
        linear-gradient(180deg, var(--loh-chat-bg-2), var(--loh-chat-bg));
    border: 1px solid var(--loh-chat-line);
    box-shadow: var(--loh-chat-shadow);
    color: var(--loh-chat-text);
}

.loh-live-chat__panel[hidden],
.loh-live-chat__backdrop[hidden],
.loh-live-chat__identify[hidden],
.loh-live-chat__composer[hidden],
.loh-live-chat__more[hidden],
.loh-live-chat__error[hidden] {
    display: none !important;
}

.loh-live-chat__header {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    border-bottom: 1px solid var(--loh-chat-line);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
}

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

.loh-live-chat__avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    grid-template-columns: repeat(3, 5px);
    gap: 3px;
    place-content: center;
    background: linear-gradient(145deg, #E8720F, #f59e0b);
    box-shadow: 0 0 0 3px rgba(232, 114, 15, 0.12);
}

.loh-live-chat__avatar span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #fff;
    animation: lohChatDots 1.1s infinite ease-in-out;
}

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

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

.loh-live-chat__identity strong {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
}

.loh-live-chat__identity em {
    font-style: normal;
    font-size: 11px;
    color: #E8720F;
}

.loh-live-chat__backdrop {
    display: none;
}

.loh-live-chat__close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--loh-chat-line);
    border-radius: 12px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    font: inherit;
}

.loh-live-chat__close:hover {
    background: var(--loh-chat-soft);
}

.loh-live-chat__close-label {
    font-size: 13px;
    font-weight: 700;
}

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

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

.loh-live-chat__identify {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--loh-chat-line);
    background: #fff;
}

.loh-live-chat__identify-input {
    width: 100%;
    border: 1px solid var(--loh-chat-line);
    background: #fff;
    color: var(--loh-chat-text);
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
    font-size: 16px;
    line-height: 1.4;
}

.loh-live-chat__identify-input::placeholder {
    color: #94a3b8;
}

.loh-live-chat__identify-input:focus {
    border-color: rgba(13, 148, 136, 0.55);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

/* LTR so equation reads as: ۹ + ۲ = [answer] */
.loh-live-chat__identify-captcha {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) 40px 88px;
    gap: 8px;
    align-items: stretch;
    direction: ltr;
}

.loh-live-chat__identify-captcha .loh-live-chat__captcha-art {
    min-height: 46px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid var(--loh-chat-line);
}

.loh-live-chat__identify-captcha .loh-live-chat__captcha-art svg {
    height: 46px;
}

.loh-live-chat__identify-captcha .loh-live-chat__captcha-refresh {
    min-width: 40px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    border: 1px solid var(--loh-chat-line);
    background: #fff;
    color: #475569;
    border-radius: 12px;
    cursor: pointer;
}

.loh-live-chat__identify-captcha .loh-live-chat__captcha-refresh:hover {
    background: var(--loh-chat-soft);
}

.loh-live-chat__identify-captcha-input {
    text-align: center;
    padding-left: 8px;
    padding-right: 8px;
    font-weight: 700;
}

.loh-live-chat__identify-submit {
    margin-top: 0;
    width: 100%;
}

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

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

.loh-live-chat__captcha-art {
    flex: 1;
    min-height: 46px;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid var(--loh-chat-line);
}

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

.loh-live-chat__captcha-refresh {
    border: 1px solid var(--loh-chat-line);
    background: #fff;
    color: #475569;
    border-radius: 12px;
    padding: 10px 8px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
}

.loh-live-chat__primary {
    margin-top: 0;
    flex-shrink: 0;
    border: 0;
    border-radius: 14px;
    padding: 13px 16px;
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    background: linear-gradient(90deg, #E8720F, #c9610c);
    box-shadow: 0 8px 18px rgba(13, 148, 136, 0.18);
}

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

.loh-live-chat__more {
    margin: 10px 14px 0;
    border: 1px solid var(--loh-chat-line);
    background: #fff;
    color: #475569;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
}

.loh-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;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(244, 247, 251, 0.95));
}

.loh-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;
}

.loh-live-chat__bubble a {
    color: #0f766e;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px dashed rgba(15, 118, 110, 0.4);
}

.loh-live-chat__bubble--user {
    margin-right: auto;
    background: linear-gradient(180deg, #86efac, #c9610c);
    color: #14532d;
    border-bottom-left-radius: 8px;
}

.loh-live-chat__bubble--assistant {
    margin-left: auto;
    background: #fff;
    border: 1px solid var(--loh-chat-line);
    color: #0f172a;
    border-bottom-right-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

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

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

.loh-live-chat__typing i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #E8720F;
    animation: lohChatDots 1s infinite ease-in-out;
}

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

.loh-live-chat__composer {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--loh-chat-line);
    background: #fff;
}

.loh-live-chat__composer textarea {
    width: 100%;
    border: 1px solid var(--loh-chat-line);
    background: #fff;
    color: var(--loh-chat-text);
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
    font-size: 16px;
    line-height: 1.4;
    resize: none;
    min-height: 46px;
    max-height: 120px;
    -webkit-text-size-adjust: 100%;
}

.loh-live-chat__composer textarea:focus {
    border-color: rgba(13, 148, 136, 0.55);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.loh-live-chat__composer button {
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, #E8720F, #c9610c);
    cursor: pointer;
    flex-shrink: 0;
}

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

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

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

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

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

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

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

@media (max-width: 767px) {
    .loh-live-chat {
        right: 16px;
        left: auto;
        bottom: calc(var(--bottom-nav-height, 64px) + 14px);
    }

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

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

    .loh-live-chat.is-open {
        left: 0;
        right: 0;
        bottom: 0;
        top: 0;
        width: 100%;
        height: auto;
        z-index: 11050;
        pointer-events: none;
    }

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

    .loh-live-chat__backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 11040;
        background: rgba(15, 23, 42, 0.35);
        pointer-events: auto;
    }

    .loh-live-chat__panel {
        position: fixed;
        left: 0;
        right: 0;
        top: 0;
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        bottom: auto;
        border-radius: 0;
        z-index: 11050;
        pointer-events: auto;
        transform: translateZ(0);
    }

    .loh-live-chat__identity em {
        display: none;
    }

    .loh-live-chat__identity strong {
        font-size: 15px;
    }

    .loh-live-chat__avatar {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }

    .loh-live-chat__identify {
        padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
    }

    .loh-live-chat__identify-captcha {
        grid-template-columns: minmax(0, 1.3fr) 40px 80px;
    }

    .loh-live-chat__composer {
        padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    }
}
