/* ============================================================
   FORGE — forge_app_dm.css
   Direct Messages view: DM list, DM conversation header,
   friend requests, group DMs, search, empty states
   ============================================================ */

/* ══════════════════════════════════════
   DM SIDEBAR (left panel when in DM view)
══════════════════════════════════════ */

/* Search bar at top of DM list */
.dm-search-wrap {
  padding: 12px 10px 8px;
  flex-shrink: 0;
}

.dm-search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px 6px 30px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-base);
  position: relative;
}
.dm-search-input:focus { border-color: var(--border-strong); }
.dm-search-input::placeholder { color: var(--text-muted); }

.dm-search-wrap-inner {
  position: relative;
}
.dm-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 13px;
}

/* "New DM" button */
.dm-new-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  margin-bottom: 4px;
}

.dm-new-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.dm-new-icon-btn {
  width: 18px; height: 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast);
}
.dm-new-icon-btn:hover { color: var(--text-primary); }

/* DM list items */
.dm-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 10px;
  border-radius: var(--radius-sm);
  margin: 1px 6px;
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}
.dm-list-item:hover  { background: var(--bg-hover); }
.dm-list-item.active { background: var(--bg-hover); }

/* Avatar with status ring */
.dm-list-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(30,32,36,0.6);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-display);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.dm-list-status {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-deep);
}

.dm-list-info { flex: 1; min-width: 0; }

.dm-list-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-list-preview {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* Unread count on DM item */
.dm-list-unread {
  width: 18px; height: 18px;
  background: var(--red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

/* Close DM button (appears on hover) */
.dm-list-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast), background var(--transition-fast);
}
.dm-list-item:hover .dm-list-close { display: flex; align-items: center; }
.dm-list-close:hover { color: var(--text-primary); background: var(--bg-card); }

/* Group DM avatar stack */
.dm-group-avatar {
  width: 32px; height: 32px;
  position: relative;
  flex-shrink: 0;
}

.dm-group-av-a,
.dm-group-av-b {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  font-family: var(--font-display);
  position: absolute;
  border: 2px solid var(--bg-deep);
}
.dm-group-av-a { top: 0; left: 0; z-index: 1; }
.dm-group-av-b { bottom: 0; right: 0; z-index: 2; }

/* ══════════════════════════════════════
   DM CONVERSATION TOPBAR
══════════════════════════════════════ */

.dm-topbar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.dm-topbar-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

.dm-topbar-status {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 100px;
  font-weight: 500;
}
.dm-topbar-status.online  { color: var(--green); background: var(--green-dim); }
.dm-topbar-status.idle    { color: var(--gold);  background: rgba(var(--gold-rgb),0.12); }
.dm-topbar-status.dnd     { color: var(--red);   background: var(--red-dim); }
.dm-topbar-status.offline { color: var(--text-muted); background: var(--bg-hover); }

/* ══════════════════════════════════════
   DM CONVERSATION WELCOME / EMPTY STATE
══════════════════════════════════════ */

.dm-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 48px;
  text-align: center;
  flex: 1;
}

.dm-welcome-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: 20px;
  border: 3px solid var(--border-strong);
}

.dm-welcome-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.dm-welcome-sub {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 360px;
  line-height: 1.7;
  margin-bottom: 28px;
}

.dm-welcome-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ══════════════════════════════════════
   DM INFO PANEL (right-side when in DM)
══════════════════════════════════════ */

.dm-info-panel {
  width: var(--members-width);
  background: var(--bg-deep);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.dm-info-header {
  height: var(--topbar-height);
  padding: 0 14px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dm-info-header-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.dm-info-body { padding: 16px; }

.dm-info-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.dm-info-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: 10px;
}

.dm-info-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 3px;
}
.dm-info-tag { font-size: 12px; color: var(--text-muted); text-align: center; }

.dm-info-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 14px 0 6px;
}

.dm-info-field {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
}

.dm-info-mutual-server {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}
.dm-info-mutual-server:last-child { border-bottom: none; }

.dm-info-server-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.dm-info-server-name { font-size: 12px; font-weight: 500; }

.dm-info-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.dm-info-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
  transition: background var(--transition-fast), color var(--transition-fast);
  width: 100%;
  text-align: left;
}
.dm-info-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.dm-info-action-btn.danger:hover { background: var(--red-dim); color: var(--red); }

.dm-info-action-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

/* ══════════════════════════════════════
   FRIEND / CONTACT REQUEST UI
══════════════════════════════════════ */

.friends-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.friends-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.friends-tab {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  background: none;
  border: none;
  font-family: var(--font-body);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.friends-tab:hover  { background: var(--bg-hover); color: var(--text-primary); }
.friends-tab.active { background: var(--bg-hover); color: var(--text-primary); }

.friends-tab-pending {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  background: var(--red);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: white;
  margin-left: 5px;
  vertical-align: middle;
}

.friends-add-btn {
  margin-left: auto;
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(76,175,125,0.25);
}
.friends-add-btn:hover { background: rgba(76,175,125,0.22); border-color: var(--green); }

.friends-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.friends-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 8px 0 4px;
}

.friend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  border: 1px solid transparent;
}
.friend-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.friend-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-display);
  flex-shrink: 0;
  position: relative;
}

.friend-info { flex: 1; min-width: 0; }
.friend-name { font-size: 14px; font-weight: 600; }
.friend-sub  { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.friend-actions { display: flex; gap: 6px; }

.friend-action-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-size: 15px;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}
.friend-action-btn.accept  { background: var(--green-dim); color: var(--green); }
.friend-action-btn.decline { background: var(--red-dim);   color: var(--red); }
.friend-action-btn.message { background: var(--bg-card);   color: var(--text-secondary); }
.friend-action-btn.message:hover { background: var(--blue-dim); color: var(--blue); }
.friend-action-btn.more    { background: var(--bg-card);   color: var(--text-secondary); }
.friend-action-btn.more:hover    { background: var(--bg-hover); color: var(--text-primary); }

/* Add friend panel */
.add-friend-panel {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.add-friend-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}
.add-friend-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.add-friend-row {
  display: flex;
  gap: 10px;
}

.add-friend-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-body);
  transition: border-color var(--transition-base);
}
.add-friend-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-dim); }
.add-friend-input::placeholder { color: var(--text-muted); }

/* ══════════════════════════════════════
   DM EMPTY STATE (no DMs yet)
══════════════════════════════════════ */

.dm-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
  color: var(--text-secondary);
}

.dm-empty-icon {
  font-size: 52px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.dm-empty-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.dm-empty-sub {
  font-size: 14px;
  max-width: 300px;
  line-height: 1.7;
  margin-bottom: 24px;
}

/* ══════════════════════════════════════
   CALL / VOICE STRIP (in DM topbar when on call)
══════════════════════════════════════ */

.dm-call-strip {
  background: rgba(76,175,125,0.08);
  border-bottom: 1px solid rgba(76,175,125,0.2);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--green);
  flex-shrink: 0;
}

.dm-call-duration {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--green);
  margin-left: auto;
}

.dm-call-end-btn {
  background: var(--red);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background var(--transition-fast);
}
.dm-call-end-btn:hover { background: #c04040; }