/* =========================================================
   CHAT SHELL
   ========================================================= */
:root {
  --color-accent-fade: rgba(47, 124, 246, 0.35);
}

.chat {
  max-width: 300px;
  height: 540px;
  margin: auto;

  display: flex;
  flex-direction: column;
  position: relative;

  border-radius: 8px;
  border: 1px solid rgba(10, 20, 40, 0.12);
  background: #ffffff;
  box-shadow: 0 14px 40px rgba(16, 24, 40, 0.08);
  overflow: hidden;
}

/* Бан-плашка */
.chat__ban {
  display: none;
  padding: 8px 10px;
  font-size: 12px;
  background: rgba(215, 38, 61, 0.1);
  color: #7c1020;
  border-bottom: 1px solid rgba(215, 38, 61, 0.22);
}

/* =========================================================
   REPLIES NOTIFY (кнопка ответов)
   ========================================================= */

.chat__notify {
  position: absolute;
  top: 10px;
  right: 10px;

  width: 34px;
  height: 34px;

  border-radius: 999px;
  border: 1px solid rgba(10, 20, 40, 0.12);
  background: rgba(255, 255, 255, 0.85);
  color: #0b1220;

  display: none;
  align-items: center;
  justify-content: center;

  font-size: 14px;
  padding: 0;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.12);
}

.chat__notify--active {
  border-color: rgba(47, 124, 246, 0.25);
  box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.12), 0 10px 30px rgba(16, 24, 40, 0.12);
}

.chat__notify-badge {
  position: absolute;
  top: -6px;
  right: -6px;

  min-width: 18px;
  height: 18px;
  padding: 0 5px;

  border-radius: 999px;
  background: #d7263d;
  color: #fff;

  font-size: 10px;
  line-height: 18px;
  text-align: center;
  font-weight: 700;

  border: 2px solid #fff;
}

/* =========================================================
   MESSAGES LIST
   ========================================================= */

.chat__messages {
  flex: 1 1 auto;
  min-height: 0; /* ключ */

  padding: 12px;
  overflow-y: auto;

  display: flex;
  flex-direction: column;
  gap: 8px;

  font-size: 14px;

  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;

  background: #ffffff;
  border-bottom: 1px solid rgba(10, 20, 40, 0.1);
}

/* Сообщение */
.chat__message {
  position: relative;
  max-width: 82%;
  display: inline-flex;
  flex-direction: column;

  padding: 8px 10px;
  border-radius: 12px;

  background: rgba(245, 247, 252, 1);
  border: 1px solid rgba(10, 20, 40, 0.08);

	transition: transform 0.15s ease-out;
}

/* Базовое состояние, когда жест уже распознан и мы показываем хинт */
.chat__message--swipe-hint {
  /* сам transform мы будем задавать инлайном из JS */
}

