/* =============================================================================
   LOGUETOWN — Messagerie (mes-messages) premium 2026
   Ergonomic conversation list: live search, annonce thumbnail, coloured avatar,
   preview, relative time. Scoped to .lt-msg-page. Loaded via the premium bundle.
   ============================================================================= */

.lt-msg-page { background: transparent; }

.lt-msg-page__title {
  font-family: var(--lt-font-display, "Fraunces", Georgia, serif);
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--lt-color-primary-strong, #0b0d10);
  margin: 0.35rem 0 0.4rem;
}

/* -----------------------------------------------------------------------------
   Toolbar: search + count
   ----------------------------------------------------------------------------- */
.lt-msg-toolbar {
  display: flex;
  align-items: center;
  gap: var(--lt-s-3, 0.75rem);
  margin-bottom: var(--lt-s-5, 1.25rem);
}
.lt-msg-search {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  max-width: 520px;
}
.lt-msg-search__icon {
  position: absolute;
  left: 14px;
  color: var(--lt-color-text-subtle, #8b95a3);
  pointer-events: none;
}
.lt-msg-search__input {
  width: 100%;
  height: 46px;
  padding: 0 16px 0 42px;
  border-radius: var(--lt-r-pill, 999px);
  border: 1px solid var(--lt-color-border, rgba(11,13,16,0.10));
  background: var(--lt-color-surface, #fff);
  color: var(--lt-color-text, #1c2024);
  font-family: var(--lt-font-body, "Inter", sans-serif);
  font-size: var(--lt-text-md, 0.9375rem);
  transition: border-color var(--lt-dur-fast,160ms) ease, box-shadow var(--lt-dur-fast,160ms) ease;
}
.lt-msg-search__input::placeholder { color: var(--lt-color-text-subtle, #8b95a3); }
.lt-msg-search__input:focus {
  outline: none;
  border-color: var(--lt-color-accent, #b8841a);
  box-shadow: var(--lt-ring-gold, 0 0 0 3px rgba(184,132,26,0.18));
}
.lt-msg-count {
  flex-shrink: 0;
  font-size: var(--lt-text-sm, 0.8125rem);
  font-weight: 600;
  color: var(--lt-color-text-muted, #5b6470);
  white-space: nowrap;
}

/* -----------------------------------------------------------------------------
   Conversation list
   ----------------------------------------------------------------------------- */
.lt-msg-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--lt-s-2, 0.5rem);
}
.lt-msg-list > li { margin: 0; }

.lt-msg {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: var(--lt-s-4, 1rem);
  padding: var(--lt-s-3, 0.75rem) var(--lt-s-4, 1rem);
  border-radius: var(--lt-r-lg, 16px);
  background: var(--lt-color-surface, #fff);
  border: 1px solid var(--lt-color-border, rgba(11,13,16,0.08));
  text-decoration: none;
  color: inherit;
  transition:
    background var(--lt-dur-fast, 160ms) var(--lt-ease-out, cubic-bezier(.22,1,.36,1)),
    border-color var(--lt-dur-fast, 160ms) var(--lt-ease-out, cubic-bezier(.22,1,.36,1)),
    box-shadow var(--lt-dur-base, 240ms) var(--lt-ease-out, cubic-bezier(.22,1,.36,1)),
    transform var(--lt-dur-fast, 160ms) var(--lt-ease-out, cubic-bezier(.22,1,.36,1));
}
.lt-msg:hover {
  background: var(--lt-color-surface, #fff);
  border-color: var(--lt-gold-line, rgba(184,132,26,0.22));
  box-shadow: var(--lt-elev-2, 0 4px 12px rgba(11,13,16,0.06));
  transform: translateY(-1px);
}
.lt-msg:focus-visible {
  outline: none;
  box-shadow: var(--lt-ring-gold, 0 0 0 3px rgba(184,132,26,0.18));
}

/* Media (thumbnail OR coloured initial) */
.lt-msg__media {
  width: 56px; height: 56px;
  border-radius: 14px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.lt-msg__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lt-msg__initial {
  font-family: var(--lt-font-display, "Fraunces", serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: #fff;
  line-height: 1;
}
/* Six pleasant avatar tints (no inline styles → CSP-safe) */
.lt-msg__media--c1 { background: linear-gradient(135deg, #b8841a, #9e6f12); }
.lt-msg__media--c2 { background: linear-gradient(135deg, #2f6f6b, #1f4f4c); }
.lt-msg__media--c3 { background: linear-gradient(135deg, #7c5cbf, #5b3fa0); }
.lt-msg__media--c4 { background: linear-gradient(135deg, #c0563a, #9e3f2a); }
.lt-msg__media--c5 { background: linear-gradient(135deg, #3a6ea5, #29527e); }
.lt-msg__media--c6 { background: linear-gradient(135deg, #4f7a3a, #3a5e2a); }
/* When a real image is present, the tint stays as a fallback only */
.lt-msg__media:has(.lt-msg__img) { background: var(--lt-color-surface-muted, #f7f5f1); }

/* Body */
.lt-msg__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lt-msg__top {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--lt-s-2, 0.5rem);
}
.lt-msg__name {
  font-family: var(--lt-font-body, "Inter", sans-serif);
  font-size: var(--lt-text-md, 0.9375rem);
  font-weight: 700;
  color: var(--lt-color-text, #1c2024);
  letter-spacing: -0.005em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lt-msg__time {
  flex-shrink: 0;
  font-size: var(--lt-text-xs, 0.75rem);
  color: var(--lt-color-text-subtle, #8b95a3);
  white-space: nowrap;
}
.lt-msg__annonce {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--lt-text-xs, 0.75rem);
  font-weight: 600;
  color: var(--lt-color-accent, #b8841a);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%;
}
.lt-msg__annonce svg { flex-shrink: 0; }
.lt-msg__preview {
  font-size: var(--lt-text-sm, 0.8125rem);
  color: var(--lt-color-text-muted, #5b6470);
  line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lt-msg__you { color: var(--lt-color-text-subtle, #8b95a3); font-weight: 600; }

.lt-msg__chevron {
  color: var(--lt-color-text-subtle, #8b95a3);
  flex-shrink: 0;
  transition: transform var(--lt-dur-base, 240ms) var(--lt-ease-out, cubic-bezier(.22,1,.36,1)),
              color var(--lt-dur-fast, 160ms) ease;
}
.lt-msg:hover .lt-msg__chevron { transform: translateX(3px); color: var(--lt-color-accent, #b8841a); }

/* Filter no-result */
.lt-msg-empty-filter {
  text-align: center;
  padding: var(--lt-s-8, 2rem) var(--lt-s-4, 1rem);
  color: var(--lt-color-text-muted, #5b6470);
  font-size: var(--lt-text-md, 0.9375rem);
}
.lt-msg-empty-filter[hidden] { display: none; }

/* -----------------------------------------------------------------------------
   Header layout tidy (uses existing .account-page-header)
   ----------------------------------------------------------------------------- */
.lt-msg-page .account-page-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--lt-s-5, 1.25rem);
  flex-wrap: wrap;
}

/* -----------------------------------------------------------------------------
   Dark / Grand-Line
   ----------------------------------------------------------------------------- */
[data-theme="dark"] .lt-msg,
body.lt-accueil-gl .lt-msg,
body.lt-acheter-gl .lt-msg,
body.lt26-grain .lt-msg {
  background: var(--lt-color-surface, #0e1a2e);
  border-color: var(--lt-color-border, rgba(240,236,226,0.08));
}
[data-theme="dark"] .lt-msg-search__input,
body.lt26-grain .lt-msg-search__input {
  background: var(--lt-color-surface, #0e1a2e);
  border-color: var(--lt-color-border, rgba(240,236,226,0.10));
  color: var(--lt-color-text, #f0ece2);
}

/* -----------------------------------------------------------------------------
   Mobile ≤640px
   ----------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .lt-msg { grid-template-columns: 48px 1fr; gap: var(--lt-s-3, 0.75rem); padding: var(--lt-s-3, 0.75rem); }
  .lt-msg__media { width: 48px; height: 48px; border-radius: 12px; }
  .lt-msg__chevron { display: none; }
  .lt-msg-toolbar { flex-direction: column; align-items: stretch; }
  .lt-msg-search { max-width: none; }
  .lt-msg-count { align-self: flex-end; }
  .lt-msg-page .account-page-header-inner .btn-account-primary { width: 100%; justify-content: center; }
}

/* -----------------------------------------------------------------------------
   Reduced motion
   ----------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .lt-msg, .lt-msg__chevron { transition: none !important; }
  .lt-msg:hover { transform: none !important; }
  .lt-msg:hover .lt-msg__chevron { transform: none !important; }
}
