/* ============================================================
   MESSAGES PANEL — Salon Literary Design
   ============================================================ */

/* E2E Messaging — delete button */
.chat-message { position: relative; display: flex; align-items: flex-end; gap: 4px; }
.chat-message.sent  { flex-direction: row-reverse; }
.msg-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 2px 4px;
    color: #888;
    flex-shrink: 0;
}
.chat-message:hover .msg-delete-btn { opacity: 1; }
.msg-delete-btn:hover { color: #c0392b; }



.messages-toggle {
  position: fixed;
  bottom: 76px;
  right: 22px;
  width: 44px;
  height: 44px;
  background: var(--ink-soft);
  color: var(--parchment);
  border: 1px solid var(--border-warm);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  font-size: 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s var(--ease-spring), background 0.2s;
}
.messages-toggle:hover {
  transform: scale(1.12);
  background: var(--sepia);
}

.messages-panel {
  position: fixed;
  bottom: 130px;
  right: 22px;
  width: 500px;
  max-height: 600px;
  background: var(--cream);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  transform: scale(0.92) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s var(--ease-spring), opacity 0.22s var(--ease);
  overflow: hidden;
}
.messages-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.messages-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--parchment-mid);
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  flex-shrink: 0;
}
.messages-header button {
  background: none;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  box-shadow: none;
  transform: none;
  transition: color 0.15s;
}
.messages-header button:hover {
  color: var(--sepia);
  background: none;
  transform: none;
}

.messages-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.conversation-list {
  width: 130px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-soft);
  overflow-y: auto;
  background: var(--vellum);
}

.conversation-item {
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
  position: relative;
  transition: background 0.15s;
}
.conversation-item:hover { background: var(--parchment-mid); }
.conversation-item.active { background: var(--cream); }

.conversation-name {
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conversation-preview {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #8c2a1a;
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.58rem;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.chat-topbar {
  padding: 10px 14px;
  background: var(--parchment-mid);
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-display);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-chat-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-align: center;
  margin: auto;
}

.chat-message {
  display: flex;
  flex-direction: column;
}
.chat-message.sent { align-items: flex-end; }
.chat-message.received { align-items: flex-start; }

.chat-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 3px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.6;
  border: 1px solid var(--border-soft);
  background: var(--vellum);
  color: var(--ink-soft);
}
.chat-message.sent .chat-bubble {
  background: var(--ink-soft);
  color: var(--parchment);
  border-color: transparent;
}

.chat-input {
  display: flex;
  padding: 10px 12px;
  gap: 8px;
  border-top: 1px solid var(--border-soft);
  background: var(--vellum);
  flex-shrink: 0;
}
.chat-input input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  background: var(--cream);
  color: var(--ink);
  outline: none;
  margin: 0;
}
.chat-input input:focus { border-color: var(--sepia); }
.chat-input button {
  padding: 8px 16px;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  border-radius: 2px;
}

@media (max-width: 480px) {
  .messages-panel { width: calc(100vw - 20px); right: 10px; bottom: 120px; }
}
