/* ==================================================================
   messaging.css — Messaging surfaces
   ------------------------------------------------------------------
   Owns:
     - Dashboard Messages-column conversation rows (pr34, pr39)
     - Standalone /inbox page chrome (pr39)

   Both surfaces consume the shared partial
   messaging/_conversation_list.html and share rules via comma-joined
   parent selectors (.dashboard-grid .dashboard-column-body, .inbox-page).

   Per-thread message bubbles are NOT duplicated here — they render
   through the post-card chrome defined in feed.css.

   Reference: markdown/design/DESIGN_DECISIONS_CSS_REFACTOR.md
   ================================================================== */

/* === Messages conversation rows (pr34 + pr39) ====================
   Visual treatment for conversation-row lists. Carries the pr31
   notifications inbox-row aesthetic forward — same hover halo,
   subtle bottom dividers, hover-revealed chevron, 3px violet
   left-edge bar for unread state, opacity-dim for read state.

   Two-line content layout: name + time on the top row, full-width
   last-message preview on the bottom row. Group conversations get
   a small 👥 glyph overlay on the avatar (same chip pattern as
   .notification-glyph).

   Used by:
     - dashboard Messages column (.dashboard-grid .dashboard-column-body)
     - standalone inbox page (.inbox-page) — pr39

   Both surfaces consume the shared partial
   messaging/_conversation_list.html and share these rules via
   comma-joined parent selectors. Page-header primitives for the
   standalone inbox page live in a separate section below
   (`.inbox-page` / `.inbox-page-header` / `.inbox-count-pill` /
   `.inbox-new-btn`).

   Companion rules elsewhere in this file:
     - `.notification-row` (line ~4097) is the visual reference; many
       values below mirror it deliberately so the surfaces read as
       the same family.
     - `.avatar.avatar-xl` provides the 44px circle; the wrap below
       only adds positioning context for the group glyph.
   ================================================================ */

/* Container — just a flex column. Padding lives on the column body
   (set elsewhere); rows handle their own internal padding. */
.dashboard-grid .dashboard-column-body .messages-list,
.inbox-page .messages-list {
    display: flex;
    flex-direction: column;
}

/* The row — mirror of .notification-row from pr31. Whole-row click
   target via wrapping <a>. */
.dashboard-grid .dashboard-column-body .messages-row,
.inbox-page .messages-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border-subtle);
    position: relative;
    color: inherit;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: box-shadow var(--transition-medium),
                background-color var(--transition-fast);
}

.dashboard-grid .dashboard-column-body .messages-row:last-child,
.inbox-page .messages-row:last-child {
    border-bottom: 0;
}

/* Force inherited text color so the row's <a> doesn't paint accent
   on rest state. Hover/focus keeps the same to prevent re-color
   flashes during halo transitions. */
.dashboard-grid .dashboard-column-body a.messages-row,
.dashboard-grid .dashboard-column-body a.messages-row:visited,
.dashboard-grid .dashboard-column-body a.messages-row:hover,
.dashboard-grid .dashboard-column-body a.messages-row:focus-visible,
.inbox-page a.messages-row,
.inbox-page a.messages-row:visited,
.inbox-page a.messages-row:hover,
.inbox-page a.messages-row:focus-visible {
    color: var(--color-text);
    text-decoration: none;
    outline: none;
}

/* Three-layer hover halo — identical to .notification-row, so the two
   surfaces feel like one family. z-index lifts the hovered row above
   neighbors so the halo paints over their borders, not under them. */
.dashboard-grid .dashboard-column-body .messages-row:hover,
.dashboard-grid .dashboard-column-body .messages-row:focus-visible,
.inbox-page .messages-row:hover,
.inbox-page .messages-row:focus-visible {
    z-index: 1;
    box-shadow:
        0 0 0 1px rgba(var(--color-halo-rgb), 0.45),
        0 0 12px 2px rgba(var(--color-halo-rgb), 0.22),
        0 0 32px 4px rgba(var(--color-halo-rgb), 0.10);
}

/* The unread bar — 3px violet vertical line on the row's left edge,
   identical to .notification-row.is-unread::before. */
.dashboard-grid .dashboard-column-body .messages-row.is-unread::before,
.inbox-page .messages-row.is-unread::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 28px;
    background: var(--color-accent);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px color-mix(in srgb, var(--color-accent) 50%, transparent);
}

/* Read rows dim, mirroring .notification-row.is-read. */
.dashboard-grid .dashboard-column-body .messages-row.is-read,
.inbox-page .messages-row.is-read {
    opacity: 0.6;
}

/* Avatar-glyph wrap for group conversations — positioning context for
   the bottom-right glyph. The avatar itself sits inside, unchanged. */
.dashboard-grid .dashboard-column-body .messages-avatar-wrap,
.inbox-page .messages-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

/* The 👥 group-indicator chip. Sized to read as floating above the
   avatar; the 1.5px page-color ring + 1px border-color ring is the
   same chip pattern as .notification-glyph so group convos read as
   visually consistent with notification rows. */
.dashboard-grid .dashboard-column-body .messages-group-glyph,
.inbox-page .messages-group-glyph {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-bg-page);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    box-shadow: 0 0 0 1.5px var(--color-bg-page),
                0 0 0 2.5px var(--color-border);
}

/* Body — takes remaining horizontal space, contains the two stacked
   lines (top: name + time, bottom: preview). min-width: 0 lets the
   text children truncate via ellipsis. */
.dashboard-grid .dashboard-column-body .messages-body,
.inbox-page .messages-body {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.4;
}

/* Top line — name on the left (flex-grows, truncates), timestamp on
   the right (fixed-width). */
