/**
 * Poma Messenger — Shared CSS
 * Used identically across all poma.life apps.
 * Scoped with .pm- prefix to avoid conflicts.
 */

/* ── User Header ─────────────────────────────────── */

.pm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(30,41,59,0.3);
  flex-shrink: 0;
}

.pm-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #6366f1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.pm-header-info {
  flex: 1;
  min-width: 0;
}

.pm-header-name {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-header-sub {
  font-size: 11px;
  color: #64748b;
}

/* ── Chat Header ─────────────────────────────────── */

.pm-conv-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(30,41,59,0.3);
  flex-shrink: 0;
}

.pm-back {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  font-size: 16px;
}

.pm-back:hover { color: #e2e8f0; }

.pm-conv-title {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
}

.pm-status-text {
  font-size: 10px;
  color: #64748b;
}

.pm-status-text--on {
  color: #22c55e;
}

/* ── Avatar ──────────────────────────────────────── */

.pm-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.pm-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
}

.pm-avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 10px;
}

.pm-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #0f172a;
  background: #64748b;
}

.pm-online-dot--on {
  background: #22c55e;
}

/* ── List Header / New Button ────────────────────── */

.pm-list-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  flex-shrink: 0;
}

.pm-new-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 18px;
}

.pm-new-btn:hover { color: #e2e8f0; }

/* ── Contact / Conversation List ─────────────────── */

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

.pm-contact-row {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: flex;
  gap: 10px;
  align-items: center;
  transition: background 0.1s;
}

.pm-contact-row:hover {
  background: rgba(255,255,255,0.04);
}

.pm-contact-row--unread {
  background: rgba(34,197,94,0.05);
}

.pm-contact-row--unread:hover {
  background: rgba(34,197,94,0.08);
}

.pm-contact-info {
  flex: 1;
  min-width: 0;
}

.pm-contact-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pm-contact-name {
  font-size: 13px;
  font-weight: 400;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-contact-name--bold {
  font-weight: 600;
}

.pm-contact-time {
  font-size: 10px;
  color: #475569;
  flex-shrink: 0;
}

.pm-contact-preview {
  font-size: 11px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.pm-unread-badge {
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #22c55e;
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}

.pm-separator {
  padding: 10px 16px 6px;
  font-size: 10px;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── Empty State ─────────────────────────────────── */

.pm-empty {
  padding: 40px;
  text-align: center;
  color: #475569;
}

.pm-empty-icon {
  font-size: 48px;
  opacity: 0.3;
  margin-bottom: 12px;
}

.pm-empty-text {
  font-size: 13px;
  line-height: 1.4;
  color: #475569;
  padding: 20px;
  text-align: center;
}

.pm-empty-hint {
  font-size: 11px;
  color: #334155;
  margin-top: 4px;
}

/* ── Search ──────────────────────────────────────── */

.pm-search-wrap {
  padding: 8px 12px;
  flex-shrink: 0;
}

.pm-search-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(30,41,59,0.6);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #e2e8f0;
  outline: none;
  font-family: inherit;
}

.pm-search-input::placeholder {
  color: #475569;
}

.pm-search-input:focus {
  border-color: rgba(99,102,241,0.4);
}

/* ── Messages ────────────────────────────────────── */

.pm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pm-older-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
  padding: 6px;
  font-size: 11px;
  margin-bottom: 8px;
  text-align: center;
  width: 100%;
}

.pm-older-btn:hover {
  background: rgba(255,255,255,0.04);
}

.pm-date-divider {
  text-align: center;
  padding: 8px 0;
  margin: 4px 0;
}

.pm-date-label {
  font-size: 10px;
  color: #475569;
  background: rgba(30,41,59,0.8);
  padding: 2px 10px;
  border-radius: 10px;
}

.pm-msg-row {
  align-self: flex-start;
  max-width: 85%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.pm-msg-row--me {
  align-self: flex-end;
  align-items: flex-end;
}

.pm-sender-label {
  font-size: 10px;
  color: #64748b;
  margin-bottom: 2px;
  padding-left: 2px;
}

.pm-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  color: #e2e8f0;
  background: rgba(30,41,59,0.6);
  border: 1px solid rgba(255,255,255,0.06);
  border-top-left-radius: 2px;
  word-break: break-word;
}

.pm-bubble--me {
  background: rgba(167,139,250,0.12);
  border: 1px solid rgba(167,139,250,0.15);
  border-top-left-radius: 12px;
  border-top-right-radius: 2px;
}

.pm-time-row {
  font-size: 9px;
  color: #475569;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ── Attachments ─────────────────────────────────── */

.pm-img-link {
  display: block;
  margin-top: 4px;
  border-radius: 8px;
  overflow: hidden;
  max-width: 200px;
}

.pm-img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.pm-file-link {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  color: #94a3b8;
  text-decoration: none;
  max-width: 200px;
}

.pm-file-link:hover {
  background: rgba(255,255,255,0.08);
}

.pm-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* ── Typing Indicator ────────────────────────────── */

.pm-typing {
  padding: 4px 12px;
  font-size: 11px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pm-typing-dots {
  display: flex;
  gap: 2px;
}

.pm-typing-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #64748b;
  animation: poma-typing-dot 1.4s infinite;
}

/* ── Pending Files ───────────────────────────────── */

.pm-pending-files {
  padding: 6px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.pm-file-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  color: #94a3b8;
}

.pm-file-chip-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-file-chip-rm {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  font-size: 12px;
}

.pm-file-chip-rm:hover { color: #e2e8f0; }

/* ── Compose Area ────────────────────────────────── */

.pm-compose {
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(15,23,42,0.8);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.pm-clip-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  display: flex;
  border-radius: 4px;
  font-size: 16px;
}

.pm-clip-btn:hover { color: #94a3b8; }

.pm-input {
  flex: 1;
  background: rgba(30,41,59,0.6);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #e2e8f0;
  outline: none;
  font-family: inherit;
}

.pm-input::placeholder {
  color: #475569;
}

.pm-input:focus {
  border-color: rgba(99,102,241,0.4);
}

.pm-send-btn {
  padding: 8px 12px;
  border-radius: 8px;
  background: #7c3aed;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 16px;
}

.pm-send-btn:hover {
  background: #6d28d9;
}
