/* css/components/messages-page.css — Страница сообщений /messages.
   Порядок подключения всех стилей задан в layout/head.php — он важен. */
/* ---- /messages inbox (js/pages/messages.js) — flows inside .main
   like pro-history.php's content (no competing max-width/centering box;
   .main already caps the page at 1600px with its own 20px padding), so it
   doesn't look like an oddly narrow island next to the site's other
   full-width account pages. Found live 2026-08-24. ---- */

.messages-page { max-width: 1100px; color: #eef0ff; }
.messages-page-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.messages-page-header .card-title { flex: 1; margin-bottom: 0; }

.messages-signed-out {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--text-muted);
  text-align: center;
}

.messages-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  min-height: 60vh;
}
@media (max-width: 760px) {
  .messages-layout { grid-template-columns: 1fr; }
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 75vh;
  overflow-y: auto;
}
.messages-list-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  color: #eef0ff;
}
.messages-list-item:hover { border-color: var(--purple); }
.messages-list-item.is-active { border-color: var(--purple); background: rgba(124, 92, 255, 0.1); }
.messages-list-item.is-unread .messages-list-label { font-weight: 700; }
.messages-list-icon svg { width: 16px; height: 16px; color: var(--cyan); flex-shrink: 0; margin-top: 2px; }
.messages-list-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.messages-list-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.messages-list-label { color: #eef0ff; }
.messages-list-time { color: var(--text-dim); flex-shrink: 0; }
.messages-list-snippet { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.messages-unread-dot { position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--neon-red); }
.messages-empty { color: var(--text-dim); padding: 24px; text-align: center; }

.messages-detail {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.messages-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  color: var(--text-muted);
}
.messages-detail-header .ic svg { width: 15px; height: 15px; color: var(--cyan); }
.messages-detail-status {
  margin-left: auto;
  font-size: 11px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
}
.messages-status-replied, .messages-status-closed { color: var(--success); }
.messages-status-new, .messages-status-open { color: var(--cyan); }

.messages-thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 55vh;
}
.messages-bubble { max-width: 78%; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.messages-bubble-user { align-self: flex-end; background: linear-gradient(135deg, var(--purple), var(--cyan)); color: #fff; }
/* Same treatment as the user bubble (solid gradient card, white text) —
   just a different hue, so an admin reply reads as clearly as the user's
   own message instead of fading into a plain grey box next to it
   (2026-08-25: "стилизуй так же, только другим цветом"). */
.messages-bubble-admin { align-self: flex-start; background: linear-gradient(135deg, var(--success), var(--cyan)); color: #05261d; }
.messages-bubble-body a { color: inherit; text-decoration: underline; }
.messages-bubble-time { font-size: 10px; opacity: 0.7; margin-top: 4px; }
.messages-bubble-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.messages-attachment-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.15); }

.messages-reply-form {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 16px;
}
.messages-reply-form textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 8px 10px;
  color: #eef0ff;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
}
.messages-reply-form textarea:focus { outline: none; border-color: var(--purple); }
/* align-items:flex-start (not center) — the attach control can grow
   taller than the Send button once thumbnails appear below it; center
   would shift Send around as that height changes. */
.messages-reply-actions { display: flex; justify-content: space-between; align-items: flex-start; margin-top: 8px; }
