/* ====================== ЧАТ ТРАНСЛЯЦИИ ====================== */
/* Diamond Empire Music — футуристичный дизайн чата */

.chat-wrap {
  margin-top: 0;
  border: 1px solid rgba(155, 89, 182, 0.15);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(15, 15, 25, 0.75), rgba(20, 20, 35, 0.65));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 640px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(155, 89, 182, 0.05);
  position: relative;
}

/* Тонкая неоновая полоска сверху */
.chat-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(155, 89, 182, 0.6), transparent);
  z-index: 5;
}

/* --- Шапка чата --- */
.chat-header {
  padding: 0.9rem 1.2rem;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}

.chat-header h3 {
  margin: 0;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-header h3 .chat-icon {
  filter: drop-shadow(0 0 4px rgba(155, 89, 182, 0.5));
}

.chat-header .chat-online {
  font-size: 0.82rem;
  color: #8892a8;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  background: rgba(46, 204, 113, 0.08);
  border: 1px solid rgba(46, 204, 113, 0.2);
  border-radius: 9999px;
  transition: all 0.3s ease;
}

.chat-header .chat-online .live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.6);
  animation: chatPulse 2s ease-in-out infinite;
}

@keyframes chatPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* --- Закреплённое сообщение --- */
.chat-pinned {
  padding: 0.65rem 1.1rem;
  background: linear-gradient(135deg, rgba(155, 89, 182, 0.1), rgba(155, 89, 182, 0.04));
  border-bottom: 1px solid rgba(155, 89, 182, 0.12);
  font-size: 0.82rem;
  color: #c8d8f0;
  display: none;
  align-items: flex-start;
  gap: 0.4rem;
  line-height: 1.4;
  flex-shrink: 0;
}

.chat-pinned.active {
  display: flex;
}

.chat-pinned .chat-pinned-label {
  font-weight: 700;
  color: #9b59b6;
  flex-shrink: 0;
  text-shadow: 0 0 8px rgba(155, 89, 182, 0.3);
}

/* --- Область сообщений --- */
.chat-messages {
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
  scroll-behavior: smooth;
}

/* Кастомный скроллбар */
.chat-messages::-webkit-scrollbar {
  width: 5px;
}
.chat-messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(155, 89, 182, 0.5), rgba(155, 89, 182, 0.25));
  border-radius: 10px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(155, 89, 182, 0.7), rgba(155, 89, 182, 0.4));
}

/* --- Одно сообщение --- */
.chat-msg {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border-left: 3px solid rgba(155, 89, 182, 0.5);
  word-break: break-word;
  animation: chatMsgIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.chat-msg:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
}

@keyframes chatMsgIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Мета: аватар + имя + бейджи + время */
.chat-msg-meta {
  font-size: 0.76rem;
  color: #8892a8;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.chat-msg-meta .chat-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 6px rgba(155, 89, 182, 0.15);
}

.chat-msg-meta .chat-username {
  font-weight: 600;
  color: #c8d8f0;
  letter-spacing: 0.2px;
}

.chat-msg-meta .chat-time {
  color: #5c6578;
  font-size: 0.7rem;
  margin-left: auto;
}

/* Бейджи ролей */
.chat-badge {
  font-size: 0.62rem;
  padding: 2px 6px;
  border-radius: 5px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.chat-badge.admin {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.3);
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.1);
}

.chat-badge.moderator {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
  border: 1px solid rgba(52, 152, 219, 0.3);
  box-shadow: 0 0 8px rgba(52, 152, 219, 0.1);
}

.chat-badge.premium {
  background: rgba(241, 196, 15, 0.15);
  color: #f1c40f;
  border: 1px solid rgba(241, 196, 15, 0.3);
  box-shadow: 0 0 8px rgba(241, 196, 15, 0.1);
}

.chat-badge.musician {
  background: rgba(155, 89, 182, 0.15);
  color: #9b59b6;
  border: 1px solid rgba(155, 89, 182, 0.3);
  box-shadow: 0 0 8px rgba(155, 89, 182, 0.1);
}

/* Текст сообщения */
.chat-msg-text {
  color: #dfe6f0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.chat-msg-text img.chat-emoji {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  margin: 0 1px;
}

