/* WKAU_PALETTE: chat.css көшірмесі — автоматты жасалады, қолмен өзгертпеңіз */
/* ===== WKAU AI көмекші ===== */

.wkai-launcher,
.wkai-panel,
.wkai-panel * { box-sizing: border-box; }

/* ---------- «Сұрақ қою» батырмасы — «Қабылдау комиссиясы» батырмасының үстінде ---------- */
.wkai-launcher {
    position: fixed;
    right: 30px;
    bottom: calc(30px + 48px + 14px); /* abb батырмасының биіктігі + аралық */
    z-index: 9998;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px 8px 8px;
    border: 1px solid #d6e2f0;
    border-radius: 999px;
    background: #fff;
    color: #0052a5;
    font: 600 14.5px/1 "Roboto", "Segoe UI", Arial, sans-serif;
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: 0 10px 26px -10px rgba(16, 46, 90, .45), 0 2px 6px rgba(16, 46, 90, .08);
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease, visibility .2s;
}
.wkai-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -10px rgba(16, 46, 90, .5), 0 2px 6px rgba(16, 46, 90, .1);
}
.wkai-launcher:focus-visible { outline: 2px solid #0052a5; outline-offset: 3px; }
.wkai-launcher__ico {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0052a5, #003b78);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wkai-launcher__ico svg { width: 18px; height: 18px; }
/* «Қабылдау комиссиясы» мәзірі ашылғанда немесе чат ашық кезде — жасырамыз */
.wkai-launcher.is-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    pointer-events: none;
}

/* ---------- Чат терезесі ---------- */
.wkai-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 10060; /* сайдбардан, abb батырмаларынан жоғары */
    width: 400px;
    height: min(640px, calc(100vh - 48px - var(--wp-admin--admin-bar--height, 0px)));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    color: #0a1628;
    font: 400 14.5px/1.55 "Roboto", "Segoe UI", Arial, sans-serif;
    box-shadow: 0 24px 60px -18px rgba(16, 46, 90, .45), 0 4px 14px rgba(16, 46, 90, .12);
    transform-origin: bottom right;
    transition: opacity .22s ease, transform .28s cubic-bezier(.22, .61, .36, 1), visibility .22s;
}
.wkai-panel[hidden] { display: flex !important; } /* анимация үшін — көрінуді класс басқарады */
.wkai-panel:not(.is-open) {
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(.96);
    pointer-events: none;
}

/* Тақырып */
.wkai-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px 14px 16px;
    background: linear-gradient(135deg, #0052a5, #003b78);
    color: #fff;
    flex-shrink: 0;
}
.wkai-head__ava {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wkai-head__ava svg { width: 22px; height: 22px; }
.wkai-head__txt { flex: 1; min-width: 0; }
.wkai-head__title { font-weight: 700; font-size: 15.5px; line-height: 1.25; }
.wkai-head__sub { font-size: 12px; opacity: .8; margin-top: 2px; }
.wkai-head__btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s;
}
.wkai-head__btn:hover { background: rgba(255, 255, 255, .16); }
.wkai-head__btn:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.wkai-head__btn svg { width: 19px; height: 19px; }

