/* Mobile Scroll and Pull-to-Refresh Fixes */

/* Prevent pull-to-refresh on mobile browsers */
html, body {
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}

/* Additional mobile scroll stability */
@supports (-webkit-appearance: none) {
  /* Safari-specific fixes */
  /* ✅ FIX: Changed from 'hidden' to 'clip' - hidden breaks sticky positioning on Safari */
  html {
    overflow-x: clip;
  }
  
  body {
    -webkit-overflow-scrolling: touch;
    overflow-x: clip; /* ✅ FIX: clip allows sticky to work */
  }
}

/* Prevent overscroll bounce on mobile */
@media (max-width: 768px) {
  html, body {
    overscroll-behavior: none !important;
    overscroll-behavior-y: none !important;
    overscroll-behavior-x: none !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* Prevent body scroll when modals are open */
  body.modal-open {
    overflow-y: hidden !important;
    overflow-x: clip !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
  }
  
  /* Prevent touch events from causing unwanted behavior */
  .no-pull-refresh {
    overscroll-behavior: none !important;
    -webkit-overscroll-behavior: none !important;
  }
}

/* Modal overlay fixes for proper cleanup */
.modal-overlay-fix {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 99999 !important;
  background: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

.modal-overlay-fix.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Fix for confirmation modal backgrounds */
#validation-modal {
  touch-action: manipulation;
}

#validation-modal.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Prevent scroll during modal interactions */
.modal-backdrop {
  overscroll-behavior: none !important;
  -webkit-overflow-scrolling: auto !important;
}