/* Bottom Sheet Swipe Animation Styles */

/* Base styles for swipeable sheets - only apply custom properties when dragging */
[data-restaurant-details-target="sheetContent"].is-dragging,
[data-meal-coordination-target="sheetContent"].is-dragging {
  /* Use CSS custom properties for dynamic transforms during drag */
  transform: translateY(var(--swipe-offset, 0)) !important;
  opacity: var(--swipe-opacity, 1);
}

/* Remove transitions during active drag */
.is-dragging {
  transition: none !important;
}

/* Dismissing animation */
.is-dismissing {
  transform: translateY(100%) !important;
  opacity: 0 !important;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out !important;
}

/* Reset animation - snap back to open */
.is-resetting {
  transform: translateY(0) !important;
  opacity: 1 !important;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease-out !important;
}

/* Sheet handle styling for better affordance */
[data-sheet-handle] {
  position: relative;
  padding: 0.5rem 0;
  touch-action: none; /* Prevent browser gestures */
  user-select: none;
}

/* Visual feedback for handle interaction */
[data-sheet-handle]::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 0.5rem;
  background: transparent;
  transition: background-color 0.2s ease;
}

[data-sheet-handle]:active::before {
  background: rgba(0, 0, 0, 0.05);
}

/* Improve sheet content scrolling behavior */
[data-restaurant-details-target="sheetBody"],
[data-meal-coordination-target="searchResults"] {
  /* Momentum scrolling on iOS */
  -webkit-overflow-scrolling: touch;
  /* Contain overscroll within element */
  overscroll-behavior: contain;
}

/* Prevent body scroll when sheet is open (optional) */
body.sheet-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Smooth transitions for sheet open/close */
[data-restaurant-details-target="sheetContent"]:not(.is-dragging):not(.is-dismissing):not(.is-resetting) {
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Fix for iOS Safari - prevent rubber band scrolling */
@supports (-webkit-touch-callout: none) {
  [data-restaurant-details-target="bottomSheet"],
  [data-meal-coordination-target="addRestaurantSheet"] {
    /* Prevent iOS bounce scrolling on the container */
    position: fixed;
    overflow: hidden;
  }
}

/* Accessibility: Ensure handle is keyboard accessible */
[data-sheet-handle]:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
  border-radius: 0.5rem;
}

/* Dark mode support (if applicable) */
@media (prefers-color-scheme: dark) {
  [data-sheet-handle]:active::before {
    background: rgba(255, 255, 255, 0.1);
  }
}