.dashboard-grid .dashboard-column-body .messages-top-line,
.inbox-page .messages-top-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
    min-width: 0;
}

.dashboard-grid .dashboard-column-body .messages-name,
.inbox-page .messages-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.95rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-grid .dashboard-column-body .messages-time,
.inbox-page .messages-time {
    flex-shrink: 0;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

/* Preview — bottom line, single-line truncate, muted. */
.dashboard-grid .dashboard-column-body .messages-preview,
.inbox-page .messages-preview {
    margin-top: 2px;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Group convos prefix the preview with the sender's name, e.g.
   "ben: lol that's wild". The sender label gets a subtle weight
   bump so it reads as a label rather than dissolving into the
   preview text. */
.dashboard-grid .dashboard-column-body .messages-preview-sender,
.inbox-page .messages-preview-sender {
    color: var(--color-text);
    font-weight: var(--font-weight-medium);
    opacity: 0.85;
    margin-right: 2px;
}

/* Chevron — hidden by default, fades in + translates right 2px on
   hover/focus. Identical to .notification-chevron. */
.dashboard-grid .dashboard-column-body .messages-chevron,
.inbox-page .messages-chevron {
    flex-shrink: 0;
    color: var(--color-text-muted);
    opacity: 0;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.dashboard-grid .dashboard-column-body .messages-row:hover .messages-chevron,
.dashboard-grid .dashboard-column-body .messages-row:focus-visible .messages-chevron,
.inbox-page .messages-row:hover .messages-chevron,
.inbox-page .messages-row:focus-visible .messages-chevron {
    opacity: 1;
    transform: translateX(2px);
}

/* Empty state — replaces the old utility-class chain on the
   no-conversations div. Quiet centered prompt. */
.dashboard-grid .dashboard-column-body .messages-empty,
.inbox-page .messages-empty {
    text-align: center;
    padding: var(--space-5) var(--space-4);
    color: var(--color-text-muted);
}

.dashboard-grid .dashboard-column-body .messages-empty-title,
.inbox-page .messages-empty-title {
    margin: 0 0 var(--space-1) 0;
    font-weight: var(--font-weight-semibold);
    font-size: 0.95rem;
    color: var(--color-text);
}

.dashboard-grid .dashboard-column-body .messages-empty-cta,
.inbox-page .messages-empty-cta {
    margin: 0;
    font-size: var(--font-size-base);
}

.dashboard-grid .dashboard-column-body .messages-empty-cta a,
.inbox-page .messages-empty-cta a {
    color: var(--color-accent);
}

.dashboard-grid .dashboard-column-body .messages-empty-cta a:hover,
.inbox-page .messages-empty-cta a:hover {
    color: var(--color-accent-hover);
}

/* Reduced-motion: kill the chevron movement; halo box-shadow change
   is already non-distracting. */
@media (prefers-reduced-motion: reduce) {
    .dashboard-grid .dashboard-column-body .messages-row,
    .dashboard-grid .dashboard-column-body .messages-chevron,
    .inbox-page .messages-row,
    .inbox-page .messages-chevron {
        transition: none;
    }

    .dashboard-grid .dashboard-column-body .messages-row:hover .messages-chevron,
    .dashboard-grid .dashboard-column-body .messages-row:focus-visible .messages-chevron,
    .inbox-page .messages-row:hover .messages-chevron,
    .inbox-page .messages-row:focus-visible .messages-chevron {
        transform: none;
    }
}

/* === Inbox page chrome (pr39) ====================================
   Page-header primitives for the standalone /messages/ inbox page.
   Mirrors the notifications-page header anatomy (h1 + count pill +
   right-aligned action button) so the two surfaces feel like a
   family.

   The conversation rows themselves are styled by the shared pr34+pr39
   `.messages-row` ruleset above; this section is only the page chrome
   that wraps them.

   Possible future tech-debt: `.inbox-page-header` / `.inbox-page-title`
   / `.inbox-count-pill` / `.inbox-new-btn` are visually near-identical
   to `.notifications-header` / `.notifications-title` /
   `.notifications-count-pill` / `.notifications-mark-all-btn`. A future
   refactor could lift these into a shared `.page-header` family. Not
   in scope for pr39.
   ================================================================ */

.inbox-page {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-5) var(--space-3);
}

.inbox-page-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.inbox-page-title {
    font-size: 1.5rem;
    font-weight: var(--font-weight-semibold);
    margin: 0;
    letter-spacing: -0.02em;
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.inbox-count-pill {
    display: inline-flex;
    align-items: baseline;
    padding: 2px 10px;
    background: color-mix(in srgb, var(--color-accent) 14%, transparent);
    color: var(--color-accent);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
    font-variant-numeric: tabular-nums;
}

/* Primary action button — filled accent. Matches the pr31 mark-all-btn
   in shape but uses the accent fill (this is the page's primary CTA,
   not a quiet utility action). */
.inbox-new-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 14px;
    background: var(--color-accent);
    border: 1px solid var(--color-accent);
    color: var(--color-text-on-accent);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color var(--transition-fast),
                border-color var(--transition-fast),
                color var(--transition-fast);
}

.inbox-new-btn:hover,
.inbox-new-btn:focus-visible {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: var(--color-text-on-accent);
    outline: none;
}

.inbox-new-btn:focus-visible {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent) 40%, transparent);
}

/* Responsive — same shape as the notifications page on narrow screens.
   Title stacks above the action button so neither gets squeezed. */
@media (max-width: 600px) {
    .inbox-page {
        padding: var(--space-3) var(--space-2);
    }

    .inbox-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-2);
    }

    .inbox-new-btn {
        align-self: flex-start;
    }
}
</content>
</invoke>