/* ==========================================================================
 * Festival Studio - Messages (js/views/messages.js)
 *
 *  1. Page frame        st-msg-page  st-msg-grid
 *  2. Composer          st-msg-compose  st-msg-aud (who gets it: checkboxes)
 *  3. Preview           st-msg-phone  st-msg-note (a phone notification)
 *  4. Sent list         st-msg-list  st-msg-item
 *  5. Narrow screens, reduced motion
 * ========================================================================== */

/* ---------- 1. Page frame ---------- */
.st-msg-page > * + * { margin-top: 20px; }
.st-msg-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: 20px; align-items: start; }

/* ---------- 2. Composer ---------- */
.st-msg-compose .st-textarea { min-height: 96px; }
.st-msg-compose__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-top: 4px; }
.st-msg-compose__notes { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 56ch; }
.st-msg-wait { font-size: 12.5px; line-height: 1.45; color: #fcd34d; }
.st-msg-compose__foot .st-btn { flex: 0 0 auto; }

.st-msg-aud { display: flex; flex-direction: column; gap: 8px; }
.st-msg-aud__item {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start;
  padding: 10px 12px; border: 1px solid var(--st-border); border-radius: var(--st-r-10);
  background: rgba(255, 255, 255, 0.02); cursor: pointer;
  transition: border-color var(--st-ease), background-color var(--st-ease);
}
.st-msg-aud__item:hover { border-color: var(--st-border-strong); }
.st-msg-aud__item.is-active { border-color: rgba(124, 92, 255, 0.7); background: rgba(109, 92, 255, 0.1); }
.st-msg-aud__item:has(:focus-visible) { outline: 2px solid var(--st-focus); outline-offset: 2px; }
.st-msg-aud__input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--st-violet-2); }
.st-msg-aud__input:focus-visible { outline: none; }
.st-msg-aud__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-msg-aud__label { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; font-size: 13.5px; font-weight: 600; }
.st-msg-aud__count { font-size: 12px; font-weight: 500; color: var(--st-lavender); font-variant-numeric: tabular-nums; }
.st-msg-aud__help { font-size: 12.5px; line-height: 1.45; color: var(--st-text-muted); }
.st-msg-aud__hint { font-size: 12.5px; line-height: 1.45; color: #fcd34d; }
.st-msg-aud__item.is-disabled { cursor: not-allowed; }
.st-msg-aud__item.is-disabled:hover { border-color: var(--st-border); }
.st-msg-aud__item.is-disabled .st-msg-aud__label, .st-msg-aud__item.is-disabled .st-msg-aud__help { opacity: 0.55; }
.st-msg-aud__input:disabled { cursor: not-allowed; }
.st-msg-aud__total { margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- 3. Preview ---------- */
.st-msg-phone {
  display: flex; flex-direction: column; align-items: stretch; gap: 14px; max-width: 400px; margin-inline: auto;
  padding: 18px 14px 26px; border-radius: 26px; border: 1px solid var(--st-border-strong);
  background: radial-gradient(120% 90% at 20% 0%, rgba(109, 92, 255, 0.35), transparent 60%),
    radial-gradient(120% 90% at 100% 100%, rgba(52, 211, 153, 0.18), transparent 55%), #0a0d18;
}
.st-msg-phone__clock { text-align: center; font-size: 34px; font-weight: 600; letter-spacing: -0.02em; color: rgba(255, 255, 255, 0.92); font-variant-numeric: tabular-nums; }
.st-msg-note {
  display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; border-radius: 16px;
  background: rgba(245, 247, 255, 0.86); color: #10131f; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.st-msg-note__head { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; font-size: 11.5px; color: rgba(16, 19, 31, 0.6); }
.st-msg-note__app { width: 20px; height: 20px; border-radius: 5px; background: #05060a; object-fit: cover; }
.st-msg-note__name { font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.st-msg-note__time { margin-left: auto; }
.st-msg-note__title { font-size: 13.5px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.st-msg-note__body { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.st-msg-note__title.is-empty, .st-msg-note__body.is-empty { color: rgba(16, 19, 31, 0.4); }
.st-msg-preview__who { color: var(--st-text-dim); }

/* ---------- 4. Sent list ---------- */
.st-msg-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.st-msg-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 4px; border-top: 1px solid var(--st-border); border-radius: var(--st-r-8); transition: background-color 600ms ease; }
.st-msg-item:first-child { border-top: 0; padding-top: 2px; }
.st-msg-item.is-new { background: rgba(109, 92, 255, 0.12); }
.st-msg-item__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.st-msg-item__title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.st-msg-item__time { flex: 0 0 auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-msg-item__body { font-size: 13.5px; line-height: 1.5; color: var(--st-text-dim); overflow-wrap: anywhere; white-space: pre-line; }

/* ---------- 5. Narrow screens, reduced motion ---------- */
@media (max-width: 960px) {
  .st-msg-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .st-msg-compose__foot { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  .st-msg-aud__item, .st-msg-item { transition: none; }
}
