/* 
 * Wishlist Drag and Drop Styles - Mobile Compatible
 */

/* Base drag handle styles */
.drag-handle {
  cursor: move;
  cursor: -webkit-grab;
  cursor: grab;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 100;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  padding: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  /* Mobile-specific touch properties */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

.drag-handle:hover {
  background-color: rgba(255, 255, 255, 1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  transform: scale(1.1);
}

.drag-handle:active {
  cursor: -webkit-grabbing;
  cursor: grabbing;
  transform: scale(0.95);
}

/* Touch-specific active state */
.drag-handle.touch-active {
  background-color: rgba(255, 255, 255, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: scale(1.15);
}

/* Dragging states */
.des-item.dragging {
  background-color: #f9f9f9;
  border: 1px dashed #ccc;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  opacity: 0.9;
  transform: rotate(2deg);
}

/* Mobile dragging enhancement */
.des-item.mobile-dragging {
  transform: scale(1.05) rotate(2deg);
  z-index: 1001;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* Hover state - only on non-touch devices */
.des-item.drag-hover {
  outline: 2px dashed rgba(106, 106, 142, 0.1);
  transition: outline 0.2s ease;
}

/* Touch active state for items */
.des-item.touch-active {
  background-color: rgba(106, 106, 142, 0.05);
  transition: background-color 0.1s ease;
}

/* Placeholder when dragging */
.drag-placeholder {
  border: 2px dashed #ccc;
  background-color: rgba(106, 106, 142, 0.05);
  border-radius: 5px;
  margin-bottom: 20px;
  visibility: visible !important;
  height: auto !important;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drag-placeholder::before {
  content: "Drop here";
  color: #999;
  font-size: 14px;
  font-style: italic;
}

/* Prevent text selection during drag */
body.is-dragging {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

body.is-dragging * {
  cursor: grabbing !important;
  cursor: -webkit-grabbing !important;
}

/* Status messages */
#wishlist-order-status {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  padding: 10px 20px;
  background-color: white;
  border-radius: 5px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  max-width: 300px;
  text-align: center;
}

.wishlist-order-success {
  color: #2e7d32;
  padding: 8px 12px;
  background-color: #e8f5e8;
  border: 1px solid #c8e6c9;
  border-radius: 4px;
}

.wishlist-order-error {
  color: #d32f2f;
  padding: 8px 12px;
  background-color: #ffebee;
  border: 1px solid #ffcdd2;
  border-radius: 4px;
}

.wishlist-order-warning {
  color: #f57c00;
  padding: 8px 12px;
  background-color: #fff3e0;
  border: 1px solid #ffcc02;
  border-radius: 4px;
}

.wishlist-order-loading {
  color: #6a6a8e;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #e3f2fd;
  border: 1px solid #bbdefb;
  border-radius: 4px;
}

.wishlist-order-loading:after {
  content: "";
  width: 20px;
  height: 20px;
  margin-left: 10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #6a6a8e;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  .drag-handle {
    display: none;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    /* Larger touch target for mobile */
    min-width: 44px;
    min-height: 44px;
    /* Adjust positioning to accommodate larger size */
    width: 36px;
    height: 36px;
  }

  .des-item {
    /* Add more spacing between items on mobile */
    margin-bottom: 12px;
    position: relative;
  }

  #wishlist-order-status {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  /* Larger placeholder on mobile */
  .drag-placeholder {
    min-height: 80px;
    margin-bottom: 15px;
  }
}

/* Touch-only devices (removes hover effects) */
@media (hover: none) and (pointer: coarse) {
  .drag-handle:hover {
    /* Remove hover effects on pure touch devices */
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transform: none;
  }

  .des-item.drag-hover {
    /* Remove hover effects on touch devices */
    outline: none;
  }

  /* Make clickable elements touch-friendly
  .des-item a,
  .des-item button {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  */
}

/* Accessibility focus styles */
.drag-handle:focus {
  outline: 2px solid #6a6a8e;
  outline-offset: 2px;
  background-color: rgba(255, 255, 255, 1);
}

.drag-handle:focus-visible {
  outline: 2px solid #6a6a8e;
  outline-offset: 2px;
}

/* Enhanced keyboard navigation feedback */
.drag-handle[tabindex]:focus {
  box-shadow: 0 0 0 3px rgba(106, 106, 142, 0.3);
}

/* Item transitions */
.des-item {
  transition: transform 0.2s ease, box-shadow 0.2s ease,
    background-color 0.2s ease;
  position: relative;
}

/* Sortable container */
.sortable-container {
  position: relative;
  min-height: 50px;
}

/* Disable pointer events on links during drag */
.des-item.dragging a,
.des-item.dragging button {
  pointer-events: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .drag-handle {
    border: 2px solid;
    background-color: white;
  }

  .drag-placeholder {
    border-width: 3px;
    background-color: white;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .drag-handle,
  .des-item,
  .wishlist-order-loading:after {
    transition: none;
    animation: none;
  }

  .des-item.dragging {
    transform: none;
  }

  .des-item.mobile-dragging {
    transform: none;
  }
}
