/* static/css/dm.css */

:root {
  /* Use existing site variables if present, with safe fallbacks */
  --pm-accent: var(--accent-color, #ffdf00);
  --pm-bg-dark: var(--bg-dark, #08080b);
  --pm-bg-darker: #050509;
  --pm-border-subtle: rgba(255, 255, 255, 0.06);
  --pm-text-muted: rgba(255, 255, 255, 0.6);
}

.pm-thread-status-dot.offline,
.pm-header-status-dot.offline {
  background: #ef4444; /* red when offline */
}


/* Overall layout wrapper */
.pm-layout {
  margin-top: 1.5rem;
}


/* Give both cards breathing space */
.pm-thread-list-card,
.pm-thread-panel-card {
  padding: 1rem; /* NEW */
  border-radius: 7px;
}

/* Left: thread list card */
.pm-thread-list-card {
  display: flex;
  flex-direction: column;
  height: 70vh;
}

.pm-thread-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.pm-thread-list-title {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.pm-thread-list {
  flex: 1;
  padding: 0.5rem 0.25rem; 
  overflow-y: auto;
}

/* Single thread row */
.pm-thread-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.pm-thread-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.pm-thread-item.active {
  background: rgba(255, 223, 0, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 223, 0, 0.35);
}

/* Circle avatar */
.pm-thread-avatar {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.pm-thread-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Online dots (thread list + header) */
.pm-thread-status-dot,
.pm-header-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
  background: #555; /* offline / unknown */
}

.pm-thread-status-dot {
  margin-left: 0.35rem;
}

.pm-header-status-dot {
  margin-right: 0.35rem;
}

.pm-thread-status-dot.online,
.pm-header-status-dot.online {
  background: #22c55e; /* green when online */
}

/* Thread meta */
.pm-thread-main {
  flex: 1;
  min-width: 0;
}

.pm-thread-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.1rem;
}

.pm-thread-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.pm-thread-time {
  font-size: 0.7rem;
  color: var(--pm-text-muted);
}

.pm-thread-preview {
  font-size: 0.78rem;
  color: var(--pm-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Unread pill (future use) */
.pm-thread-unread {
  min-width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: var(--pm-accent);
  color: #000;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
}

/* Right: chat panel */
.pm-thread-panel-card {
  display: flex;
  flex-direction: column;
  min-height: 350px;
  height: 70vh;
  max-height: 80vh;
}

/* Header */
.pm-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.35rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--pm-border-subtle);
  
}

.pm-chat-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pm-chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.pm-chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pm-chat-header-meta {
  display: flex;
  flex-direction: column;
}

.pm-chat-header-name {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pm-chat-header-status {
  font-size: 0.75rem;
  color: var(--pm-text-muted);
}

.pm-chat-header-right {
  font-size: 0.75rem;
  color: var(--pm-text-muted);
}

/* Chat log */
.pm-chat-log {
  flex: 1;
  min-height: 0;
  border-radius: 0.6rem;
  border: 1px solid var(--pm-border-subtle);
  /* padding: 0.6rem; */
  background: var(--pm-bg-dark);
  overflow-y: auto;
  margin-bottom: 0.4rem;

  padding: 1rem;  
}

.pm-system-message {
  font-size: 0.78rem;
  opacity: 0.7;
  font-style: italic;
  margin-bottom: 0.3rem;
}

.pm-message-row {
  display: flex;
  margin-bottom: 0.6rem;
}

.pm-message-row.you {
  justify-content: flex-end;
}

.pm-message-bubble {
  max-width: 80%;
  padding: 0.3rem 0.6rem;
  border-radius: 0.75rem;
  font-size: 0.86rem;
  position: relative;
}

/* YOU — now dark bubble */
.pm-message-bubble.you {
  background: var(--pm-bg-darker);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* OTHER USER — now yellow bubble */
.pm-message-bubble.other {
  background: rgba(255, 223, 0, 0.08);
  border: 1px solid rgba(255, 223, 0, 0.5);
}


.pm-message-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.7rem;
  opacity: 0.7;
  margin-bottom: 0.1rem;
}

.pm-message-text {
  word-wrap: break-word;
}

/* Typing indicator */
.pm-typing-indicator {
  min-height: 1em;
  font-size: 0.8rem;
  color: var(--pm-text-muted);
  margin-bottom: 0.3rem;
}

/* Input row */
.pm-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;  /* more space */
  margin-top: 0.5rem;
  padding: 0.25rem 0; /* NEW — breathing */
}




.pm-input-row textarea {
  flex: 1;
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--pm-border-subtle);
  background: #000;
  color: #fff;
  font-size: 0.88rem;
  line-height: 1.3;
  box-sizing: border-box;

  /* Behaviour */
  resize: none;           /* user can’t drag the corner */
  overflow-y: auto;       /* scroll only when taller than max height */
  min-height: 2.6rem;     /* 1–1.5 lines */
  max-height: 5.2rem;     /* ≈ 3 lines */
}

.pm-input-row textarea::placeholder {
  color: rgba(255, 255, 255, 0.35);
}



.pm-input-row button {
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--pm-accent);
  background: linear-gradient(
    135deg,
    rgba(255, 223, 0, 0.12),
    rgba(255, 223, 0, 0.03)
  );
  color: #fff;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

/* ===========================
   PM MOBILE HEIGHTS (PIXELS)
   =========================== */
@media (max-width: 767.98px){

  /* Messages (thread list) card height */
  .pm-thread-list-card{
    height: 260px;              /* <-- TWEAK THIS */
    max-height: 260px;
    display: flex;
    flex-direction: column;
  }

  .pm-thread-list{
    flex: 1;
    overflow-y: auto;
  }

  /* Chat panel card height */
  .pm-thread-panel-card{
    height: 660px;              /* <-- TWEAK THIS */
    /* max-height: 360px; */
    min-height: 0;              /* cancels the desktop min-height:350px */
    display: flex;
    flex-direction: column;
  }

  /* Make the message log take the remaining space and scroll */
  .pm-chat-log{
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
}


