/*
 * amitie.css — styles du module amitié (bloc actions fiche-membre)
 * Layer : modules
 * Injecté via 'extraCssFiles' depuis app/modules/fiche-membre/module.php.
 */

@layer modules {

  .fm-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--line, var(--color-border));
    border-bottom: 1px solid var(--line, var(--color-border));
    margin: 0.5rem 0 0.75rem;
  }

  .fm-friends-count {
    font-size: 0.95rem;
    color: var(--muted, var(--color-text-muted));
    margin-right: auto;
  }
  .fm-friends-count strong {
    color: var(--text, var(--color-text));
    font-weight: 600;
    margin-right: 0.25rem;
  }

  .fm-actions-note {
    font-size: 0.9rem;
    color: var(--muted, var(--color-text-muted));
  }
  .fm-actions-note--warn {
    color: var(--color-red, var(--palette-red-500));
  }

  /* Wrapper pour le bouton "Envoyer un message" grisé : un <button disabled>
     ne déclenche pas :hover, on met donc le tooltip sur le span parent. */
  .fm-message-wrap {
    position: relative;
    display: inline-flex;
    cursor: not-allowed;
  }
  /* Force un vrai état grisé indépendamment du variant .btn--primary/--ghost/etc.
     Les styles par défaut du design system ne différencient pas assez un disabled
     d'un actif sur le primary bleu. */
  .fm-message-wrap .btn[disabled],
  .fm-message-wrap .btn:disabled {
    background: var(--line, var(--palette-slate-200));
    color: var(--muted, var(--color-text-muted));
    border-color: var(--line, var(--color-border));
    cursor: not-allowed;
    box-shadow: none;
    pointer-events: none;
  }
  .fm-message-wrap::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text, var(--palette-slate-900));
    color: var(--color-text-inverse);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.35;
    width: max-content;
    max-width: 280px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease-out;
    z-index: 10;
  }
  .fm-message-wrap::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--text, var(--palette-slate-900));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease-out;
  }
  .fm-message-wrap:hover::before,
  .fm-message-wrap:hover::after,
  .fm-message-wrap:focus-within::before,
  .fm-message-wrap:focus-within::after {
    opacity: 1;
  }

  @media (max-width: 520px) {
    .fm-actions {
      flex-direction: column;
      align-items: stretch;
    }
    .fm-friends-count {
      margin-right: 0;
    }
    .fm-message-wrap::before {
      max-width: calc(100vw - 48px);
    }
  }

}
