/* ============================================================
 * messages.css — Discord mesaj düzeni (birebir 2024)
 * ============================================================ */

/* ---- Mesaj satırı ---- */
.msg {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 2px 16px;
  line-height: 1.375; word-wrap: break-word;
  position: relative;
  transition: background-color .05s ease;
}
.msg:not(.grouped) { padding-top: 8px; }
.msg:hover { background: var(--msg-hover); }

/* ---- Avatar (ilk mesaj) ---- */
.msg-avatar {
  width: var(--avatar-msg, 40px);
  height: var(--avatar-msg, 40px);
  border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  cursor: pointer; overflow: hidden; margin-top: 1px;
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Zaman küçük metin (gruplu mesaj soldaki) ---- */
.msg-gutter {
  width: var(--avatar-msg, 40px); flex-shrink: 0;
  text-align: right; font-size: 11px; color: var(--muted);
  padding-top: 4px; opacity: 0; user-select: none; pointer-events: none;
}
.msg.grouped:hover .msg-gutter { opacity: 1; }

/* ---- Ana içerik ---- */
.msg-main { flex: 1; min-width: 0; }

/* ---- Başlık satırı (nick + zaman) ---- */
.msg-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.msg-head .nick {
  font-size: 16px; font-weight: 600; line-height: 1.2;
  color: var(--head); cursor: pointer; flex-shrink: 0;
}
.msg-head .nick:hover { text-decoration: underline; }
.msg-head .time {
  font-size: 12px; color: var(--muted); font-weight: 400; flex-shrink: 0;
}

/* ---- Mesaj metni ---- */
.msg-text {
  font-size: 16px; line-height: 1.375;
  color: var(--head); white-space: pre-wrap; overflow-wrap: anywhere;
}

/* ---- Resim ---- */
.msg-img {
  max-width: min(400px, 100%); max-height: 300px;  /* dar mobil sütununda taşmasın/kırpılmasın */
  border-radius: var(--radius-sm); margin-top: 6px;
  cursor: zoom-in; display: block; object-fit: contain;
}

/* ---- Rozetler ---- */
.badge {
  font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px;
  border: 1px solid transparent; text-transform: uppercase; flex-shrink: 0;
}
.badge.admin      { color: var(--dnd); border-color: var(--dnd); }
.badge.moderator  { background: #9b59b6; color: #fff; }
.badge.vip        { background: #e2c23b; color: #000; }

/* ---- Bahsetme (mention) ---- */
.msg.mention {
  background: var(--mention-bg) !important;
  box-shadow: inset 2px 0 0 var(--mention-border);
}
.msg.mention .mention-word { color: var(--mention-color); font-weight: 600; }

/* ---- Sistem mesajı ---- */
.system {
  color: var(--system); font-style: italic; font-size: 13px;
  text-align: center; padding: 6px 16px;
}
.system.system-blocked {
  color: var(--danger); font-weight: 600;
  background: rgba(242,63,67,.06);
  border-left: 3px solid var(--danger);
  border-radius: 4px; padding: 6px 12px; margin: 4px 16px;
  text-align: left;
}

/* ---- İletildi / Düzenlendi etiketleri ---- */
.msg-forwarded {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--muted); font-style: italic;
  margin-bottom: 2px; opacity: .85;
}
.msg-forwarded svg { opacity: .8; }
.msg-edited {
  font-size: 10px; color: var(--muted); opacity: .7;
  margin-left: 3px; font-style: normal;
}

/* ---- Yanıt referansı (reply preview) ---- */
.msg-reply-ref {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  margin-bottom: 4px; cursor: pointer;
  border-left: 2px solid var(--muted); padding-left: 8px;
  border-radius: 2px;
}
.msg-reply-ref:hover { color: var(--head); }
.msg-reply-ref .reply-nick { font-weight: 600; }
.msg-reply-ref .reply-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 380px;
}

/* ---- Mesaj vurgulama (pin scroll) ---- */
@keyframes msgFlash {
  0%   { background: rgba(88,101,242,.3); }
  100% { background: transparent; }
}
.msg.flash { animation: msgFlash .8s ease-out; }

/* ---- Yeni mesaj girişi ---- */
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg.msg-in { animation: msgIn .15s ease-out; }
