/* ═══════════════════════════════
   CHAT MODERATION — Luna 🌙
   ═══════════════════════════════ */
.chat-mod-layout {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 520px;
  background: var(--bg);
}

/* ── Channel Sidebar ── */
.chat-mod-channels {
  width: 220px;
  min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-mod-channels-header {
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-mod-channels-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.chat-mod-channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  position: relative;
}

.chat-mod-channel-item:hover {
  background: var(--bg);
}

.chat-mod-channel-item.active {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.chat-mod-channel-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.chat-mod-channel-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-mod-channel-item.active .chat-mod-channel-name {
  color: var(--primary);
}

/* ── Messages Area ── */
.chat-mod-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.chat-mod-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  flex-shrink: 0;
}

.chat-mod-toolbar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.chat-mod-toolbar-info .channel-label {
  padding: 4px 10px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
}

.chat-mod-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-mod-btn-select {
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chat-mod-btn-select:hover {
  background: var(--surface);
  border-color: var(--border-hover);
  color: var(--text);
}

.chat-mod-btn-delete {
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--rose);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, .25);
}

.chat-mod-btn-delete:hover {
  background: #dc2626;
  box-shadow: 0 4px 14px rgba(239, 68, 68, .35);
  transform: translateY(-1px);
}

.chat-mod-btn-delete:disabled {
  opacity: .4;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.chat-mod-selected-count {
  padding: 4px 10px;
  background: var(--rose-soft);
  color: var(--rose);
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
}

/* ── Messages Scroll ── */
.chat-mod-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-mod-messages::-webkit-scrollbar {
  width: 5px;
}

.chat-mod-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ── Chat Bubble ── */
.chat-mod-bubble {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  transition: all .15s ease;
  cursor: pointer;
  position: relative;
}

.chat-mod-bubble:hover {
  background: var(--bg);
}

.chat-mod-bubble.selected {
  background: var(--rose-soft);
  box-shadow: inset 0 0 0 1.5px var(--rose);
}

.chat-mod-bubble-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  transition: all .15s ease;
  background: var(--surface);
}

.chat-mod-bubble.selected .chat-mod-bubble-check {
  background: var(--rose);
  border-color: var(--rose);
}

.chat-mod-bubble.selected .chat-mod-bubble-check::after {
  content: '✓';
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.chat-mod-bubble-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
}

.chat-mod-bubble-body {
  flex: 1;
  min-width: 0;
}

.chat-mod-bubble-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}

.chat-mod-bubble-user {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.chat-mod-bubble-time {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.chat-mod-bubble-msg {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  word-break: break-word;
}

.chat-mod-bubble-msg img {
  max-width: 200px;
  max-height: 150px;
  border-radius: 8px;
  margin-top: 4px;
  border: 1px solid var(--border);
}

.chat-mod-bubble-channel {
  margin-top: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.chat-mod-bubble-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s ease;
  flex-shrink: 0;
  margin-top: 4px;
}

.chat-mod-bubble:hover .chat-mod-bubble-actions {
  opacity: 1;
}

/* ── Empty State ── */
.chat-mod-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.chat-mod-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  margin-bottom: 16px;
  font-size: 28px;
}

.chat-mod-empty h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.chat-mod-empty p {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 280px;
  margin: 0;
}

/* ── Pagination ── */
.chat-mod-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

/* ── Admin DM Styles ── */
.dm-panel { display: flex; flex-direction: column; gap: 16px; }
.dm-search-box { position: relative; }
.dm-search-input {
  width: 100%; padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 14px; font-family: inherit;
  box-sizing: border-box;
}
.dm-search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.dm-search-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; margin-top: 4px; max-height: 300px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15); display: none;
}
.dm-search-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  cursor: pointer; transition: background 0.15s;
}
.dm-search-item:hover { background: var(--bg); }
.dm-search-avatar, .dm-search-avatar-placeholder {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
}
.dm-search-avatar-placeholder {
  background: var(--primary); color: #fff; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 15px;
}
.dm-search-info { flex: 1; min-width: 0; }
.dm-search-name { font-weight: 700; font-size: 13px; color: var(--text); }
.dm-search-email { font-size: 11px; color: var(--text-muted); }
.dm-search-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

