/* H4Y Chat — плавающий виджет ассистента. Фирменная золотая/бежевая гамма. */
.h4y-chat{ --c:#c9a24b; --c2:#b88a32; --gold:#c9a24b;
    --line:#ece6da; --ink:#2a2620; --muted:#9a9488;
    --bot-bg:#f3efe6; --me-bg:#2a2620; --bg:#faf7f0;
    position:fixed; right:20px; bottom:20px; z-index:2147482000;
    font-family:-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif; }

/* плавающая кнопка — переливающийся градиент + пульс-кольцо для внимания */
.h4y-chat-bubble{ position:relative; width:60px; height:60px; border-radius:50%; border:0; cursor:pointer;
    background:linear-gradient(130deg,#e3c173,#c9a24b,#b88a32,#d9b45e,#c9a24b); background-size:300% 300%;
    color:#fff; box-shadow:0 10px 26px rgba(184,138,50,.45); display:flex; align-items:center; justify-content:center;
    transition:transform .15s; animation:h4yshimmer 5s ease-in-out infinite; z-index:1; }
.h4y-chat-bubble::after{ content:''; position:absolute; inset:0; border-radius:50%; z-index:-1;
    box-shadow:0 0 0 0 rgba(201,162,75,.55); animation:h4ypulse 2.6s ease-out infinite; }
.h4y-chat-bubble:hover{ transform:translateY(-2px) scale(1.04); }
.h4y-chat-bubble svg{ width:27px; height:27px; position:relative; z-index:1; filter:drop-shadow(0 1px 1px rgba(0,0,0,.15)); }
.h4y-chat.is-open .h4y-chat-bubble{ display:none; }
@keyframes h4yshimmer{ 0%{ background-position:0% 50%; } 50%{ background-position:100% 50%; } 100%{ background-position:0% 50%; } }
@keyframes h4ypulse{ 0%{ box-shadow:0 0 0 0 rgba(201,162,75,.5); } 70%{ box-shadow:0 0 0 18px rgba(201,162,75,0); } 100%{ box-shadow:0 0 0 0 rgba(201,162,75,0); } }
@media (prefers-reduced-motion: reduce){ .h4y-chat-bubble{ animation:none; } .h4y-chat-bubble::after{ animation:none; } }

/* подсказка-приглашение с аватаром дежурного менеджера */
.h4y-chat-nudge{ position:absolute; right:74px; bottom:6px; min-width:250px; display:flex; align-items:center; gap:10px;
    background:#fff; color:var(--ink); border:1px solid var(--line); border-radius:16px; border-bottom-right-radius:5px;
    padding:9px 30px 9px 9px; box-shadow:0 14px 34px rgba(42,38,32,.2);
    opacity:0; transform:translateY(6px) scale(.97); pointer-events:none; transition:opacity .45s ease, transform .45s ease; }
.h4y-chat-nudge.is-show{ opacity:1; transform:translateY(0) scale(1); pointer-events:auto; cursor:pointer; }
.h4y-chat-nudge-ava{ width:46px; height:46px; min-width:46px; border-radius:50%; object-fit:cover; flex:0 0 auto;
    background:linear-gradient(135deg,var(--c),var(--c2)); }
.h4y-chat-nudge-ava--ph{ display:flex; align-items:center; justify-content:center; font-weight:700; font-size:19px; color:#fff; }
.h4y-chat-nudge-body{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.h4y-chat-nudge-name{ display:flex; align-items:center; gap:6px; font-weight:700; font-size:12.5px; color:var(--ink); }
.h4y-chat-nudge-dot{ width:7px; height:7px; border-radius:50%; background:#27c06a; flex:0 0 auto; box-shadow:0 0 0 3px rgba(39,192,106,.18); }
.h4y-chat-nudge-txt{ font-size:13px; line-height:1.35; color:#5b5547; }
.h4y-chat-nudge-x{ position:absolute; top:5px; right:7px; border:0; background:transparent; color:#bdb4a2; font-size:18px;
    line-height:1; cursor:pointer; padding:2px 4px; border-radius:6px; }
.h4y-chat-nudge-x:hover{ color:var(--c2); background:#f3efe6; }
.h4y-chat.is-open .h4y-chat-nudge{ display:none; }
@media (max-width:480px){ .h4y-chat-nudge{ right:70px; } }

.h4y-chat-panel{ position:absolute; right:0; bottom:0; width:384px; max-width:calc(100vw - 32px);
    height:580px; max-height:calc(100vh - 100px); background:var(--bg); border:1px solid var(--line);
    border-radius:20px; box-shadow:0 24px 70px rgba(42,38,32,.26); display:flex; flex-direction:column; overflow:hidden; }

/* ШАПКА — светлая: аватар | имя · кнопки (сверху) | статус в одну строку */
.h4y-chat-head{ display:grid; grid-template-columns:auto 1fr auto;
    grid-template-areas:"ava title btns" "ava status status";
    align-items:center; column-gap:11px; row-gap:1px; padding:11px 14px;
    background:#fff; border-bottom:1px solid var(--line); }
.h4y-chat-ava{ grid-area:ava; width:60px; height:60px; border-radius:50%; object-fit:cover; flex:0 0 auto;
    background:linear-gradient(135deg,var(--c),var(--c2)); }
.h4y-chat-ava--ph{ display:flex; align-items:center; justify-content:center; font-weight:700; font-size:18px; color:#fff; }
.h4y-chat-title{ grid-area:title; font-weight:700; font-size:15px; color:var(--ink); line-height:1.2;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis; align-self:end; }
.h4y-chat-status{ grid-area:status; font-size:11px; color:var(--muted); line-height:1.25;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis; align-self:start; }
.h4y-chat-head-btns{ grid-area:btns; display:flex; align-items:flex-start; gap:2px; align-self:start; }
.h4y-chat-ico{ border:0; background:transparent; color:#b4ab99; cursor:pointer; padding:5px;
    display:inline-flex; border-radius:8px; transition:background .15s, color .15s; }
.h4y-chat-ico:hover{ background:#f3efe6; color:var(--c2); }
.h4y-chat-ico svg{ width:17px; height:17px; }

.h4y-chat-preview{ background:#fcf6e6; color:#9a6a00; font-size:11.5px; text-align:center; padding:4px 10px; border-bottom:1px solid #f1e3c4; }

/* ТЕЛО */
.h4y-chat-body{ flex:1 1 auto; overflow-y:auto; padding:16px 14px; display:flex; flex-direction:column; gap:10px; background:var(--bg); }

/* ПУЗЫРИ */
.h4y-chat-msg{ max-width:84%; padding:9px 12px 7px; border-radius:16px; font-size:14px; line-height:1.42;
    white-space:pre-wrap; word-wrap:break-word; position:relative; }
.h4y-chat-msg-txt{ display:block; }
.h4y-chat-msg--bot{ align-self:flex-start; background:#f1f2f4; color:var(--ink); border-bottom-left-radius:5px; }
.h4y-chat-msg--me{ align-self:flex-end; background:#faf4e6; color:var(--ink); border:1px solid #ecdfc2; border-bottom-right-radius:5px; }
.h4y-chat-time{ display:block; text-align:right; font-size:10.5px; margin-top:3px; opacity:.7; }
.h4y-chat-msg--bot .h4y-chat-time{ color:var(--muted); }
.h4y-chat-msg--me .h4y-chat-time{ color:#b6a988; }
.h4y-chat-check{ color:var(--gold); letter-spacing:-2px; }

/* КАРТОЧКИ */
.h4y-chat-cards{ display:flex; flex-direction:column; gap:10px; align-self:stretch; }
.h4y-chat-card{ display:flex; align-items:stretch; gap:11px; text-decoration:none; color:inherit; background:#fff;
    border:1px solid var(--line); border-radius:14px; overflow:hidden; transition:border-color .15s, box-shadow .15s, transform .15s; }
.h4y-chat-card:hover{ border-color:var(--c); box-shadow:0 6px 18px rgba(184,138,50,.14); transform:translateY(-1px); }
.h4y-chat-card-img{ width:98px; min-width:98px; height:90px; object-fit:cover; background:#eee9dd; }
.h4y-chat-card-body{ padding:9px 2px 9px 0; display:flex; flex-direction:column; justify-content:center; min-width:0; flex:1 1 auto; }
.h4y-chat-card-title{ font-weight:600; font-size:13.5px; color:var(--ink); line-height:1.25;
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.h4y-chat-card-meta{ font-size:12px; color:var(--muted); margin-top:4px; }
.h4y-chat-card-price{ font-weight:700; color:var(--c2); font-size:14px; margin-top:4px; }
.h4y-chat-card-chev{ display:flex; align-items:center; color:#cdc4b2; padding-right:10px; flex:0 0 auto; }
.h4y-chat-card-chev svg{ width:18px; height:18px; }

/* ПОДВАЛ / ВВОД */
.h4y-chat-foot{ display:flex; gap:9px; padding:11px 12px; border-top:1px solid var(--line); background:#fff; }
.h4y-chat-foot input{ flex:1 1 auto; border:1px solid var(--line); border-radius:24px; padding:11px 15px; font-size:14px; outline:none; background:var(--bg); color:var(--ink); }
.h4y-chat-foot input:focus{ border-color:var(--c); box-shadow:0 0 0 3px rgba(201,162,75,.14); background:#fff; }
.h4y-chat-foot button{ width:44px; min-width:44px; height:44px; border:0; border-radius:50%; cursor:pointer;
    background:linear-gradient(135deg,var(--c),var(--c2)); color:#fff; display:flex; align-items:center; justify-content:center;
    box-shadow:0 4px 12px rgba(184,138,50,.32); transition:transform .15s; }
.h4y-chat-foot button:hover{ transform:scale(1.05); }
.h4y-chat-foot button svg{ width:18px; height:18px; }
.h4y-chat-foot button:disabled{ opacity:.5; cursor:default; transform:none; }

@media (max-width:480px){
    .h4y-chat{ right:14px; bottom:14px; }
    .h4y-chat-panel{ width:calc(100vw - 20px); height:calc(100vh - 90px); }
}

/* форма лид-захвата */
.h4y-chat-leadform{ align-self:stretch; background:#fff; border:1px solid var(--line); border-radius:14px; padding:13px; display:flex; flex-direction:column; gap:9px; }
.h4y-chat-leadform input{ border:1px solid var(--line); border-radius:11px; padding:10px 12px; font-size:14px; outline:none; color:var(--ink); }
.h4y-chat-leadform input:focus{ border-color:var(--c); box-shadow:0 0 0 3px rgba(201,162,75,.14); }
.h4y-chat-leadform button{ border:0; border-radius:11px; padding:11px 14px; font-weight:700; font-size:14px; cursor:pointer;
    background:linear-gradient(135deg,var(--c),var(--c2)); color:#fff; }
.h4y-chat-leadform button:disabled{ opacity:.6; cursor:default; }
.h4y-chat-leaderr{ color:#d33; font-size:12.5px; }

/* индикатор «печатает…» с анимированными точками */
.h4y-chat-typing{ align-self:flex-start; display:flex; align-items:center; gap:8px; color:var(--muted); font-size:13px;
    background:var(--bot-bg); padding:8px 12px; border-radius:16px; border-bottom-left-radius:5px; }
.h4y-chat-dots{ display:inline-flex; gap:3px; }
.h4y-chat-dots i{ width:5px; height:5px; border-radius:50%; background:var(--c); opacity:.4; animation:h4ydot 1s infinite ease-in-out; }
.h4y-chat-dots i:nth-child(2){ animation-delay:.15s; }
.h4y-chat-dots i:nth-child(3){ animation-delay:.3s; }
@keyframes h4ydot{ 0%,60%,100%{ transform:translateY(0); opacity:.35; } 30%{ transform:translateY(-4px); opacity:1; } }

/* плавное появление карточек (по одной) */
.h4y-chat-card--in{ opacity:0; transform:translateY(8px); transition:opacity .35s ease, transform .35s ease; }
.h4y-chat-card--in.is-in{ opacity:1; transform:translateY(0); }

/* Когда чат активен, плавающие кнопки темы «Вверх»/«Написать» не нужны —
   этот файл грузится только при включённом виджете, так что правило само
   перестаёт действовать, если чат выключен. */
a.backtop, a.contact-box{ display:none !important; }

/* Мобильная панель контактов менеджера на странице объекта (WhatsApp/звонок/чат):
   когда бот включён — общение и лид ведёт он, поэтому панель прячем.
   Файл грузится только при активном виджете → при выключенном боте панель снова видна. */
.mobile_agent_area_wrapper{ display:none !important; }

.h4y-chat-leadform textarea{ width:100%; box-sizing:border-box; border:1px solid #d9dbe6; border-radius:10px; padding:9px 11px; font-size:14px; font-family:inherit; resize:vertical; min-height:42px; margin-top:6px; }
