/* The conversation thread every domain shares (core.threads): components/thread.html, its composer
   (components/thread_composer.html) and its photos. Drawn like the kiln ticket thread. Loaded once
   by hub/base.html, because threads sit on many hub pages (orientation bookings first). */

/* The thread: every message oldest first. The viewer's own side sits right. */
.pl-thread { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
.pl-thread-msg {
    max-width: 88%;
    padding: 0.625rem 0.875rem;
    border-radius: 12px;
    background: var(--hub-surface);
    border: 1px solid var(--hub-border);
    font-size: 0.9rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.pl-thread-msg--mine { justify-self: end; background: var(--hub-blue-soft); border-color: var(--hub-border-strong); }
.pl-thread-msg__who {
    display: flex;
    gap: 0.4rem;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 0.2rem;
    font-size: 0.78rem;
    color: var(--hub-text-muted);
}
.pl-thread-msg__who strong { color: var(--hub-text); font-size: 0.82rem; }
.pl-thread-msg__role { padding: 0 0.35rem; border-radius: 4px; border: 1px solid var(--hub-border-strong); font-size: 0.7rem; }
.pl-thread-msg__photos { margin-top: 0.75rem; }
.pl-thread__empty { margin-top: 0.75rem; font-size: 0.875rem; color: var(--hub-text-muted); }

/* The composer under a thread, on both sides */
.pl-thread-reply { margin-top: 1.5rem; }
.pl-thread-reply .pl-form-group textarea { min-height: 88px; }
.pl-thread-reply__row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}
.pl-thread-reply__row .hub-btn { min-height: 44px; }
.pl-thread-reply__note { font-size: 0.8rem; color: var(--hub-text-muted); }

/* Photo thumbnails */
.pl-thread-photos { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pl-thread-photos__item {
    display: block;
    width: 96px;
    height: 96px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--hub-input-border, rgba(139, 151, 168, 0.3));
}
.pl-thread-photos__item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* A thread folded into a card (an orientation booking's Messages on its card), clear of what is above. */
.pl-thread-fold { margin-top: 0.75rem; }
/* "Tap to open." only while the fold is closed. */
.pl-thread-fold[open] .pl-thread-fold__tap { display: none; }

/* A thread anchored by ?messages=<key> scrolls clear of the sticky top bar. */
[data-thread-open] { scroll-margin-top: 5rem; }

/* What a thread in a modal is about (an equipment reservation's Messages), above its messages. */
.pl-thread-summary {
    display: grid;
    gap: 0.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--hub-border);
}
.pl-thread-summary__title { font-size: 0.95rem; color: var(--hub-text); }
.pl-thread-summary__meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--hub-text-muted);
}
/* The light theme's pill text, as the bookings tables read it: the plain pill colours wash out on white. */
[data-theme="light"] .pl-thread-summary .hub-pill--ok { color: #1f7a52; }
[data-theme="light"] .pl-thread-summary .hub-pill--neutral { color: #5b6675; }
[data-theme="light"] .pl-thread-summary .hub-pill--warn { color: #9a6a00; }