.dm-list { display: flex; flex-direction: column; gap: 2px; }
.dm-list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 12px; cursor: pointer; transition: background 0.15s;
  border: 1px solid transparent;
}
.dm-list-item:hover { background: var(--bg); border-color: var(--border); }
.dm-list-avatar, .dm-list-avatar-placeholder {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
}
.dm-list-avatar-placeholder {
  background: var(--primary); color: #fff; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 18px;
}
.dm-list-info { flex: 1; min-width: 0; }
.dm-list-name { font-weight: 700; font-size: 14px; color: var(--text); }
.dm-list-last { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-list-date { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

.dm-empty { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 14px; }

/* DM Conversation */
.dm-conversation { display: flex; flex-direction: column; height: 500px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--bg); }
.dm-conv-header {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.dm-back-btn {
  background: none; border: none; color: var(--primary); font-weight: 700;
  cursor: pointer; font-size: 13px; padding: 6px 10px; border-radius: 8px;
  font-family: inherit;
}
.dm-back-btn:hover { background: rgba(99,102,241,0.08); }
.dm-conv-user { display: flex; align-items: center; gap: 10px; }
.dm-conv-name { font-weight: 700; font-size: 14px; color: var(--text); }
.dm-conv-email { font-size: 11px; color: var(--text-muted); }

.dm-messages {
  flex: 1; overflow-y: auto; padding: 16px; display: flex;
  flex-direction: column; gap: 8px;
}
.dm-msg { display: flex; }
.dm-msg-admin { justify-content: flex-end; }
.dm-msg-user { justify-content: flex-start; }
.dm-msg-bubble {
  max-width: 70%; padding: 10px 14px; border-radius: 16px;
  font-size: 13px; line-height: 1.5; word-break: break-word;
  position: relative;
}
.dm-msg-bubble.admin {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; border-bottom-right-radius: 4px;
}
.dm-msg-bubble.user {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.dm-admin-badge {
  display: inline-block; background: rgba(255,255,255,0.25);
  color: #fff; font-size: 9px; font-weight: 800; padding: 2px 6px;
  border-radius: 4px; margin-right: 6px; vertical-align: middle;
  letter-spacing: 0.5px;
}
.dm-msg-time {
  display: block; font-size: 10px; margin-top: 4px;
  opacity: 0.6; text-align: right;
}
.dm-msg-bubble.user .dm-msg-time { text-align: left; }
.dm-msg-image {
  display: block; max-width: 240px; max-height: 280px;
  width: auto; height: auto; border-radius: 12px;
  margin: 2px 0 6px; object-fit: cover; cursor: pointer;
  background: rgba(0,0,0,0.06);
}

.dm-input-bar {
  display: flex; gap: 8px; padding: 12px 16px;
  background: var(--surface); border-top: 1px solid var(--border);
}
.dm-input {
  flex: 1; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-size: 13px; font-family: inherit;
}
.dm-input:focus { outline: none; border-color: var(--primary); }
.dm-send-btn {
  padding: 10px 20px; border-radius: 10px; border: none;
  background: var(--primary); color: #fff; font-weight: 700;
  font-size: 13px; cursor: pointer; font-family: inherit;
  transition: opacity 0.15s;
}
.dm-send-btn:hover { opacity: 0.85; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .chat-mod-layout {
    flex-direction: column;
    min-height: auto;
  }

  .chat-mod-channels {
    width: 100%;
    min-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
  }

  .chat-mod-channels-list {
    display: flex;
    flex-wrap: wrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 4px;
    padding: 8px;
  }

  .chat-mod-channel-item {
    padding: 6px 12px;
    border-radius: 9999px;
    background: var(--bg);
    border: 1px solid var(--border);
    width: auto;
  }

  .chat-mod-channel-item.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: none;
  }

  .chat-mod-channel-item.active .chat-mod-channel-name {
    color: #fff;
  }

  .chat-mod-channel-icon {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }

  .chat-mod-channel-name {
    font-size: 11px;
  }

  .chat-mod-messages {
    max-height: 400px;
  }
}

