/* ===========================================================
   MOBILE CSS - VERSION 49 - SIGNATURE FIX
   =========================================================== */

/* === BASE MOBILE === */
@media (max-width: 768px) {
  body {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
  }
  
  input, select, textarea, button {
    font-size: 16px !important;
    min-height: 48px;
  }
  
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* === EMPÊCHER ZOOM DOUBLE-TAP === */
* {
  touch-action: manipulation;
}

/* ============================================================
   SIGNATURE CANVAS - SECTION CRITIQUE POUR MOBILE
   ============================================================ */

/* Container de signature - permet scroll vertical */
#signature-container {
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: auto !important;
  overscroll-behavior: contain !important;
  position: relative;
  z-index: 10;
}

/* CANVAS SIGNATURE - DOIT CAPTURER TOUS LES TOUCH */
#sigpad,
canvas#sigpad,
.signature-canvas,
#signature-container canvas,
canvas[id="sigpad"] {
  touch-action: none !important;
  -ms-touch-action: none !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
  cursor: crosshair;
  position: relative;
  z-index: 20;
}

/* Bouton effacer - bien cliquable sur mobile */
#sig-clear,
button#sig-clear {
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: rgba(239, 68, 68, 0.3) !important;
  min-height: 48px !important;
  min-width: 100px !important;
  cursor: pointer;
  z-index: 30;
}

#sig-clear:active {
  background-color: #fef2f2 !important;
  transform: scale(0.98);
}

/* ============================================================ */

/* === CHAMPS DATE === */
input[type="date"] {
  min-height: 48px;
  line-height: 1.5;
}

/* === CHECKBOX & RADIO === */
input[type="checkbox"], input[type="radio"] {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
}

/* === BOUTONS NAVIGATION === */
@media (max-width: 768px) {
  .nav-buttons {
    flex-direction: column;
    gap: 12px;
  }
  
  .nav-buttons button {
    width: 100%;
    min-height: 52px;
    font-size: 16px;
  }
}

/* === ZONES UPLOAD === */
@media (max-width: 768px) {
  .upload-zone {
    padding: 24px 16px;
    min-height: 120px;
  }
}

/* === MODAL FIX === */
.modal-content {
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* === DÉSACTIVER SÉLECTION TEXTE SUR ÉLÉMENTS INTERACTIFS === */
button, 
.btn,
.upload-zone,
#signature-container {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* === FIX iOS SAFARI === */
@supports (-webkit-touch-callout: none) {
  #sigpad {
    touch-action: none !important;
  }
  
  #sig-clear {
    cursor: pointer;
  }
}