/* Системное сообщение */
.chat-system {
  text-align: center;
  color: #5c6578;
  font-size: 0.8rem;
  padding: 0.4rem;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

/* --- Строка ввода --- */
.chat-input-row {
  padding: 0.75rem 1rem 1rem;
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  position: relative;
}

.chat-input-row input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  outline: none;
  font-family: inherit;
  font-size: 0.88rem;
  transition: all 0.25s ease;
}

.chat-input-row input:focus {
  border-color: rgba(155, 89, 182, 0.5);
  background: rgba(155, 89, 182, 0.05);
  box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.chat-input-row input::placeholder {
  color: #5c6578;
}

.chat-input-row input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-input-row button {
  padding: 0.65rem 1.3rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #9b59b6, #8e44ad);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.3px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(155, 89, 182, 0.25);
  flex-shrink: 0;
  white-space: nowrap;
}

.chat-input-row button:hover {
  background: linear-gradient(135deg, #a85bbf, #9b59b6);
  box-shadow: 0 6px 20px rgba(155, 89, 182, 0.35);
  transform: translateY(-1px);
}

.chat-input-row button:active {
  transform: translateY(0);
}

.chat-input-row button:disabled {
  background: #3a3a4a;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* --- Эмодзи-пикер --- */
.chat-emoji-picker {
  display: none;
  flex-wrap: wrap;
  gap: 4px;
}

.chat-emoji-item {
  width: 32px;
  height: 32px;
  cursor: pointer;
  border-radius: 6px;
  transition: transform 0.15s, background 0.15s;
  padding: 4px;
  box-sizing: content-box;
}

/* --- Адаптив --- */
@media (max-width: 768px) {
  .chat-wrap {
    min-height: 0;
    max-height: 400px;
    border-radius: 12px;
  }
  .chat-header {
    padding: 0.7rem 1rem;
  }
  .chat-header h3 {
    font-size: 0.95rem;
  }
  .chat-messages {
    min-height: 0;
  }
  .chat-input-row input {
    font-size: 0.82rem;
  }
  .chat-input-row button {
    padding: 0.6rem 1rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  .chat-wrap {
    min-height: 0;
    max-height: 360px;
  }
  .chat-msg-meta .chat-time {
    margin-left: 0;
  }
  .chat-input-row {
    flex-direction: row;
  }
  .chat-input-row button {
    padding: 0.6rem 0.8rem;
  }
}

/* ==================== КОНТЕКСТНОЕ МЕНЮ ЧАТА ==================== */
.chat-context-menu {
  background: rgba(20, 25, 40, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 6px 0;
  min-width: 180px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: chatMenuIn 0.15s ease;
}

@keyframes chatMenuIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.chat-context-item {
  padding: 8px 16px;
  font-size: 0.85rem;
  color: #c8d0e0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.chat-context-item:hover {
  background: rgba(155, 89, 182, 0.3);
  color: #fff;
}

.chat-context-item:first-child {
  border-radius: 10px 10px 0 0;
}

.chat-context-item:last-child {
  border-radius: 0 0 10px 10px;
}

.chat-context-item.danger:hover {
  background: rgba(231, 76, 60, 0.25);
  color: #ff6b6b;
}

@media (max-width: 768px) {
  .chat-context-menu {
    min-width: 160px;
  }
  .chat-context-item {
    font-size: 0.8rem;
    padding: 10px 14px;
  }
}

.chat-avatar-wrap {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.chat-avatar-hat {
  position: absolute;
  top: -35%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: auto;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

/* --- Contenteditable поле ввода --- */
.chat-input-row .chat-input[contenteditable] {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 120px;
  overflow-y: auto;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  outline: none;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
  cursor: text;
  transition: all 0.25s ease;
}

.chat-input-row .chat-input[contenteditable="true"]:focus {
  border-color: rgba(155, 89, 182, 0.5);
  background: rgba(155, 89, 182, 0.05);
  box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.chat-input-row .chat-input[contenteditable="true"]:empty::before {
  content: attr(data-placeholder);
  color: #5c6578;
  pointer-events: none;
}

.chat-input-row .chat-input[contenteditable="false"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-input-row .chat-input[contenteditable] img.chat-emoji {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin: 0 1px;
  display: inline-block;
  pointer-events: none;
}
