/* NARTOS — чат-консультант: кнопка, панель, диалог */

.chat-fab{
  position:fixed;right:22px;bottom:22px;z-index:70;
  transition:bottom .3s var(--ease);
  width:64px;height:64px;border-radius:50%;
  background:var(--brick);color:#fff;display:grid;place-items:center;
  box-shadow:0 10px 30px rgba(198,63,23,.36);
  transition:transform .25s var(--ease),background .25s;
}
.chat-fab:hover{background:var(--brick-dark);transform:translateY(-3px) scale(1.03)}
.chat-fab.is-open{background:var(--ink)}
.chat-fab__dot{
  position:absolute;right:2px;top:2px;width:14px;height:14px;border-radius:50%;
  background:#2FA36B;border:3px solid var(--paper);
}
.chat-fab svg{transition:transform .3s var(--ease)}
.chat-fab.is-open svg{transform:rotate(90deg) scale(.9)}

/* пока висит cookie-баннер, кнопка чата уходит выше, чтобы они не наезжали друг на друга */
body.has-cookie .chat-fab{bottom:210px}
body.has-cookie .chat-panel{bottom:284px;height:min(460px,calc(100vh - 330px))}
body.has-cookie .chat-hint{display:none}
/* пока открыто мобильное меню, чат не должен висеть поверх него */
body.menu-open .chat-fab,body.menu-open .chat-hint,body.menu-open .chat-panel{display:none}

/* подсказка-приглашение */
.chat-hint{
  position:fixed;right:96px;bottom:34px;z-index:69;max-width:250px;
  background:#fff;border:1px solid var(--line);border-radius:16px 16px 4px 16px;
  padding:14px 16px;box-shadow:var(--shadow-l);font-size:15px;line-height:1.45;
  animation:hintIn .5s var(--ease) both;
}
.chat-hint b{display:block;font-family:'Geologica',sans-serif;font-size:14.5px;margin-bottom:3px}
.chat-hint__x{position:absolute;right:6px;top:4px;font-size:17px;color:var(--ink-3);padding:6px 8px;line-height:1}
@keyframes hintIn{from{opacity:0;transform:translateY(10px) scale(.96)}to{opacity:1;transform:none}}

/* панель */
.chat-panel{
  position:fixed;right:22px;bottom:100px;z-index:70;
  width:min(390px,calc(100vw - 32px));height:min(560px,calc(100vh - 150px));
  background:var(--paper);border:1px solid var(--line);border-radius:var(--r-xl);
  box-shadow:0 30px 80px rgba(21,18,14,.28);
  display:flex;flex-direction:column;overflow:hidden;
  transform-origin:bottom right;animation:panelIn .3s var(--ease) both;
}
@keyframes panelIn{from{opacity:0;transform:translateY(14px) scale(.97)}to{opacity:1;transform:none}}

.chat-head{
  display:flex;align-items:center;gap:12px;padding:16px 18px;
  background:var(--coal);color:var(--paper);flex:0 0 auto;
}
.chat-head__ava{
  width:42px;height:42px;border-radius:50%;flex:0 0 auto;display:grid;place-items:center;
  background:linear-gradient(150deg,#E4703F,var(--brick));
  font-family:'Unbounded',sans-serif;font-weight:700;font-size:17px;color:#fff;
}
.chat-head__t b{display:block;font-family:'Geologica',sans-serif;font-weight:600;font-size:16px}
.chat-head__t span{display:block;font-size:13px;color:#A99E8F;display:flex;align-items:center;gap:6px}
.chat-head__t i{width:7px;height:7px;border-radius:50%;background:#2FD07A;display:inline-block}
.chat-head__x{margin-left:auto;color:#A99E8F;font-size:22px;line-height:1;padding:8px 10px;border-radius:8px}
.chat-head__x:hover{background:rgba(255,255,255,.1);color:#fff}

.chat-log{flex:1;overflow-y:auto;padding:18px;display:flex;flex-direction:column;gap:12px}
.chat-log::-webkit-scrollbar{width:7px}
.chat-log::-webkit-scrollbar-thumb{background:var(--line);border-radius:99px}

.bub{
  max-width:85%;padding:13px 16px;border-radius:18px;font-size:15.5px;line-height:1.5;
  animation:bubIn .28s var(--ease) both;
}
@keyframes bubIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.bub--bot{background:#fff;border:1px solid var(--line);border-bottom-left-radius:5px;align-self:flex-start}
.bub--me{background:var(--brick);color:#fff;border-bottom-right-radius:5px;align-self:flex-end}
.bub b{font-weight:600}
.bub a{color:var(--brick);text-underline-offset:3px}
.bub--me a{color:#fff}
.bub ul{margin:8px 0 0;padding-left:0;list-style:none}
.bub li{position:relative;padding-left:16px;margin-bottom:5px}
.bub li::before{content:'';position:absolute;left:2px;top:.62em;width:5px;height:5px;
  background:var(--brick);transform:rotate(45deg);border-radius:1px}

.chat-typing{display:flex;gap:4px;padding:14px 16px;background:#fff;border:1px solid var(--line);
  border-radius:18px;border-bottom-left-radius:5px;align-self:flex-start;width:fit-content}
.chat-typing i{width:7px;height:7px;border-radius:50%;background:var(--ink-3);animation:bub 1.1s infinite}
.chat-typing i:nth-child(2){animation-delay:.15s}
.chat-typing i:nth-child(3){animation-delay:.3s}
@keyframes bub{0%,60%,100%{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-4px)}}

.chat-quick{display:flex;flex-wrap:wrap;gap:8px;padding:0 18px 12px}
.chat-quick button{
  padding:9px 14px;border-radius:99px;background:#fff;border:1.5px solid var(--line);
  font-size:14.5px;font-family:'Geologica',sans-serif;transition:.2s;min-height:40px;
}
.chat-quick button:hover{border-color:var(--brick);color:var(--brick)}

.chat-bar{
  display:flex;gap:9px;padding:12px 14px;border-top:1px solid var(--line);background:#fff;flex:0 0 auto;
}
.chat-bar input{
  flex:1;min-width:0;border:1.5px solid var(--line);border-radius:99px;padding:12px 16px;
  font-size:15.5px;background:var(--paper);transition:border-color .2s;
}
.chat-bar input:focus{outline:none;border-color:var(--brick)}
.chat-bar button{
  width:46px;height:46px;flex:0 0 auto;border-radius:50%;background:var(--brick);color:#fff;
  display:grid;place-items:center;transition:.2s;
}
.chat-bar button:hover{background:var(--brick-dark)}

.chat-legal{padding:0 18px 12px;font-size:12.5px;color:var(--ink-3);line-height:1.45}
.chat-legal a{color:var(--brick)}

@media (max-width:760px){
  .chat-fab{right:16px;bottom:86px;width:58px;height:58px}
  .chat-panel{right:8px;left:8px;bottom:80px;width:auto;height:min(70vh,540px)}
  .chat-hint{right:84px;bottom:96px;max-width:210px;font-size:14px}
  body.has-cookie .chat-fab,body.has-cookie .chat-hint{display:none}
}
@media (prefers-reduced-motion:reduce){
  .chat-panel,.bub,.chat-hint{animation:none}
}
