/**
 * chat.css — Estilos del sistema de chat privado
 * Panel lateral deslizable + burbujas de mensajes
 */

/* ── Panel de chat (en columna central, estilo fc) ───────────────────────── */
#fcChat { display: none; flex-direction: column; min-height: 100vh; }
#fcChat.active { display: flex; }

/* ── Badge de no leídos ──────────────────────────────────────────────────── */
.ch-unread-badge {
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 9999px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  line-height: 1;
}

/* Badge en el botón del sidebar */
.ch-nav-badge-wrap {
  position: relative;
  display: inline-flex;
  width: 100%;
}
.ch-nav-badge {
  display: none;
  position: absolute;
  top: 6px;
  left: 34px;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border-radius: 9999px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  line-height: 1;
  border: 2px solid var(--surface1);
  pointer-events: none;
  z-index: 10;
}

/* ── Cuerpo scrollable ───────────────────────────────────────────────────── */
.ch-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: calc(100vh - 57px); /* 57px = fc-head height */
}

/* ── Lista de conversaciones ─────────────────────────────────────────────── */
.ch-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
  flex-shrink: 0;
}

.ch-new-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 6px;
  border-radius: 8px;
  transition: background .12s;
  color: var(--accent);
}
.ch-new-btn:hover { background: var(--surface3); }

.ch-conv-list {
  flex: 1;
  overflow-y: auto;
}

.ch-conv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid var(--border);
}
.ch-conv-row:hover, .ch-conv-active { background: var(--surface3); }

.ch-conv-info {
  flex: 1;
  min-width: 0;
}
.ch-conv-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ch-conv-preview {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ch-conv-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}
.ch-conv-time {
  font-size: 11px;
  color: var(--text3);
}
.ch-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 9999px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── Vista de mensajes ───────────────────────────────────────────────────── */
.ch-msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface2);
}
.ch-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--accent);
  padding: 0 6px 0 0;
  line-height: 1;
  font-weight: 700;
}
.ch-back-btn:hover { opacity: .7; }

.ch-msg-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ch-msg-handle {
  font-size: 11px;
  color: var(--text3);
}

.ch-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

/* Burbujas */
.ch-msg-wrap {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}
.ch-mine  { align-self: flex-end; align-items: flex-end; }
.ch-theirs{ align-self: flex-start; align-items: flex-start; }

.ch-bubble {
  border-radius: 16px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}
.ch-mine   .ch-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.ch-theirs .ch-bubble { background: var(--surface3); color: var(--text1); border-bottom-left-radius: 4px; }

.ch-msg-time {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
  padding: 0 2px;
}

/* ── Input bar ───────────────────────────────────────────────────────────── */
.ch-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface2);
}
.ch-input {
  flex: 1;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text1);
  resize: none;
  outline: none;
  line-height: 1.4;
  font-family: inherit;
  min-height: 36px;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color .15s;
}
.ch-input:focus { border-color: var(--accent); }
.ch-input::placeholder { color: var(--text3); }

.ch-send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: opacity .12s;
}
.ch-send-btn:hover { opacity: .85; }

/* ── Selector de usuario ─────────────────────────────────────────────────── */
.ch-user-search {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text1);
  outline: none;
  font-family: inherit;
  transition: border-color .15s;
}
.ch-user-search:focus { border-color: var(--accent); }
.ch-user-search::placeholder { color: var(--text3); }

.ch-user-list {
  flex: 1;
  overflow-y: auto;
}
.ch-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid var(--border);
}
.ch-user-row:hover { background: var(--surface3); }

/* ── Avatares ────────────────────────────────────────────────────────────── */
.ch-av {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  overflow: hidden;
  flex-shrink: 0;
}

/* ── Role badges ─────────────────────────────────────────────────────────── */
.ch-role-mod {
  font-size: 10px;
  background: var(--mod-bg, rgba(168,85,247,.12));
  color: var(--mod, #a855f7);
  border-radius: 9999px;
  padding: 1px 6px;
  font-weight: 700;
}
.ch-role-admin {
  font-size: 10px;
  background: rgba(59,130,246,.12);
  color: #3b82f6;
  border-radius: 9999px;
  padding: 1px 6px;
  font-weight: 700;
}

/* ── Helpers ─────────────────────────────────────────────────────────────── */
.ch-loading { padding: 24px; text-align: center; color: var(--text3); font-size: 13px; }
.ch-empty   { padding: 20px 16px; text-align: center; color: var(--text3); font-size: 13px; }
.ch-start-btn {
  margin-top: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 7px 18px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.ch-start-btn:hover { opacity: .85; }

/* ── Botón en sidebar ────────────────────────────────────────────────────── */
.ch-nav-btn-wrap {
  position: relative;
  display: inline-flex;
  width: 100%;
}

/* ch-panel responsive handled by fc column */