/* =================================================================
   MARS — bottom-sheet.css
   Nouveau fichier. À inclure après style.css.
   =================================================================
   Pattern "bottom sheet" : remplace les modals centrés pour les
   formulaires mobiles. Fournit :
   - scrim cliquable
   - grip en haut (drag-to-dismiss)
   - actions sticky en bas
   - respect safe-area-inset-bottom
   ================================================================= */

.sheet-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.24s ease;
  pointer-events: none;
}
.sheet-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 201;

  max-height: 86vh;
  display: flex;
  flex-direction: column;

  background: var(--m-dark-gray, #141414);
  border-top: 1px solid var(--m-steel, #3A3A3A);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -20px 40px -10px rgba(0,0,0,0.7);

  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);

  /* Respect du home indicator iPhone */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-sheet.open {
  transform: translateY(0);
}
.bottom-sheet.dragging {
  transition: none;  /* suivi du doigt en live */
}

/* Grip (drag handle) */
.bottom-sheet .sheet-grip {
  width: 100%;
  padding: 10px 0 6px;
  display: flex;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}
.bottom-sheet .sheet-grip::before {
  content: '';
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--m-steel, #3A3A3A);
}
.bottom-sheet.dragging .sheet-grip { cursor: grabbing; }

/* Header (optionnel) */
.bottom-sheet .sheet-header {
  padding: 4px 20px 14px;
  text-align: center;
  flex-shrink: 0;
}
.bottom-sheet .sheet-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--m-accent, #F5F5F0);
}
.bottom-sheet .sheet-subtitle {
  font-size: 12px;
  color: var(--m-accent-dark, #A3A39E);
  margin-top: 4px;
}

/* Zone scrollable du contenu */
.bottom-sheet .sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 20px 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Actions sticky en bas */
.bottom-sheet .sheet-actions {
  display: flex;
  gap: 10px;
  padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--m-dark-gray, #141414);
  border-top: 1px solid var(--m-steel, #3A3A3A);
  flex-shrink: 0;
}
.bottom-sheet .sheet-btn {
  flex: 1;
  height: 50px;
  border: none;
  border-radius: 12px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1.5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bottom-sheet .sheet-btn.cancel {
  background: transparent;
  border: 1px solid var(--m-steel, #3A3A3A);
  color: var(--m-accent-dim, #D4D4CF);
}
.bottom-sheet .sheet-btn.save {
  background: linear-gradient(135deg, var(--m-accent-green-2, #2ECC71), var(--m-accent-green, #19E639));
  color: var(--m-black, #0A0A0A);
}
.bottom-sheet .sheet-btn:active { transform: scale(0.97); }

/* Quand clavier ouvert : on décolle les actions du bas au-dessus du clavier */
body.keyboard-open .bottom-sheet .sheet-actions {
  padding-bottom: 14px;  /* ignore safe-area, le clavier s'en charge */
}
