/**
 * HealthWave – Drag-and-Drop Styles
 * 
 */

/* ── Draggable grid container ── */
.phc-grid--draggable {
  position: relative;
}

/* ── Card being dragged — ghost effect ── */
.phc-dragging {
  opacity: 0.45;
  cursor: grabbing !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2) !important;
  transform: scale(1.03) !important;
  transition: none !important;
  z-index: 100;
  outline: 2.5px dashed var(--color-primary, #ff915a);
  outline-offset: 3px;
}

/* ── Drop target highlight ── */
.phc-drag-over {
  outline: 2.5px solid var(--color-primary, #ff915a);
  outline-offset: 3px;
  background: rgba(255, 145, 90, 0.06);
  transition: outline 0.12s ease, background 0.12s ease;
}

/* ── Drag handle ── */
.phc-drag-handle {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  cursor: grab;
  color: #9ca3af;
  opacity: 0.35; /* Subtle static indicator — users know cards are draggable before hover */
  transition: opacity 0.18s ease, color 0.18s ease, background 0.18s ease;
  z-index: 10;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Show handle on card hover or focus */
.phc-grid-item:hover        .phc-drag-handle,
.phc-draggable-item:hover   .phc-drag-handle,
.phc-drag-handle:focus {
  opacity: 1;
  color: var(--color-primary, #ff915a);
}

.phc-drag-handle:hover {
  background: #fff;
  color: var(--color-primary, #ff915a);
  cursor: grab;
}

.phc-drag-handle:active,
.phc-dragging .phc-drag-handle {
  cursor: grabbing;
  background: var(--color-primary, #ff915a);
  color: #fff;
  opacity: 1;
}

/* Keyboard focus ring on handle */
.phc-drag-handle:focus {
  outline: 2px solid var(--color-primary, #ff915a);
  outline-offset: 2px;
}

/* Cards need position:relative so the handle positions correctly */
.phc-grid--draggable .phc-grid-item,
.phc-grid--draggable .phc-draggable-item {
  position: relative;
}

/* Smooth reflow animation when cards shift positions */
.phc-grid--draggable .phc-grid-item,
.phc-grid--draggable .phc-draggable-item {
  transition: transform 0.18s ease;
}

/* Grab cursor on card hover (signals draggability) */
.phc-grid--draggable .phc-grid-item:not(.phc-dragging),
.phc-grid--draggable .phc-draggable-item:not(.phc-dragging) {
  cursor: default;
}

/* ── Keyboard reorder hint (shows when a handle is focused) ── */
.phc-drag-handle:focus::after {
  content: 'Use arrows to reorder';
  position: absolute;
  top: 110%;
  right: 0;
  background: #1f2937;
  color: #fff;
  font-size: 0.72rem;
  white-space: nowrap;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  pointer-events: none;
  z-index: 20;
}

/* Hide hint if user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  .phc-dragging,
  .phc-drag-over,
  .phc-drag-handle,
  .phc-grid--draggable .phc-grid-item,
  .phc-grid--draggable .phc-draggable-item {
    transition: none !important;
    transform: none !important;
  }
}
