/* ==========================================================
   Adaptation mobile — de 320 px (petits téléphones) à la tablette
   Chargé après style.css : ne surcharge que ce qui déborde ou
   ne tient pas sur petit écran.
   ========================================================== */

/* Filet de sécurité : aucun média ni bloc ne doit sortir de l'écran */
body { overflow-x: clip; }
img, svg, video, canvas, iframe { max-width: 100%; }
#app, .admin-main, .admin-content, .account-main { min-width: 0; }
h1, h2, h3, h4, em { overflow-wrap: anywhere; }

@media (max-width: 760px) {
  /* Boutons longs : retour à la ligne plutôt que débordement */
  .button, button, .copy-iban {
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }
  .rib-card, .account-panel, .account-card { min-width: 0; }
  .rib-card .copy-iban { width: 100%; }
}

@media (max-width: 620px) {
  /* Champs de formulaire à 16 px : pas de zoom automatique sur iOS */
  input, select, textarea { font-size: 16px; max-width: 100%; }

  /* Récapitulatif de commande : tableau remplacé par des lignes lisibles */
  .payment-page-wrap .payment-table-head { display: none; }
  .payment-page-wrap .payment-item-row {
    grid-template-columns: repeat(3, auto);
    justify-content: space-between;
    align-items: center;
    gap: 6px 12px;
    min-height: 0;
    padding: 14px;
  }
  .payment-page-wrap .payment-table-head,
  .payment-page-wrap .payment-item-row { min-width: 0 !important; width: 100%; }
  .payment-page-wrap .payment-product { grid-column: 1 / -1; min-width: 0; }
  .payment-page-wrap .payment-product strong { min-width: 0; max-width: 100%; }
  .payment-page-wrap .payment-item-row > span::before { content: "Qté "; color: #7d8980; }
  .payment-page-wrap .payment-item-row > span:nth-of-type(2)::before { content: "P.U. "; color: #7d8980; }
  .payment-page-wrap .payment-item-row > span:nth-of-type(1)::before { content: "Qté "; color: #7d8980; }
  .payment-page-wrap .payment-item-row > span:nth-of-type(2) { font-size: 10px; }
  .payment-page-wrap .payment-totals > div { gap: 12px; }
  .payment-page-wrap .payment-totals > div > span,
  .payment-page-wrap .payment-totals > div > strong { min-width: 0; overflow-wrap: anywhere; }

  /* Administration : grilles de statistiques et graphiques sur une colonne */
  .admin-content { padding: 16px; }
  .admin-header { flex-wrap: wrap; gap: 12px; }
  .admin-header h1 { font-size: 22px; }
  .admin-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-main-grid > *, .admin-bottom-grid > * { min-width: 0; }
  .admin-panel { min-width: 0; overflow-x: auto; }
  .panel-heading { flex-wrap: wrap; gap: 10px; }
  .panel-heading select { max-width: 100%; }
  .fake-chart { min-width: 0; }
  .admin-data-head, .admin-data-row { min-width: 0; }
  .admin-content select, .admin-content label { max-width: 100%; min-width: 0; }
  .admin-content select { width: 100%; }

  /* Bandeau du compte : texte puis bouton, empilés */
  .account-overview-banner { flex-direction: column; align-items: stretch; gap: 16px; }
  .account-overview-banner > *, .account-overview-banner > * > * { min-width: 0; max-width: 100%; }
  .account-overview-banner .button { justify-content: center; white-space: normal; }
}

@media (max-width: 380px) {
  /* Très petits écrans : une seule colonne pour les statistiques */
  .admin-stat-grid { grid-template-columns: minmax(0, 1fr); }
  .payment-page-wrap .payment-item-row { padding: 12px; }
  .payment-page-wrap .payment-totals { font-size: 9px; }
}
