/* ============================================================
   Чат-бот Адвоката Шарипова Р.Ф. — стили виджета
   Цветовая схема совпадает с сайтом (navy + gold)
============================================================ */

#cb-root {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
}

/* ── Кнопка открытия ── */
#cb-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a2a4a 0%, #2c4a7c 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(26,42,74,0.45);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  color: #fff;
}
#cb-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(26,42,74,0.55);
}
#cb-toggle svg {
  width: 26px;
  height: 26px;
}

/* Бейдж-уведомление */
#cb-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: #c8993a;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  animation: cb-pulse 2s infinite;
}
@keyframes cb-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ── Окно чата ── */
#cb-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  max-height: 540px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 48px rgba(10,20,50,0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  border: 1px solid #e4e8f0;
}
#cb-window.cb-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Шапка ── */
#cb-header {
  background: linear-gradient(135deg, #1a2a4a 0%, #2c4a7c 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  flex-shrink: 0;
}
#cb-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c8993a, #e8b84b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #1a2a4a;
  flex-shrink: 0;
}
#cb-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}
#cb-info strong {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}
#cb-info span {
  font-size: 12px;
  color: #a8b8d0;
  margin-top: 1px;
}
#cb-status {
  font-size: 12px;
  color: #a8b8d0;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
#cb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  animation: cb-blink 2.5s infinite;
}
@keyframes cb-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Область сообщений ── */
#cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7f9fc;
  scroll-behavior: smooth;
}
#cb-messages::-webkit-scrollbar { width: 4px; }
#cb-messages::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 4px; }

.cb-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  gap: 3px;
}
.cb-msg--bot { align-self: flex-start; }
.cb-msg--user { align-self: flex-end; }

.cb-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 14px;
  word-break: break-word;
}
.cb-msg--bot .cb-bubble {
  background: #fff;
  color: #1e2c40;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.cb-msg--user .cb-bubble {
  background: linear-gradient(135deg, #1a2a4a, #2c4a7c);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.cb-time {
  font-size: 11px;
  color: #9aa5b4;
}
.cb-msg--user .cb-time { text-align: right; }

/* Анимация печати */
.cb-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  min-width: 56px;
}
.cb-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa5b4;
  animation: cb-bounce 1.2s infinite;
  display: inline-block;
}
.cb-typing span:nth-child(2) { animation-delay: 0.2s; }
.cb-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cb-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-7px); }
}

/* ── Быстрые вопросы ── */
#cb-quick {
  padding: 10px 14px 4px;
  display: none;
  flex-wrap: wrap;
  gap: 7px;
  background: #f7f9fc;
  border-top: 1px solid #edf1f7;
  flex-shrink: 0;
}
.cb-quick-btn {
  background: #fff;
  border: 1px solid #c8d3e6;
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 12px;
  color: #2c4a7c;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.cb-quick-btn:hover {
  background: #2c4a7c;
  color: #fff;
  border-color: #2c4a7c;
}

/* ── Подвал ── */
#cb-footer {
  background: #fff;
  padding: 12px 14px 10px;
  border-top: 1px solid #edf1f7;
  flex-shrink: 0;
}

/* Кнопки действий */
#cb-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
#cb-call-btn,
#cb-contact-btn {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, transform 0.12s;
}
#cb-call-btn {
  background: linear-gradient(135deg, #c8993a, #e8b84b);
  color: #1a2a4a;
}
#cb-call-btn:hover {
  background: linear-gradient(135deg, #b8882a, #d8a83b);
  transform: translateY(-1px);
}
#cb-contact-btn {
  background: #eef2f8;
  color: #2c4a7c;
  border: 1px solid #c8d3e6;
}
#cb-contact-btn:hover {
  background: #dde6f4;
  transform: translateY(-1px);
}

/* Поле ввода */
#cb-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
#cb-input {
  flex: 1;
  border: 1px solid #dde3ed;
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.4;
  color: #1e2c40;
  background: #f7f9fc;
  transition: border-color 0.15s;
  max-height: 100px;
  overflow-y: auto;
}
#cb-input:focus { border-color: #2c4a7c; background: #fff; }
#cb-input::placeholder { color: #9aa5b4; }

#cb-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a2a4a, #2c4a7c);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
  color: #fff;
}
#cb-send:hover { transform: scale(1.08); box-shadow: 0 3px 12px rgba(26,42,74,0.35); }
#cb-send:disabled { opacity: 0.45; cursor: default; transform: none; }
#cb-send svg { width: 16px; height: 16px; }

#cb-disclaimer {
  margin: 8px 0 0;
  font-size: 10px;
  color: #b0bac8;
  text-align: center;
  line-height: 1.4;
}

/* ── Мобильная адаптация ── */
@media (max-width: 480px) {
  #cb-root { bottom: 16px; right: 16px; }
  #cb-window {
    width: calc(100vw - 32px);
    right: 0;
    bottom: 68px;
    max-height: 75vh;
  }
}