/* Стрелка "ответить" справа от пузыря */
.chat__message--swipe-hint::after {
  content: "↩";
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  opacity: 0;
  color: #0b7ea3; /* или твой accent */
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Когда свайп достаточно сильный — делаем стрелку ярче */
.chat__message--swipe-hint-active::after {
  opacity: 1;
  transform: translateY(-50%) scale(1.05);
}

/* Моё сообщение */
.chat__message--mine {
  margin-left: auto;
  background: linear-gradient(180deg, rgba(3, 70, 148, 0.18), rgba(3, 70, 148, 0.1));
  border-color: rgba(3, 70, 148, 0.18);
  align-items: flex-end;
}

.chat__message--mine .chat__more-btn{
  display:none;
}

/* Мета */
.chat__meta {
  font-size: 11px;
  color: rgba(11, 18, 32, 0.55);
  margin-bottom: 4px;

  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.chat__author {
  font-weight: 700;
  color: rgba(11, 18, 32, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat__time {
  opacity: 0.85;
  white-space: nowrap;
}

/* Кнопка "⋮" (показываешь модераторам через JS) */
.chat__more-btn {
  margin-left: 4px;
  border: none;
  background: transparent;
  color: rgba(11, 18, 32, 0.45);
  padding: 0 4px;
  font-size: 16px;
  line-height: 1;
  border-radius: 8px;
  display: none;
}
.chat__more-btn:hover {
  background: rgba(11, 18, 32, 0.06);
  color: rgba(11, 18, 32, 0.75);
}

/* Текст сообщения */
.chat__text {
  white-space: pre-wrap;
  word-wrap: break-word;
  color: rgba(11, 18, 32, 0.92);
}

/* Бейдж muted */
.chat__badge-muted {
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 204, 102, 0.22);
  color: rgba(80, 48, 0, 0.92);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =========================================================
   REPLY QUOTE (цитата внутри сообщения)
   ========================================================= */

.chat__reply {
  margin-bottom: 6px;
  padding: 7px 8px;
  border-radius: 10px;

  background: rgba(11, 18, 32, 0.04);
  border: 1px solid rgba(10, 20, 40, 0.08);
  border-left: 3px solid rgba(47, 124, 246, 0.75);

  font-size: 11px;
  cursor: pointer;
}

.chat__message--mine .chat__reply {
  background: rgba(255, 255, 255, 0.22);
  border-left-color: rgba(255, 255, 255, 0.95);
}

.chat__reply-author {
  font-weight: 700;
  margin-bottom: 2px;
  color: rgba(11, 18, 32, 0.85);
}

.chat__reply-text {
  color: rgba(11, 18, 32, 0.55);
  max-height: 2.4em;
  overflow: hidden;
}

/* Подсветка целевого сообщения */
.chat__message--highlight {
  box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.2);
  transition: box-shadow 0.2s ease-out;
}

/* =========================================================
   STATUS + COUNTER ROW
   ========================================================= */

.chat__info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 6px 12px;
  font-size: 11px;
  color: rgba(11, 18, 32, 0.55);

  min-height: 28px;
  background: #fff;
}

.chat__status {
  flex: 1 1 auto;
  padding-right: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat__status--error {
  color: #b42334;
}

.chat__counter {
  flex: 0 0 auto;
  text-align: right;
  opacity: 0.85;
}

/* =========================================================
   REPLY PREVIEW (плашка "вы отвечаете на...")
   ========================================================= */

.chat__reply-preview {
  display: none;
  padding: 10px 12px;

  border-top: 1px solid rgba(10, 20, 40, 0.1);
  border-bottom: 1px solid rgba(10, 20, 40, 0.1);

  background: rgba(47, 124, 246, 0.1);
  font-size: 12px;

  align-items: center;
  gap: 10px;
}

.chat__reply-preview-main {
  flex: 1 1 auto;
  min-width: 0;
}

.chat__reply-preview-title {
  font-weight: 800;
  color: rgba(11, 18, 32, 0.85);
  margin-bottom: 2px;
}

.chat__reply-preview-text {
  color: rgba(11, 18, 32, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat__reply-preview-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;

  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(10, 20, 40, 0.1);

  color: rgba(11, 18, 32, 0.7);
  font-size: 16px;
  line-height: 1;
  padding: 0;
}
.chat__reply-preview-close:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(47, 124, 246, 0.2);
}

/* =========================================================
   EMOJI PANEL (панель эмодзи)
   ========================================================= */

.chat__emoji-panel {
  position: absolute;
  right: 12px;
  left: 12px;
  bottom: 80px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(10, 20, 40, 0.12);
  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.16);
  display: none;
  flex-wrap: wrap;
  gap: 5px;
  z-index: 30;
}

.chat__emoji-panel--open {
  display: flex;
}

.chat__emoji-item {
  width: 32px;
  height: 32px;
  border-radius: 10px;
border:0 none;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: transparent;
  cursor: pointer;
  font-size: 20px;
  padding: 0;
}

.chat__emoji-item:hover {
  background: rgba(11, 18, 32, 0.06);
}

.chat__emoji-divider {
  flex-basis: 100%;
  height: 1px;
  margin: 4px 0;
  background: rgba(10, 20, 40, 0.1);
}

/* =========================================================
   COMPOSER (поле ввода как в референсе)
   ========================================================= */

.chat__composer {
  padding: 10px 12px;
  border-top: 1px solid rgba(10, 20, 40, 0.1);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
}

.chat__composer-bar {
  display: flex;
  align-items: stretch; /* важно для “textarea во всю высоту” */
  gap: 8px;

  padding: 10px 10px;
  border-radius: 16px;

  background: rgba(245, 247, 252, 1);
  border: 1px solid rgba(10, 20, 40, 0.1);

  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.06), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.chat__composer-input {
  flex: 1 1 auto;
  min-width: 0;

  align-self: stretch;
  padding: 6px 2px;

  font: inherit;
  font-size: 13px !important;
  line-height: 1.35 !important;
  color: #0b1220 !important;
background-color:transparent !important;
  border:0 none !important;
  overflow-y: hidden;
  resize: none;
  outline: none;
  max-height: 120px;
}

.chat__composer-input::placeholder {
  color: rgba(11, 18, 32, 0.45);
}

.chat__composer-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;

  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;

  color: rgba(11, 18, 32, 0.55);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chat__composer-icon:hover {
  background: rgba(11, 18, 32, 0.06);
  color: rgba(11, 18, 32, 0.75);
}

.chat__composer-send {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;

  border-radius: 999px;
  border: 0;
  cursor: pointer;

  background: #2f7cf6;
  color: #fff;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  box-shadow: 0 8px 20px rgba(47, 124, 246, 0.28);
}
.chat__composer-send:hover {
  filter: brightness(1.03);
}
.chat__composer-send:active {
  transform: translateY(1px);
}

.chat__composer-send:disabled {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
}

.chat__composer-cancel {
flex: 0 0 auto;
width: 36px;
height: 36px;
border-radius: 999px;
border: 0;
cursor: pointer;
background: #bd2424;
color: #fff;
display: inline-flex;
align-items: center;
justify-content: center;
box-shadow: 0 8px 20px rgba(47, 124, 246, 0.28);
}

/* =========================================================
   MODERATION CONTEXT MENU
   ========================================================= */

.chat-context {
  position: fixed;
  z-index: 1000;

  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(10, 20, 40, 0.12);
  border-radius: 12px;
  padding: 6px;

  font-size: 12px;
  display: none;

  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.18);
}

.chat-context__btn {
  display: block;
  width: 100%;
  text-align: left;

  background: transparent;
  color: rgba(11, 18, 32, 0.9);

  padding: 8px 10px;
  cursor: pointer;
  border-radius: 10px;
}

.chat-context__btn:hover {
  background: rgba(11, 18, 32, 0.06);
}

.chat__edit-btn{
  background: transparent;
  border:0 none;
  color: rgba(11, 18, 32, 0.9);
  cursor: pointer;
}