/* =============================================================================
   messages.css — Chat, privéberichten (DM) en het prikbord.

   LET OP: de volgorde van de <link>-tags in index.html IS de cascade.
   Niet herschikken zonder die volgorde mee te wijzigen (zie AGENTS.md).
   ========================================================================== */
/* ── Chat ── */
.chat-box {
  font-size: var(--text-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Chat beheert zijn eigen scrollpositie (zie bindChatAutoScroll in
     js/crew.js). Zonder dit schuift de browser de box bij het laden van
     afbeeldingen zelf op, waardoor hij niet onderaan blijft. */
  overflow-anchor: none;
}

/* ── Row ── */
.chat-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-row-own { justify-content: flex-end; }
.chat-row-other { justify-content: flex-start; }
.chat-row-joined { margin-top: -2px; }
.chat-row-joined .chat-avatar { visibility: hidden; }

/* ── Avatar ── */
.chat-avatar {
  width: 28px; max-width: 28px; min-width: 28px;
  height: 28px; max-height: 28px; min-height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: var(--text-on-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  overflow: hidden;
}
.chat-avatar-own { background: var(--brand-gradient); }
.chat-avatar img {
  width: 28px; height: 28px;
  max-width: 100%; max-height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* ── Bubbles ── */
.chat-bubble {
  max-width: 75%;
  padding: 6px 12px 8px 12px;
  border-radius: 14px;
  word-break: break-word;
  line-height: 1.45;
}
.chat-bubble-own {
  background: var(--brand-gradient);
  color: var(--text-on-gradient);
  border-bottom-right-radius: 4px;
}
.chat-bubble-other {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

/* ── Name ── */
.chat-name {
  font-size: 0.65rem;
  font-weight: 600;
  opacity: 0.6;
  margin-bottom: 2px;
}
.chat-bubble-own .chat-name { color: rgba(255,255,255,0.75); }

/* ── Text & time ── */
.chat-text { font-size: var(--text-sm); }
.chat-time {
  font-size: 0.6rem;
  opacity: 0.5;
  margin-left: 6px;
  white-space: nowrap;
}
.chat-bubble-own .chat-time { opacity: 0.6; }

/* ── Bijlagen in chat/DM ── */
.chat-attachment-preview {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--surface-hover);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  margin-bottom: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}
.chat-attachment-preview button {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 2px;
}
.chat-attachment-img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  display: block;
  margin-top: 4px;
}
.chat-attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: underline;
  font-size: var(--text-xs);
  margin-top: 4px;
  word-break: break-all;
}
.chat-report-btn {
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.4;
  font-size: 0.65rem;
  padding: 0 2px;
  color: inherit;
}
.chat-report-btn:hover { opacity: 1; }

/* ── Privéberichten (DM) ── */
.dm-unread-badge {
  display: inline-block;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 2px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  vertical-align: middle;
}
.dm-contact {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.dm-contact:hover { background: var(--surface-hover); }
.dm-contact-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: var(--text-on-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  overflow: hidden;
}
.dm-contact-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.dm-contact-info { flex: 1; min-width: 0; }
.dm-contact-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.dm-contact-last {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dm-contact-unread {
  background: var(--brand-gradient);
  color: var(--text-on-gradient);
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

/* ── Prikbord ── */
.prikbord-post {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-hover);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
}

.prikbord-post-author {
  font-size: 0.625rem;
  color: var(--text-tertiary);
}

.prikbord-post-avatar {
  width: 28px; max-width: 28px; min-width: 28px;
  height: 28px; max-height: 28px; min-height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: var(--text-on-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  overflow: hidden;
}
.prikbord-post-avatar img {
  width: 28px; height: 28px;
  max-width: 100%; max-height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.prikbord-post-text {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.prikbord-post-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-xs);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast);
}

.prikbord-post-delete:hover {
  color: var(--danger);
}

