/* === Мессенджер «СТО Москва» (Консультант Sto) === */
/* Брендовые цвета Sto: #fad020 (фирменный жёлтый Sto), контрастный #1a1a1a */

#dk-messenger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  color: #222;
}

/* --- Кнопка запуска --- */
.dk-msgr-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #fad020;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(250, 208, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.dk-msgr-btn:hover { transform: scale(1.07); box-shadow: 0 8px 26px rgba(250, 208, 32, 0.7); }
.dk-msgr-btn svg { width: 30px; height: 30px; fill: #1a1a1a; }
.dk-msgr-btn.dk-msgr-open svg { display: none; }
.dk-msgr-btn .dk-msgr-x {
  display: none;
  color: #1a1a1a;
  font-size: 28px;
  line-height: 1;
  font-weight: 300;
}
.dk-msgr-btn.dk-msgr-open .dk-msgr-x { display: block; }

/* --- Бейдж непрочитанных --- */
.dk-msgr-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: #1a1a1a;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 2px solid #fff;
}
.dk-msgr-badge.dk-show { display: flex; }

/* --- Панель чата --- */
.dk-msgr-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(20, 20, 30, 0.35);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #eee;
}
.dk-msgr-panel.dk-show { display: flex; }

/* --- Шапка --- */
.dk-msgr-header {
  background: #fad020;
  color: #1a1a1a;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}
.dk-msgr-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.dk-msgr-avatar svg { width: 22px; height: 22px; fill: #1a1a1a; }
.dk-msgr-title { font-weight: 700; font-size: 15px; }
.dk-msgr-status { font-size: 12px; opacity: 0.9; display: flex; align-items: center; gap: 6px; }
.dk-msgr-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  flex: none;
}
.dk-msgr-dot.off { background: #f59e0b; }
.dk-msgr-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #1a1a1a;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  padding: 2px 6px;
  border-radius: 6px;
}
.dk-msgr-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.08); }

/* --- Лента сообщений --- */
.dk-msgr-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.dk-msg {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  word-wrap: break-word;
  animation: dk-msg-in 0.25s ease;
}
@keyframes dk-msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dk-msg a { color: #b45309; font-weight: 600; text-decoration: underline; }
.dk-msg a:hover { color: #d97706; }
.dk-msg b, .dk-msg strong { font-weight: 600; }
.dk-msg-bot a + br + a { display: inline-block; margin-top: 3px; }
.dk-msg-bot { background: #fff; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; align-self: flex-start; color: #222; }
.dk-msg-user { background: #fad020; color: #1a1a1a; border-bottom-right-radius: 4px; align-self: flex-end; font-weight: 500; }
.dk-msg-manager { background: #eff6ff; border: 1px solid #bfdbfe; border-bottom-left-radius: 4px; align-self: flex-start; }
.dk-msg-sys {
  align-self: center;
  background: transparent;
  color: #6b7280;
  font-size: 12px;
  padding: 4px 10px;
  max-width: 90%;
  text-align: center;
}
.dk-msg-meta { font-size: 10px; color: #9ca3af; margin-top: 3px; }
.dk-msg-bot .dk-msg-meta { color: #9ca3af; }
.dk-msg-user .dk-msg-meta { color: rgba(0, 0, 0, 0.6); }

/* --- Быстрые ответы --- */
.dk-msgr-quick {
  display: flex;
  gap: 7px;
  padding: 8px 12px 4px;
  overflow-x: auto;
  flex: none;
  background: #f8f9fa;
}
.dk-msgr-chip {
  flex: none;
  background: #fff;
  border: 1px solid #d1d5db;
  color: #374151;
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.dk-msgr-chip:hover { border-color: #f59e0b; color: #111; background: #fffbeb; }

/* --- Индикатор набора --- */
.dk-msgr-typing { display: flex; gap: 4px; padding: 2px 14px 8px; background: #f8f9fa; }
.dk-msgr-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #9ca3af;
  animation: dk-typing 1.2s infinite;
}
.dk-msgr-typing span:nth-child(2) { animation-delay: 0.2s; }
.dk-msgr-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dk-typing { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* --- Поле ввода --- */
.dk-msgr-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  flex: none;
}
.dk-msgr-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 22px;
  padding: 9px 15px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.dk-msgr-input:focus { border-color: #f59e0b; }
.dk-msgr-send {
  background: #fad020;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: transform 0.15s;
}
.dk-msgr-send:hover { transform: scale(1.08); }
.dk-msgr-send svg { width: 17px; height: 17px; fill: #1a1a1a; }
.dk-msgr-send:disabled { opacity: 0.5; cursor: default; transform: none; }

/* --- Офлайн-форма --- */
.dk-msgr-offline {
  padding: 18px 16px;
  background: #fff;
}
.dk-msgr-offline h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; color: #111; }
.dk-msgr-offline p { margin: 0 0 14px; color: #6b7280; font-size: 13px; line-height: 1.4; }
.dk-msgr-offline input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 10px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}
.dk-msgr-offline input:focus { border-color: #f59e0b; }
.dk-msgr-offline button {
  width: 100%;
  background: #fad020;
  color: #1a1a1a;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.dk-msgr-offline button:hover { background: #e5bd19; }

.dk-msgr-powered {
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  padding: 6px 0 8px;
  background: #fff;
  border-top: 1px solid #f3f4f6;
}
.dk-msgr-powered b { color: #1a1a1a; }

@media (max-width: 480px) {
  #dk-messenger { bottom: 16px; right: 16px; }
  .dk-msgr-panel { width: calc(100vw - 24px); height: calc(100vh - 96px); bottom: 72px; }
}
