/* Back Future AI Assistant — безопасный фирменный виджет */
#bttfAiFab,#bttfAiPanel,#bttfAiToast{font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;box-sizing:border-box}
#bttfAiFab{position:fixed;right:18px;bottom:18px;z-index:999980;width:74px;height:52px;border:1px solid rgba(0,255,190,.32);border-radius:999px;background:radial-gradient(circle at 50% 45%,rgba(0,255,190,.17),rgba(2,6,23,.98) 64%);box-shadow:0 0 0 1px rgba(255,255,255,.05),0 18px 55px rgba(0,0,0,.48),0 0 36px rgba(0,255,190,.16);cursor:pointer;transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease;overflow:hidden;color:#dffef5}
#bttfAiFab:hover{transform:translateY(-2px) scale(1.035);border-color:rgba(0,255,190,.62);box-shadow:0 18px 60px rgba(0,0,0,.55),0 0 46px rgba(0,255,190,.28)}
#bttfAiFab:active{transform:translateY(0) scale(.99)}
#bttfAiFab .bttf-ai-eye{position:absolute;top:16px;width:18px;height:18px;border-radius:999px;background:#12ffc4;box-shadow:0 0 12px rgba(18,255,196,.95),0 0 26px rgba(18,255,196,.32);transition:transform .18s ease,opacity .18s ease,background .18s ease}
#bttfAiFab .bttf-ai-eye.left{left:18px}#bttfAiFab .bttf-ai-eye.right{right:18px}
#bttfAiFab .bttf-ai-eye:after{content:"";position:absolute;left:6px;top:6px;width:5px;height:5px;border-radius:999px;background:rgba(0,26,22,.9)}
#bttfAiFab .bttf-ai-label{position:absolute;left:74px;top:15px;font-size:13px;font-weight:900;white-space:nowrap;color:#eafffb;opacity:0;transition:opacity .16s ease}
#bttfAiFab:hover{width:178px}#bttfAiFab:hover .bttf-ai-label{opacity:1}
#bttfAiFab.bttf-ai-thinking .bttf-ai-eye{animation:bttfAiPulse .72s infinite alternate}
#bttfAiFab.bttf-ai-listening .bttf-ai-eye{background:#4bd7ff;box-shadow:0 0 14px rgba(75,215,255,.95),0 0 30px rgba(75,215,255,.4);animation:bttfAiListen .55s infinite alternate}
#bttfAiFab.bttf-ai-speaking .bttf-ai-eye{animation:bttfAiSpeak .34s infinite alternate}
@keyframes bttfAiPulse{from{opacity:.62;transform:scale(.82)}to{opacity:1;transform:scale(1.08)}}
@keyframes bttfAiListen{from{transform:translateY(1px) scale(.84)}to{transform:translateY(-2px) scale(1.14)}}
@keyframes bttfAiSpeak{from{transform:scale(.72)}to{transform:scale(1.16)}}
#bttfAiPanel{position:fixed;right:18px;bottom:84px;z-index:999981;width:min(440px,calc(100vw - 36px));height:min(680px,calc(100vh - 118px));display:none;overflow:hidden;border-radius:24px;border:1px solid rgba(0,255,190,.22);background:linear-gradient(180deg,rgba(7,16,30,.98),rgba(2,6,23,.98));box-shadow:0 24px 90px rgba(0,0,0,.58),0 0 60px rgba(0,255,190,.12);color:#e8eefc}
#bttfAiPanel.open{display:flex;flex-direction:column}
.bttf-ai-head{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid rgba(255,255,255,.09);background:linear-gradient(90deg,rgba(0,255,190,.12),rgba(75,215,255,.06))}
.bttf-ai-title{display:flex;gap:10px;align-items:center;font-weight:950;letter-spacing:.01em}.bttf-ai-title small{display:block;font-size:11px;font-weight:700;color:#99f6e4;margin-top:2px}.bttf-ai-mini-eyes{position:relative;width:42px;height:28px;border-radius:999px;background:rgba(0,0,0,.22);border:1px solid rgba(0,255,190,.18)}.bttf-ai-mini-eyes:before,.bttf-ai-mini-eyes:after{content:"";position:absolute;top:9px;width:10px;height:10px;border-radius:999px;background:#12ffc4;box-shadow:0 0 12px rgba(18,255,196,.9)}.bttf-ai-mini-eyes:before{left:9px}.bttf-ai-mini-eyes:after{right:9px}
.bttf-ai-close{border:0;background:transparent;color:#e8eefc;font-size:24px;line-height:1;cursor:pointer;padding:4px 8px;border-radius:10px}.bttf-ai-close:hover{background:rgba(255,255,255,.08)}
.bttf-ai-body{flex:1;overflow:auto;padding:14px;background:radial-gradient(circle at 50% 12%,rgba(0,255,190,.05),transparent 42%)}
.bttf-ai-msg{max-width:92%;margin:0 0 12px;padding:11px 13px;border-radius:16px;line-height:1.43;font-size:14px;white-space:pre-wrap}.bttf-ai-msg.bot{background:rgba(15,23,42,.88);border:1px solid rgba(255,255,255,.09);color:#e8eefc;border-top-left-radius:6px}.bttf-ai-msg.user{margin-left:auto;background:linear-gradient(135deg,rgba(0,255,190,.18),rgba(37,99,235,.18));border:1px solid rgba(0,255,190,.22);color:#f8ffff;border-top-right-radius:6px}.bttf-ai-msg .bttf-ai-meta{display:block;margin-top:8px;font-size:11px;color:#8da7c7}
.bttf-ai-quick{display:flex;gap:8px;flex-wrap:wrap;padding:0 14px 10px;background:rgba(2,6,23,.98)}.bttf-ai-chip{border:1px solid rgba(255,255,255,.12);border-radius:999px;background:rgba(255,255,255,.045);color:#dbeafe;font-weight:800;font-size:12px;padding:8px 10px;cursor:pointer}.bttf-ai-chip:hover{border-color:rgba(0,255,190,.36);background:rgba(0,255,190,.08);color:#fff}
.bttf-ai-compose{padding:12px;border-top:1px solid rgba(255,255,255,.09);background:rgba(2,6,23,.98)}.bttf-ai-tools{display:flex;gap:8px;margin-bottom:8px}.bttf-ai-tool{border:1px solid rgba(255,255,255,.13);background:rgba(255,255,255,.045);color:#e8eefc;border-radius:12px;padding:8px 10px;font-weight:850;cursor:pointer}.bttf-ai-tool:hover{background:rgba(255,255,255,.09)}.bttf-ai-input-row{display:flex;gap:8px;align-items:flex-end}.bttf-ai-input{flex:1;min-height:46px;max-height:126px;resize:vertical;border:1px solid rgba(255,255,255,.14);border-radius:16px;background:#020617;color:#fff;outline:none;padding:12px;font-size:14px}.bttf-ai-send{border:0;border-radius:16px;background:#12ffc4;color:#022016;font-weight:950;padding:0 16px;height:46px;cursor:pointer}.bttf-ai-send:disabled{opacity:.55;cursor:not-allowed}
.bttf-ai-feedback{display:flex;gap:7px;flex-wrap:wrap;margin-top:8px}.bttf-ai-feedback button{border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.045);color:#dbeafe;border-radius:999px;padding:6px 9px;font-size:12px;font-weight:800;cursor:pointer}.bttf-ai-feedback button:hover{background:rgba(75,215,255,.10);color:#fff}.bttf-ai-danger{color:#fecaca!important;border-color:rgba(248,113,113,.25)!important}
#bttfAiToast{position:fixed;right:18px;bottom:148px;z-index:999982;display:none;max-width:360px;border:1px solid rgba(0,255,190,.22);border-radius:14px;background:#06251e;color:#dffef5;padding:11px 13px;box-shadow:0 12px 40px rgba(0,0,0,.38);font-size:13px;font-weight:760}
@media(max-width:560px){#bttfAiFab{right:14px;bottom:14px}#bttfAiFab:hover{width:74px}#bttfAiFab:hover .bttf-ai-label{opacity:0}#bttfAiPanel{right:10px;bottom:76px;width:calc(100vw - 20px);height:calc(100vh - 96px);border-radius:20px}.bttf-ai-msg{max-width:96%}.bttf-ai-tools{flex-wrap:wrap}.bttf-ai-tool{font-size:12px;padding:7px 9px}}

/* =========================================================
   BTTF AI v4 — language selector / multilingual voice UI
   ========================================================= */
.bttf-ai-head-tools{
  display:flex;
  align-items:center;
  gap:8px;
  margin-left:auto;
}
.bttf-ai-lang-label{
  font-size:11px;
  opacity:.75;
  color:#d7fff0;
}
.bttf-ai-lang{
  max-width:135px;
  height:30px;
  border-radius:10px;
  border:1px solid rgba(0,255,180,.22);
  background:rgba(0,0,0,.45);
  color:#fff;
  padding:0 8px;
  outline:none;
  font-size:12px;
}
.bttf-ai-lang:focus{
  border-color:rgba(0,255,180,.55);
  box-shadow:0 0 0 2px rgba(0,255,180,.09);
}
@media(max-width:520px){
  .bttf-ai-head-tools{gap:5px;}
  .bttf-ai-lang-label{display:none;}
  .bttf-ai-lang{max-width:104px;font-size:11px;padding:0 5px;}
}

/* =========================================================
   BTTF AI v6 — safe navigation buttons
   ========================================================= */
.bttf-ai-chip-open{
  border-color:rgba(0,255,190,.34)!important;
  background:linear-gradient(135deg,rgba(0,255,190,.12),rgba(75,215,255,.10))!important;
  color:#eafffb!important;
}
.bttf-ai-chip-open:hover{
  border-color:rgba(0,255,190,.62)!important;
  background:linear-gradient(135deg,rgba(0,255,190,.18),rgba(75,215,255,.16))!important;
}

/* =========================================================
   BTTF AI v8 — custom eyes image from admin settings
   ========================================================= */
#bttfAiFab.bttf-ai-custom-eyes{
  background-image:var(--bttf-ai-eyes-img), radial-gradient(circle at 50% 45%,rgba(0,255,190,.17),rgba(2,6,23,.98) 64%);
  background-repeat:no-repeat;
  background-position:center;
  background-size:contain;
}
#bttfAiFab.bttf-ai-custom-eyes .bttf-ai-eye{display:none;}
.bttf-ai-mini-eyes.bttf-ai-custom-mini{
  background-repeat:no-repeat!important;
  background-position:center!important;
  background-size:contain!important;
}
.bttf-ai-mini-eyes.bttf-ai-custom-mini:before,
.bttf-ai-mini-eyes.bttf-ai-custom-mini:after{display:none!important;}
.ai-face-wrap.bttf-ai-custom-hero-eyes .eye{display:none!important;}
.ai-face-wrap.bttf-ai-custom-hero-eyes:before{
  content:"";
  position:absolute;
  left:50%;
  top:39%;
  transform:translate(-50%,-50%);
  width:34%;
  height:17%;
  background-image:var(--bttf-ai-hero-eyes-img);
  background-repeat:no-repeat;
  background-position:center;
  background-size:contain;
  z-index:4;
  filter:drop-shadow(0 0 24px rgba(0,255,180,.48));
  pointer-events:none;
}
@media(max-width:768px){
  .ai-face-wrap.bttf-ai-custom-hero-eyes:before{width:40%;height:20%;}
}


/* =========================================================
   BTTF AI v10 — Professional Voice AI
   ========================================================= */
.bttf-ai-voice-status{
  margin:-2px 0 8px;
  font-size:11px;
  line-height:1.35;
  color:#9fb0c3;
  display:flex;
  align-items:center;
  gap:6px;
}
.bttf-ai-voice-status:before{
  content:"";
  width:7px;
  height:7px;
  border-radius:50%;
  background:#12ffc4;
  box-shadow:0 0 10px rgba(18,255,196,.7);
  flex:0 0 auto;
}
#bttfAiFab.bttf-ai-listening:after,
#bttfAiFab.bttf-ai-speaking:after{
  content:"";
  position:absolute;
  inset:5px;
  border-radius:999px;
  border:1px solid rgba(75,215,255,.35);
  animation:bttfAiVoiceHalo .75s ease-in-out infinite alternate;
  pointer-events:none;
}
@keyframes bttfAiVoiceHalo{from{opacity:.35;transform:scale(.92)}to{opacity:1;transform:scale(1.04)}}


/* =========================================================
   BTTF AI v18 — Stop button always visible
   ========================================================= */
.bttf-ai-tools{
  flex-wrap:wrap!important;
}
#bttfAiStop{
  flex:1 1 100%!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  background:rgba(248,113,113,.10)!important;
}
.bttf-ai-head-stop{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  min-width:34px!important;
  height:30px!important;
  padding:0 9px!important;
  border-radius:10px!important;
  border:1px solid rgba(248,113,113,.34)!important;
  background:rgba(248,113,113,.12)!important;
  color:#fecaca!important;
  font-weight:950!important;
  line-height:1!important;
  cursor:pointer!important;
}
.bttf-ai-head-stop:hover{
  background:rgba(248,113,113,.22)!important;
  color:#fff!important;
}
@media(max-width:520px){
  .bttf-ai-head-stop{min-width:32px!important;height:28px!important;padding:0 7px!important;}
}

/* =========================================================
   BTTF AI v19 — smart voice button + user auto voice checkbox
   Одна кнопка меняет состояние: "Озвучить ответ" ⇄ "Остановить разговор".
   Птичка "Всегда отвечать голосом" сохраняется для пользователя в браузере.
   ========================================================= */
.bttf-ai-tools{
  flex-wrap:wrap!important;
  align-items:center!important;
}
#bttfAiSpeak.bttf-ai-danger{
  background:rgba(248,113,113,.12)!important;
  border-color:rgba(248,113,113,.34)!important;
  color:#fecaca!important;
}
#bttfAiSpeak.bttf-ai-danger:hover{
  background:rgba(248,113,113,.22)!important;
  color:#fff!important;
}
.bttf-ai-autovoice{
  display:inline-flex!important;
  align-items:center!important;
  gap:7px!important;
  min-height:38px!important;
  padding:7px 10px!important;
  border-radius:12px!important;
  border:1px solid rgba(0,255,190,.16)!important;
  background:rgba(0,255,190,.045)!important;
  color:#dffef5!important;
  font-size:11.5px!important;
  line-height:1.15!important;
  font-weight:800!important;
  cursor:pointer!important;
  user-select:none!important;
  flex:1 1 100%!important;
}
.bttf-ai-autovoice input{
  width:16px!important;
  height:16px!important;
  accent-color:#12ffc4!important;
  cursor:pointer!important;
  flex:0 0 auto!important;
}
.bttf-ai-autovoice span{
  white-space:normal!important;
}
#bttfAiStop{
  display:none!important;
}
@media(min-width:440px){
  .bttf-ai-autovoice{
    flex:1 1 auto!important;
  }
}
@media(max-width:520px){
  .bttf-ai-autovoice{
    font-size:11px!important;
    padding:7px 9px!important;
  }
}
