/* ============================================
   SBY v2.0 - Mesajlaşma Stilleri (TAM SÜRÜM)
   ============================================ */

/* ── MESAJLAŞMA LAYOUT ── */
.messages-layout {
  display: flex;
  height: calc(100vh - 4rem);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ── KONUŞMA LİSTESİ ── */
.conv-list {
  width: 300px;
  min-width: 300px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.conv-list-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.conv-list-header h3 { font-size: 1.1rem; }
.conv-search {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.conv-search input { padding-left: 2.2rem; font-size: 0.9rem; }
.conv-search::before {
  content: '🔍';
  position: absolute;
  left: 1.6rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  pointer-events: none;
}
.conv-items { overflow-y: auto; flex: 1; }
.conv-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
}
.conv-item:hover { background: var(--bg2); }
.conv-item.active { background: var(--bg2); border-left: 3px solid var(--primary); }
.conv-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-lt), var(--accent-lt));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  overflow: hidden;
}
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 0.15rem; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; flex-shrink: 0; }
.conv-time { font-size: 0.72rem; color: var(--text-muted); }
.unread-badge { background: var(--primary); color: #fff; border-radius: 20px; font-size: 0.7rem; font-weight: 700; padding: 2px 6px; min-width: 18px; text-align: center; }

/* ── CHAT PENCERESİ ── */
.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;  /* emoji picker için */
}
.chat-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  flex-shrink: 0;
}
.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-lt), var(--accent-lt));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  overflow: hidden;
  flex-shrink: 0;
}
.chat-name { font-weight: 700; font-size: 1rem; }
.chat-status { font-size: 0.78rem; color: var(--text-muted); }

/* ── MESAJLAR ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--bg);
}
.msg-group { display: flex; flex-direction: column; }
.msg-avatar-wrap {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--primary-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.msg-avatar-img { width: 28px; height: 28px; object-fit: cover; border-radius: 50%; }
.msg-bubble {
  max-width: 65%;
  padding: 0.6rem 0.9rem;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.45;
  word-break: break-word;
}
.msg-bubble.mine { background: linear-gradient(135deg, var(--primary), var(--primary-dk)); color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble.theirs { background: var(--surface); color: var(--text); border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.msg-edited { font-size: 0.72rem; opacity: 0.7; margin-left: 0.4rem; }
.msg-meta { display: flex; align-items: center; gap: 0.3rem; margin-top: 0.15rem; }
.msg-meta.mine  { justify-content: flex-end; }
.msg-meta.theirs { justify-content: flex-start; }
.msg-time { font-size: 0.7rem; color: var(--text-muted); }
.msg-read-status { font-size: 0.72rem; color: var(--primary); font-weight: 700; }
.msg-action-btn {
  background: none; border: none; padding: 0 0.1rem;
  font-size: 0.75rem; cursor: pointer; opacity: 0; transition: opacity 0.2s;
}
.msg-group:hover .msg-action-btn { opacity: 1; }
.msg-sender { font-size: 0.75rem; font-weight: 700; color: var(--primary); margin-bottom: 0.15rem; }

/* ── DÜZENLEME GÖSTERGESİ ── */
.edit-indicator {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg2);
  border-top: 2px solid var(--primary);
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.edit-indicator .edit-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; }
.edit-cancel-btn { background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--danger); padding: 0; }

/* ── EMOJİ PİCKER ── */
#emoji-picker {
  display: none;
  position: absolute;
  bottom: 60px;
  left: 0.5rem;
  right: 0.5rem;
  width: auto;
  max-height: 200px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-lg);
  padding: 0.6rem;
  z-index: 50;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
}
.emoji-item {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  border-radius: 6px;
  padding: 0.2rem;
  text-align: center;
  transition: var(--transition);
  line-height: 1.4;
}
.emoji-item:hover { background: var(--bg2); transform: scale(1.25); }

/* ── CHAT GİRİŞ ALANI ── */
.chat-input-area {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  background: var(--surface);
  flex-shrink: 0;
}
.chat-input-area textarea {
  flex: 1;
  border-radius: 20px;
  padding: 0.6rem 1rem;
  resize: none;
  max-height: 100px;
  font-size: 0.95rem;
  line-height: 1.4;
  min-height: 42px;
}
.emoji-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg2);
  border: 1px solid var(--border);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: var(--transition);
}
.emoji-toggle-btn:hover { background: var(--primary-lt); border-color: var(--primary); }
.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 3px 10px rgba(155,89,182,0.3);
  transition: var(--transition);
}
.send-btn:hover { transform: scale(1.08); }

/* ── BOŞ DURUM ── */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 0.75rem;
}
.chat-empty .emoji { font-size: 3.5rem; }
.chat-empty h3 { color: var(--text); }

/* ── KULLANICI ARAMA ── */
.user-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
}
.user-search-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 1rem; cursor: pointer; transition: var(--transition); }
.user-search-item:hover { background: var(--bg2); }
.user-search-item .avatar { font-size: 1.2rem; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.user-search-item .name { font-weight: 600; font-size: 0.9rem; }
.user-search-item .username { font-size: 0.78rem; color: var(--text-muted); }

/* ── SIDEBAR BADGE ── */
.nav-badge { background: var(--accent); color: #fff; border-radius: 20px; font-size: 0.7rem; font-weight: 700; padding: 2px 6px; margin-left: auto; }

/* ── PROFİL MODAL ── */
.profile-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.profile-modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  width: 90%; max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.profile-modal h3 { margin-bottom: 1rem; }
.profile-preview { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; margin: 0 auto 1rem; display: block; border: 3px solid var(--primary-lt); }
.profile-preview-emoji {
  width: 100px; height: 100px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-lt), var(--accent-lt));
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; margin: 0 auto 1rem;
  border: 3px solid var(--primary-lt);
}
.file-upload-label {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #fff; padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer; font-weight: 600;
  margin-bottom: 0.75rem; transition: var(--transition);
}
.file-upload-label:hover { transform: translateY(-1px); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .conv-list { width: 100%; min-width: unset; }
  .chat-window { display: none; }
  .chat-window.mobile-open { display: flex; }
  .conv-list.mobile-hidden { display: none; }
  #emoji-picker { width: 260px; right: 0.5rem; }
}

/* Konuşma silme butonu */
.conv-item:hover .conv-delete-btn { opacity: 1 !important; }
.conv-item .conv-delete-btn {
  opacity: 0.3 !important;
  color: var(--danger) !important;
  font-size: 0.85rem !important;
  padding: 0.3rem 0.4rem !important;
  border-radius: 6px !important;
  transition: all 0.2s !important;
}
.conv-item:hover .conv-delete-btn {
  opacity: 1 !important;
  background: rgba(231,76,60,0.1) !important;
}
