/* ===== Чат поддержки (модальное окно пользователя) ===== */

/* Кнопка-иконка в шапке */
.chat-fab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary, #2E89FF);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  margin-left: 10px;
  text-decoration: none;
}
.chat-fab:hover { background: var(--primary-dark, #1f6fd1); transform: scale(1.05); }
.chat-fab .chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 10px;
  background: var(--danger, #dc3545);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-family: sans-serif;
  display: none;
}
.chat-fab .chat-badge.show { display: inline-block; }

/* Оверлей модального окна */
.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: flex-end;
  z-index: 1000;
  padding: 16px;
}
.chat-overlay.show { display: flex; }

/* Панель чата (справа, как мессенджер) */
.chat-panel {
  width: 400px;
  max-width: 100%;
  height: 92vh;
  max-height: 640px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-panel-header {
  background: var(--primary, #2E89FF);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-panel-header .chat-title { flex: 1; font-weight: 600; }
.chat-panel-header .chat-title .chat-sub { font-size: 12px; font-weight: 400; opacity: 0.9; }
.chat-panel-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

/* Лента сообщений */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f6f7fb;
}

.chat-message {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  position: relative;
}
.chat-message .msg-meta {
  display: block;
  font-size: 10px;
  color: rgba(0, 0, 0, 0.45);
  margin-top: 4px;
  text-align: right;
}
.chat-message.me {
  align-self: flex-end;
  background: #dcf0ff;
  border-bottom-right-radius: 4px;
}
.chat-message.them {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border, #dee2e6);
  border-bottom-left-radius: 4px;
}

/* Важное уведомление / массовая рассылка */
.chat-message.notification {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  background: #fff7e0;
  border: 1px solid #ffe08a;
  border-left: 4px solid #ffb300;
  color: #5a4a10;
}
.chat-message.notification .msg-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #9a6d00;
  margin-bottom: 5px;
  font-size: 13px;
}

/* Панель ввода */
.chat-input-bar {
  border-top: 1px solid var(--border, #dee2e6);
  padding: 10px;
  display: flex;
  gap: 8px;
  background: #fff;
}
.chat-input-bar textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border, #dee2e6);
  border-radius: 8px;
  padding: 9px 11px;
  min-height: 40px;
  max-height: 100px;
  font-size: 14px;
}
.chat-input-bar .btn-send {
  align-self: flex-end;
  background: var(--primary, #2E89FF);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 44px;
  height: 40px;
  font-size: 17px;
  cursor: pointer;
}
.chat-input-bar .btn-send:hover { background: var(--primary-dark, #1f6fd1); }

.chat-status {
  text-align: center;
  color: var(--gray, #6c757d);
  font-size: 12px;
  padding: 12px;
}

@media (max-width: 480px) {
  .chat-panel { height: 100vh; max-height: none; border-radius: 0; }
  .chat-overlay { padding: 0; }
}
