/*
 * R2H — Documentation de style
 * Fichier : mobile/css/mobile-core.css
 * Périmètre : Socle mobile transversal partagé (safe-area, masquage des barres de scroll, anti-zoom iOS 16px, modales Bottom-Sheet).
 * Cascade / précautions : Chargé sur app.html et sur les pages publiques/auth ; n'altère aucun style bureau (> 900px).
 * Référence : mobile/README.md ; docs/REFERENCE_FICHIERS.md
 * Signature du projet : @admin-zaloria
 */

/* ---------- 14. RESPONSIVE GLOBAL & ERGONOMIE MOBILE ---------- */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

@media (max-width: 1080px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-3 { grid-template-columns: repeat(2, 1fr); }
  .col-3,.col-4,.col-5,.col-7 { grid-column: span 6; }
  .col-8 { grid-column: span 12; }
}
@media (max-width: 720px) {
  .g-2,.g-3,.g-4 { grid-template-columns: 1fr; }
  .col-3,.col-4,.col-5,.col-6,.col-7,.col-8 { grid-column: span 12; }
  body { font-size: var(--fs-sm); }
  h1 { font-size: var(--fs-xl); }
  .card { padding: 15px; }
  .toasts { top: auto; left: 12px; right: 12px; bottom: calc(80px + var(--safe-bottom)); width: auto; max-width: none; }
}

@media (max-width: 680px) {
  /* Formulaires mobiles anti-zoom iOS & cibles tactiles >= 44px */
  .input, .select, .textarea {
    min-height: 44px;
    font-size: 16px;
  }
  .btn { min-height: 40px; }
  .btn-lg { min-height: 46px; }

  /* Modales en Bottom-Sheet mobile natif */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal,
  .modal.sm,
  .modal.lg,
  .modal.xl {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
  }
  .modal-head {
    padding: 18px 16px 13px;
    position: relative;
  }
  .modal-head::after {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 4px;
    border-radius: 99px;
    background: var(--border-strong);
    opacity: .85;
  }
  .modal-body { padding: 14px 16px 18px; }
  .modal-foot {
    padding: 12px 16px calc(14px + var(--safe-bottom));
    flex-wrap: wrap;
  }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; }

  /* Drawers plein écran confortable sur smartphone */
  .drawer { width: 100vw; max-width: 100vw; }
  .stepper { flex-wrap: wrap; gap: 8px 12px; }
  .step .step-line { display: none; }
  .step .step-l { white-space: normal; }
}

/* Masquage visuel des barres de défilement sur mobile tout en conservant le scroll natif fluide */
@media (max-width: 900px) {
  html, body, * {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  html::-webkit-scrollbar,
  body::-webkit-scrollbar,
  *::-webkit-scrollbar {
    display: none;
    width: 0 !important;
    height: 0 !important;
    background: transparent;
  }
}
