/* Общий виджет "Поддержка 24/7" - подключается на всех страницах traffic911.ru
   через <link rel="stylesheet" href="/assets/support-chat.css"> +
   <script src="/assets/support-chat.js" defer></script>. Самодостаточный:
   зависит только от --bg/--text/--muted/--accent, которые определены на
   каждой странице сайта. Не использует --accent-2 (есть не везде) -
   вторые цвета градиентов захардкожены (#fff08f). */

.support-chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9990;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid rgba(255, 214, 0, 0.4);
  background: linear-gradient(135deg, #ffd600, #fff08f);
  color: #0d0d0d;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.support-chat-fab::before,
.support-chat-fab::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 214, 0, 0.55);
  animation: support-chat-pulse 2.2s ease-out infinite;
  pointer-events: none;
}
.support-chat-fab::after { animation-delay: 1.1s; }
.support-chat-fab.no-pulse::before,
.support-chat-fab.no-pulse::after { animation: none; display: none; }
@keyframes support-chat-pulse {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(1.9); opacity: 0; }
}
.support-chat-fab svg { width: 26px; height: 26px; }

.support-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 94px;
  z-index: 9991;
  width: min(360px, calc(100% - 32px));
  max-height: min(520px, calc(100vh - 120px));
  display: none;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid rgba(255, 214, 0, 0.3);
  background: #0a0a0a;
  box-shadow: 0 26px 72px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  font-family: Manrope, sans-serif;
}
.support-chat-panel.open { display: flex; }

.support-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 700;
  color: var(--text);
  flex: 0 0 auto;
}
.support-chat-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.support-chat-body {
  padding: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}
.support-chat-step { display: grid; gap: 10px; }
.support-chat-step[hidden] { display: none; }
.support-chat-question { margin: 0; font-size: 14px; color: var(--muted); }
.support-chat-question-secondary { margin-top: 8px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.support-chat-option { width: 100%; justify-content: center; }
.support-chat-input,
.support-chat-textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font: 500 14px/1.4 Manrope, sans-serif;
  padding: 10px 12px;
  box-sizing: border-box;
}
.support-chat-textarea { min-height: 88px; resize: vertical; }
.support-chat-thread { display: flex; flex-direction: column; flex: 1; min-height: 0; height: 100%; }
.support-chat-messages {
  flex: 1;
  min-height: 0;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}
.support-chat-msg { max-width: 82%; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4; word-break: break-word; }
.support-chat-msg.user { align-self: flex-end; background: linear-gradient(135deg, #ffd600, #fff08f); color: #0d0d0d; }
.support-chat-msg.admin { align-self: flex-start; background: rgba(255, 255, 255, 0.06); color: var(--text); }
.support-chat-input-row { display: flex; gap: 8px; margin-top: 10px; flex: 0 0 auto; }
.support-chat-input-row .support-chat-input { flex: 1; padding: 10px 12px; }
.support-chat-input-row button { padding: 10px 14px; }
.support-chat-error { padding: 10px 16px; color: #ff9e9e; font-size: 13px; }

.support-chat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14.5px;
  font-family: Manrope, sans-serif;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: var(--text);
}
.support-chat-btn:hover { border-color: #ffd600; color: #ffd600; }
.support-chat-btn-main {
  background: linear-gradient(135deg, #ffd600, #fff08f);
  color: #0d0d0d;
  border-color: transparent;
}
.support-chat-btn-main:hover { color: #0d0d0d; filter: brightness(1.05); }

@media (max-width: 480px) {
  .support-chat-fab { right: 16px; bottom: 16px; width: 52px; height: 52px; }
  .support-chat-panel { right: 12px; bottom: 82px; width: calc(100% - 24px); }
}

/* Промо-уведомление "имитация чата" рядом с кнопкой поддержки - привлекает
   внимание к бесплатному триалу. Показывается один раз за сессию браузера
   (sessionStorage), с задержкой после загрузки страницы. */
.support-chat-promo {
  position: fixed;
  right: 24px;
  bottom: 94px;
  z-index: 9989;
  width: min(300px, calc(100% - 32px));
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #100d02;
  border: 1px solid rgba(255, 214, 0, 0.35);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.55);
  font-family: Manrope, sans-serif;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.support-chat-promo.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.support-chat-promo-avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd600, #fff08f);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  position: relative;
}
.support-chat-promo-avatar::after {
  content: '';
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #3ddc73;
  border: 2px solid #100d02;
}
.support-chat-promo-body { flex: 1; min-width: 0; }
.support-chat-promo-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  margin: 0 0 4px;
}
.support-chat-promo-text {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--muted);
}
.support-chat-promo-actions { display: flex; align-items: center; gap: 10px; }
.support-chat-promo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffd600, #fff08f);
  color: #0d0d0d;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  border: 0;
  cursor: pointer;
}
.support-chat-promo-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
}
@media (max-width: 480px) {
  .support-chat-promo { right: 12px; bottom: 78px; width: calc(100% - 24px); }
}