/* Хабарламалар */
.wkai-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 14px 10px;
    background: #f5f7fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
}
.wkai-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.wkai-msg--bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e3e8ef;
    border-bottom-left-radius: 4px;
}
.wkai-msg--user {
    align-self: flex-end;
    background: #0052a5;
    color: #fff;
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}
.wkai-msg--error {
    align-self: stretch;
    max-width: none;
    background: #fdf1f0;
    border: 1px solid #f2c9c4;
    color: #8a2c22;
    font-size: 13.5px;
}
.wkai-msg p { margin: 0 0 8px; }
.wkai-msg p:last-child { margin-bottom: 0; }
.wkai-msg ul,
.wkai-msg ol { margin: 4px 0 8px; padding-left: 20px; }
.wkai-msg li { margin: 2px 0; }
.wkai-msg a { color: #0052a5; text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }
.wkai-msg strong { font-weight: 700; }

/* Жазылып жатқан жауаптың соңындағы курсор */
.wkai-msg.is-streaming .wkai-caret {
    display: inline-block;
    width: 7px;
    height: 15px;
    margin-left: 2px;
    vertical-align: -2px;
    background: #0052a5;
    border-radius: 1px;
    animation: wkai-blink 1s steps(2) infinite;
}
@keyframes wkai-blink { 50% { opacity: 0; } }

/* Күй: «Сайттан іздеп жатырмын…» */
.wkai-status {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #eaf1fa;
    color: #0052a5;
    font-size: 12.5px;
    max-width: 88%;
}
.wkai-status__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wkai-dots { display: inline-flex; gap: 3px; flex-shrink: 0; }
.wkai-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    animation: wkai-dot 1.2s ease-in-out infinite;
}
.wkai-dots i:nth-child(2) { animation-delay: .15s; }
.wkai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes wkai-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Дереккөздер */
.wkai-sources {
    align-self: flex-start;
    max-width: 88%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: -4px;
}
.wkai-sources__title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
}
.wkai-source {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    background: #fff;
    color: #0a1628 !important;
    font-size: 13px;
    line-height: 1.35;
    text-decoration: none !important;
    transition: border-color .2s, color .2s;
}
.wkai-source:hover { border-color: #b9cde6; color: #0052a5 !important; }
.wkai-source svg { width: 15px; height: 15px; flex-shrink: 0; color: #0052a5; }
.wkai-source span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Ұсынылған сұрақтар */
.wkai-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.wkai-chip {
    padding: 8px 12px;
    border: 1px solid #cfdcec;
    border-radius: 999px;
    background: #fff;
    color: #0052a5;
    font: 500 13px/1.3 inherit;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background .2s, border-color .2s;
}
.wkai-chip:hover { background: #eef4fb; border-color: #0052a5; }
.wkai-chip:focus-visible { outline: 2px solid #0052a5; outline-offset: 2px; }
.wkai-chip--more { border-style: dashed; color: #64748b; background: transparent; }
.wkai-chip--more:hover { color: #0052a5; }

/* Енгізу жолы */
.wkai-foot {
    flex-shrink: 0;
    padding: 10px 12px 10px;
    border-top: 1px solid #e3e8ef;
    background: #fff;
}
.wkai-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 6px 6px 6px 14px;
    border: 1px solid #d6e0ec;
    border-radius: 16px;
    background: #f7f9fc;
    transition: border-color .2s, background .2s;
}
.wkai-form:focus-within { border-color: #0052a5; background: #fff; }
.wkai-input {
    flex: 1;
    min-width: 0;
    max-height: 120px;
    padding: 7px 0;
    border: 0;
    outline: none;
    resize: none;
    background: transparent;
    color: #0a1628;
    font: inherit;
    line-height: 1.45;
}
.wkai-send {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: 0;
    border-radius: 50%;
    background: #0052a5;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s, opacity .2s;
}
.wkai-send:hover { background: #003b78; }
.wkai-send:disabled { opacity: .45; cursor: default; }
.wkai-send:focus-visible { outline: 2px solid #0052a5; outline-offset: 2px; }
.wkai-send svg { width: 18px; height: 18px; }
.wkai-send .wkai-ico-stop { display: none; }
.wkai-panel.is-busy .wkai-send .wkai-ico-send { display: none; }
.wkai-panel.is-busy .wkai-send .wkai-ico-stop { display: block; }
.wkai-note {
    margin: 7px 4px 0;
    font-size: 11px;
    line-height: 1.4;
    color: #64748b;
}

.wkai-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wkai-form[hidden] { display: none; }
.wkai-head__btn + .wkai-head__btn { margin-left: -4px; }

/* ---------- Батырмалар мен өрістер ---------- */
.wkai-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font: 600 14px/1.2 inherit;
    font-family: inherit;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}
.wkai-btn svg { width: 17px; height: 17px; }
.wkai-btn:disabled { opacity: .55; cursor: default; }
.wkai-btn:focus-visible { outline: 2px solid #0052a5; outline-offset: 2px; }
.wkai-btn--primary { background: #0052a5; color: #fff; }
.wkai-btn--primary:hover { background: #003b78; }
.wkai-btn--ghost { background: transparent; color: #64748b; }
.wkai-btn--ghost:hover { color: #0052a5; }
.wkai-btn--outline { background: #fff; border-color: #cfdcec; color: #0052a5; }
.wkai-btn--outline:hover { background: #eef4fb; border-color: #0052a5; }

.wkai-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d6e0ec;
    border-radius: 10px;
    background: #fff;
    color: #0a1628;
    font: inherit;
    resize: vertical;
    transition: border-color .2s;
}
.wkai-field:focus { outline: none; border-color: #0052a5; box-shadow: 0 0 0 3px rgba(0, 82, 165, .12); }
.wkai-chip.is-active { background: #0052a5; border-color: #0052a5; color: #fff; }

/* ---------- Танысу ---------- */
.wkai-onb {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 16px;
    border: 1px solid #e3e8ef;
    border-radius: 14px;
    background: #fff;
}
.wkai-onb__q {
    display: block;
    margin-top: 6px;
    font-size: 13.5px;
    font-weight: 700;
    color: #0a1628;
}
.wkai-onb__q:first-child { margin-top: 0; }
.wkai-onb__langs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wkai-lang {
    padding: 10px 6px;
    border: 1px solid #cfdcec;
    border-radius: 10px;
    background: #fff;
    color: #0a1628;
    font: 600 14px/1.2 inherit;
    font-family: inherit;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}
.wkai-lang:hover { border-color: #0052a5; color: #0052a5; }
.wkai-lang.is-active { background: #0052a5; border-color: #0052a5; color: #fff; }
.wkai-lang:focus-visible { outline: 2px solid #0052a5; outline-offset: 2px; }
.wkai-onb__roles { display: flex; flex-wrap: wrap; gap: 8px; }
.wkai-onb__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ---------- Байланыс батырмалары (Admission Button Block) ---------- */
.wkai-contacts { display: flex; flex-direction: column; gap: 8px; align-self: stretch; }
.wkai-contacts__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wkai-contact {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 9px 11px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e3e8ef;
    color: #0a1628 !important;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none !important;
    transition: border-color .2s, transform .15s;
}
.wkai-contact:hover { border-color: #b9cde6; transform: translateY(-1px); }
.wkai-contact svg {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    padding: 6px;
    border-radius: 8px;
    color: #fff;
    background: #0052a5;
}
.wkai-contact span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wkai-contact--whatsapp svg { background: #25d366; }
.wkai-contact--phone svg { background: #0052a5; }
.wkai-contact--instagram svg { background: linear-gradient(45deg, #f58529, #dd2a7b 55%, #8134af); }
.wkai-contact--facebook svg { background: #1877f2; }
.wkai-contact--tiktok svg { background: #111; }
.wkai-contact--telegram svg { background: #229ed9; }
.wkai-contacts > .wkai-btn { align-self: flex-start; }

/* ---------- Видео кеңесші (Zoom) ---------- */
.wkai-video {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 8px 10px;
    border: 1px solid #cfe3d6;
    border-radius: 12px;
    background: #f1f9f4;
    color: #0a1628 !important;
    text-decoration: none !important;
    line-height: 1.3;
    transition: border-color .2s, background .2s, transform .15s;
}
.wkai-video:hover { border-color: #3b82c4; background: #eef5ff; }
.wkai-video:focus-visible { outline: 2px solid #0052a5; outline-offset: 2px; }
.wkai-video__ico {
    position: relative;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #3b82c4; /* Zoom көгі */
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wkai-video__ico svg { width: 19px; height: 19px; }
.wkai-video__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wkai-video__title { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wkai-video__status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #1d7a4f; }
.wkai-video__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22b35e;
    box-shadow: 0 0 0 0 rgba(34, 179, 94, .5);
    animation: wkai-pulse 2s ease-out infinite;
    flex-shrink: 0;
}
@keyframes wkai-pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 179, 94, .5); } 70%, 100% { box-shadow: 0 0 0 6px rgba(34, 179, 94, 0); } }
.wkai-video__cta {
    flex-shrink: 0;
    padding: 7px 11px;
    border-radius: 8px;
    background: #3b82c4;
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}
.wkai-video:hover .wkai-video__cta { background: #1a73e8; }
.wkai-video.is-offline { background: #f5f7fa; border-color: #e3e8ef; }
.wkai-video.is-offline .wkai-video__status { color: #64748b; }
.wkai-video.is-offline .wkai-video__dot { background: #a9b4c0; animation: none; }
/* Енгізу жолының үстіндегі жолақ */
.wkai-video-slot { margin-bottom: 8px; }
.wkai-video--bar { padding: 6px 6px 6px 8px; }
.wkai-video--bar .wkai-video__ico { flex-basis: 30px; width: 30px; height: 30px; border-radius: 8px; }
.wkai-video--bar .wkai-video__ico svg { width: 17px; height: 17px; }
.wkai-video-slot:has(+ .wkai-form[hidden]) { display: none; } /* танысу кезінде жасырамыз */
.wkai-video-slot[hidden],
.wkai-head__btn[hidden] { display: none; } /* тек талапкерге */
.wkai-fb__video { align-self: stretch; }
@media (max-width: 360px) { .wkai-video__cta { padding: 7px 9px; font-size: 12px; } }

/* ---------- «Хабарлама қалдыру» ---------- */
.wkai-lead {
    display: flex;
    flex-direction: column;
    gap: 9px;
    align-self: stretch;
    padding: 16px;
    border: 1px solid #cfdcec;
    border-radius: 14px;
    background: #fff;
}
.wkai-lead__title { font-weight: 700; font-size: 15px; }
.wkai-lead__intro { margin: 0 0 2px; font-size: 13px; color: #64748b; }
.wkai-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.wkai-consent {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 12px;
    line-height: 1.45;
    color: #4a5868;
    cursor: pointer;
}
.wkai-consent input { flex-shrink: 0; width: 17px; height: 17px; margin: 1px 0 0; accent-color: #0052a5; }
.wkai-lead__err {
    padding: 8px 10px;
    border-radius: 8px;
    background: #fdf1f0;
    color: #8a2c22;
    font-size: 13px;
}
.wkai-msg--ok {
    align-self: stretch;
    max-width: none;
    background: #edf8f1;
    border: 1px solid #bfe5cc;
    color: #1d5a37;
}

/* ---------- Баға ---------- */
.wkai-fb {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: -6px;
    font-size: 12px;
    color: #64748b;
}
.wkai-fb__q { margin-right: 4px; }
.wkai-fb__btn {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s, color .2s;
}
.wkai-fb__btn:hover { background: #eaf1fa; color: #0052a5; }
.wkai-fb__btn:focus-visible { outline: 2px solid #0052a5; outline-offset: 1px; }
.wkai-fb__btn svg { width: 16px; height: 16px; }
.wkai-fb__done { color: #1d7a4f; }
.wkai-fb__leave { align-self: flex-start; }

/* ---------- Мобиль ---------- */
@media (max-width: 768px) {
    .wkai-launcher {
        right: 16px;
        bottom: calc(20px + 42px + 12px);
        padding: 6px 14px 6px 6px;
        font-size: 13.5px;
    }
    .wkai-launcher__ico { width: 30px; height: 30px; }
}
@media (max-width: 600px) {
    .wkai-panel {
        inset: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        border-radius: 0;
        padding-top: var(--wp-admin--admin-bar--height, 0px);
    }
    .wkai-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
    .wkai-input { font-size: 16px; } /* iOS бетті үлкейтпесін */
}

@media (prefers-reduced-motion: reduce) {
    .wkai-launcher, .wkai-panel, .wkai-dots i, .wkai-caret, .wkai-video__dot { transition: none !important; animation: none !important; }
}
@media print { .wkai-launcher, .wkai-panel { display: none !important; } }

/* Тақырыпта 4 батырма — атау тар экранда «…» болып қысқарады */
.wkai-head__title,
.wkai-head__sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wkai-head { padding-right: 8px; }
.wkai-head__btn { width: 34px; height: 34px; flex-shrink: 0; }

/* «Толығырақ сұрау (ЖИ)» — дайын жауаптың астында */
.wkai-askai { align-self: flex-start; padding: 7px 12px; font-size: 13px; }
.wkai-askai svg { width: 15px; height: 15px; }
