/* ===== LIVE CHAT WIDGET ===== */
.bubble-btn {
  position: fixed; bottom: 88px; right: 24px; z-index: 999;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--accent); color: #06140a; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px -6px rgba(63,174,77,0.55);
  transition: transform 0.2s;
  animation: pulseRing 3s ease-in-out infinite;
}
.bubble-btn:hover { transform: translateY(-2px) scale(1.04); }
.bubble-btn svg { width: 24px; height: 24px; }
.bubble-btn .close-icon { display: none; }
.bubble-btn.open .chat-icon { display: none; }
.bubble-btn.open .close-icon { display: block; }
@keyframes pulseRing {
  0%, 100% { box-shadow: 0 10px 30px -6px rgba(63,174,77,0.55), 0 0 0 0 rgba(95,214,111,0.35); }
  50%       { box-shadow: 0 10px 30px -6px rgba(63,174,77,0.55), 0 0 0 10px rgba(95,214,111,0); }
}
.bubble-badge {
  position: absolute; top: -4px; right: -4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #e05a5a; border: 2px solid var(--bg);
}
.widget-panel {
  position: fixed; bottom: 160px; right: 24px; z-index: 998;
  width: 360px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 140px);
  background: var(--card-dark);
  border: 1px solid var(--divider-dark);
  border-radius: 14px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.7);
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.widget-panel.open { transform: scale(1) translateY(0); opacity: 1; pointer-events: auto; }
.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--divider-dark);
  background: #0f1712;
}
.chat-head .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-bright); box-shadow: 0 0 8px var(--accent-bright); }
.chat-head .head-text { display: flex; flex-direction: column; }
.chat-head .name { font-size: 12.5px; font-weight: 600; }
.chat-head .status { font-family: var(--mono); font-size: 9.5px; color: var(--mute-on-dark); }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; flex-direction: column; max-width: 86%; }
.msg-bot { align-self: flex-start; }
.msg-user { align-self: flex-end; align-items: flex-end; }
.msg-tag {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--accent-bright); margin-bottom: 3px; padding-left: 2px;
}
/* Имя сотрудника над репликой. Клиент должен видеть, что отвечает
   человек: стиль ответов меняется посреди разговора, и необъяснённая
   смена читается как поломка. */
.msg-who {
  font-size: 10.5px; letter-spacing: 0.04em; color: var(--accent-bright);
  margin-bottom: 3px; padding-left: 2px;
}
.msg-bubble { padding: 10px 12px; border-radius: 12px; font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; }
.msg-bot .msg-bubble { background: #1c2820; color: var(--text-light); border-bottom-left-radius: 4px; }
.msg-user .msg-bubble { background: var(--accent); color: #06140a; font-weight: 500; border-bottom-right-radius: 4px; }
.msg-typing .msg-bubble { display: flex; gap: 4px; padding: 12px 14px; }
.msg-typing .msg-bubble span { width: 5px; height: 5px; border-radius: 50%; background: var(--mute-on-dark); animation: typingDot 1.1s infinite ease-in-out; }
.msg-typing .msg-bubble span:nth-child(2) { animation-delay: 0.15s; }
.msg-typing .msg-bubble span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot { 0%,60%,100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.cta-bubble { background: #1c2820 !important; border: 1px solid var(--accent); }
.cta-text { margin-bottom: 10px; }
.cta-buttons { display: flex; gap: 8px; }
.cta-btn {
  font-family: inherit; font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  border: none; border-radius: 50px; padding: 8px 12px; cursor: pointer; transition: transform 0.15s;
}
.cta-yes { background: var(--accent); color: #06140a; }
.cta-no { background: transparent; color: var(--mute-on-dark); border: 1px solid var(--divider-dark); }
.cta-btn:hover { transform: translateY(-1px); }
.cta-btn:disabled { opacity: 0.6; cursor: progress; transform: none; }
.lead-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.lead-form input, .lead-form textarea {
  background: #0a0f0a; border: 1px solid var(--divider-dark); border-radius: 6px;
  padding: 9px 11px; color: var(--text-light); font-family: inherit; font-size: 11.5px; outline: none;
}
.lead-form textarea { min-height: 64px; resize: vertical; line-height: 1.4; }
.lead-form input:focus, .lead-form textarea:focus { border-color: var(--accent); }
.lead-form .cta-btn { align-self: flex-start; }
.chat-form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--divider-dark); }
.chat-form input {
  flex: 1; background: #0a0f0a; border: 1px solid var(--divider-dark); border-radius: 8px;
  padding: 10px 12px; color: var(--text-light); font-family: inherit; font-size: 12.5px; outline: none;
}
.chat-form input::placeholder { color: var(--mute-on-dark); }
.chat-form input:focus { border-color: var(--accent); }
.chat-form button {
  background: var(--accent); color: #06140a; border: none; border-radius: 8px;
  padding: 0 14px; font-size: 12px; font-weight: 700; cursor: pointer; transition: transform 0.15s;
}
.chat-form button:hover { transform: translateY(-1px); }
@media (max-width: 420px) {
  .widget-panel { right: 16px; bottom: 152px; }
  .bubble-btn { right: 16px; bottom: 80px; }
}
