/* Styles propres aux pages « poolsec » (pages secondaires du pool, refonte 2026-09). Tout dans @layer pages. */
@layer pages {
  /* ---------- Commun : rangée de boutons (empilés pleine largeur sur téléphone) ---------- */
  .ps-btns { display: flex; flex-direction: column; gap: 8px; }
  .ps-btns > .btn, .ps-btns > form, .ps-btns > form > .btn { width: 100%; }
  @media (min-width: 48rem) {
    .ps-btns { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .ps-btns > .btn, .ps-btns > form, .ps-btns > form > .btn { width: auto; }
  }
  .ps-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; font-size: 14px; }
  .ps-back svg { transform: rotate(90deg); }
  .ps-card-head { display: flex; align-items: center; gap: 10px; }
  .ps-card-head .section-title { margin: 0; }
  .ps-card-icon {
    width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold);
  }

  /* ---------- Stats du pool ---------- */
  .stats-chip-sep { flex-shrink: 0; width: 1px; margin: 6px 4px; background: var(--border); }
  .stats-player { min-width: 150px; max-width: 46vw; }
  .stats-player .player-cell { color: inherit; }
  .stats-player .player-cell:hover { text-decoration: none; }
  .stats-player .player-cell:hover .p-name { text-decoration: underline; }
  .stats-player img.mug { width: 30px; height: 30px; }
  .stats-player .p-name { white-space: normal; }
  @media (min-width: 64rem) { .stats-player { min-width: 210px; max-width: 280px; } .stats-player img.mug { width: 36px; height: 36px; } }
  table.data td.stats-player { border-right: 1px solid var(--border); }
  .stats-prospect { background: color-mix(in srgb, var(--blue) 16%, transparent); color: var(--blue); }
  .stats-owner { font-size: .85rem; font-weight: 700; color: var(--gold); white-space: nowrap; }

  /* ---------- Trophées ---------- */
  .trophy-card .ps-card-head p { margin-top: 2px; }
  .trophy-card .pill svg { flex-shrink: 0; }
  .trophy-list { margin-inline: -16px; margin-bottom: -16px; border: 0; border-top: 1px solid var(--border); border-radius: 0 0 var(--r-lg) var(--r-lg); }
  @media (min-width: 64rem) { .trophy-list { margin-inline: -20px; margin-bottom: -20px; } }
  .trophy-list .list-row { padding-inline: 16px; }
  .trophy-list .pill { white-space: nowrap; }

  /* ---------- Messages : bulles type messagerie ---------- */
  .page.msg-page { max-width: 880px; }
  .msg-empty-icon { display: inline-flex; color: var(--muted); margin-bottom: 8px; }
  .msg-empty-icon + p { margin-top: 0; }
  .msg-thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
  .msg-row { display: flex; align-items: flex-end; gap: 8px; min-width: 0; }
  .msg-row.mine { flex-direction: row-reverse; }
  .msg-row.mine .msg-avatar { display: none; }
  .msg-avatar { width: 32px; height: 32px; font-size: 13px; }
  .msg-bubble {
    min-width: 0; max-width: min(80%, 560px);
    padding: 8px 12px 10px; border-radius: 18px 18px 18px 4px;
    background: var(--surface); border: 1px solid var(--border);
  }
  .msg-row.mine .msg-bubble {
    border-radius: 18px 18px 4px 18px;
    background: color-mix(in srgb, var(--red) 16%, var(--surface));
    border-color: color-mix(in srgb, var(--red) 35%, var(--border));
  }
  .msg-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 12.5px; }
  .msg-meta strong { color: var(--text); }
  .msg-row.mine .msg-meta { justify-content: flex-end; }
  .msg-time { color: var(--muted); font-variant-numeric: tabular-nums; }
  .msg-body { margin-top: 2px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
  .msg-delete { margin: 0; align-self: center; flex-shrink: 0; }
  .msg-delete-btn {
    width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 1px solid transparent; color: var(--muted);
  }
  .msg-delete-btn:hover { color: var(--red-text); border-color: color-mix(in srgb, var(--red) 45%, transparent); }

  /* Formulaire d'envoi collé en bas (au-dessus de la barre d'onglets sur téléphone) */
  .msg-compose {
    position: sticky; z-index: 5;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px);
    display: flex; align-items: flex-end; gap: 8px;
    padding: 8px; border-radius: var(--r-lg);
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: 0 8px 24px var(--shadow);
  }
  .msg-compose-field { flex: 1 1 auto; }
  .msg-compose-field textarea { min-height: 48px; max-height: 40vh; padding-block: 12px; }
  .msg-send { flex-shrink: 0; min-height: 48px; }
  @media (min-width: 64rem) { .msg-compose { bottom: 16px; } }

  /* ---------- Inviter ---------- */
  .invite-box input[type="text"] { flex-basis: 100%; min-height: 48px; font-size: 16px; }
  .invite-btns { display: flex; gap: 8px; width: 100%; }
  .invite-btns .btn { flex: 1 1 0; }
  @media (min-width: 48rem) {
    .invite-box { flex-wrap: nowrap; }
    .invite-box input[type="text"] { flex: 1 1 auto; }
    .invite-btns { width: auto; flex-shrink: 0; }
  }
  .invite-code-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
  .invite-code { font-family: var(--font-cond); font-weight: 800; font-size: 30px; line-height: 1; letter-spacing: .12em; }
  .invite-pending form { margin: 0; }
  ul.list { list-style: none; margin: 0; padding: 0; }

  /* ---------- Fiche joueur ---------- */
  .ps-back { align-self: flex-start; margin-block: -8px -4px; }
  .joueur-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .card.joueur-hero > * + * { margin-top: 0; }
  .joueur-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
  img.mug.joueur-mug { width: 88px; height: 88px; border-width: 2px; }
  .joueur-name { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
  .joueur-tags { gap: 6px; }
  .joueur-team { font-size: 14px; font-weight: 700; color: var(--muted); }
  .joueur-bio p + p { margin-top: 2px; }
  .joueur-cap {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px;
    padding-top: 14px; border-top: 1px solid var(--border);
  }
  .joueur-cap-value { font-family: var(--font-cond); font-weight: 800; font-size: 32px; line-height: 1.05; font-variant-numeric: tabular-nums; }
  .joueur-owner { white-space: normal; }
  .joueur-tile-hl { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
  .joueur-tile-hl .stat-value { color: var(--red-text); }
  @media (min-width: 64rem) {
    .joueur-hero { grid-template-columns: minmax(0, 1fr) auto; column-gap: 32px; align-items: center; }
    .joueur-id { grid-column: 1; }
    .joueur-bio { grid-column: 1; }
    .joueur-cap {
      grid-column: 2; grid-row: 1 / span 2;
      flex-direction: column; align-items: flex-end; justify-content: center;
      padding: 0 0 0 32px; border-top: 0; border-left: 1px solid var(--border); text-align: right;
    }
    img.mug.joueur-mug { width: 120px; height: 120px; }
    .joueur-cap-value { font-size: 40px; }
  }
  table.data td.joueur-season { font-weight: 700; white-space: nowrap; border-right: 1px solid var(--border); }
  table.data tr.joueur-total td { font-weight: 700; border-top: 2px solid var(--border); background: color-mix(in srgb, var(--blue) 8%, var(--surface)); }
  .joueur-career td:nth-child(2) { white-space: nowrap; }

  /* ---------- Réglages ---------- */
  .poolset-grid { align-items: start; }
  .poolset-order-head { min-height: 0; padding-block: 8px; background: var(--surface-2); }
  .poolset-order label.list-row { cursor: pointer; min-height: 60px; }
  .poolset-order .input.poolset-pos { width: 88px; flex-shrink: 0; text-align: center; font-weight: 700; }
  .poolset-order .input.poolset-pos[readonly] { color: var(--muted); }
  .poolset-danger { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
  .poolset-big { font-family: var(--font-cond); font-weight: 800; font-size: 32px; line-height: 1.1; }
  p.pill { display: inline-flex; white-space: normal; }

  /* ---------- Paiement / retour de paiement ---------- */
  .pay-state-icon {
    width: 52px; height: 52px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--muted);
  }
  .pay-state-icon.good { background: color-mix(in srgb, var(--up) 16%, transparent); color: var(--up); }
  .pay-state-icon.warn { background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold); }
  .pay-state-icon.bad { background: color-mix(in srgb, var(--down) 14%, transparent); color: var(--down); }
}
