/* Drag and Drop Styles for Book Sections */

/* Sortable ghost element */
.sortable-ghost {
  opacity: 0.4;
  background: #f3f4f6;
  border: 2px dashed #d1d5db;
}

/* Element being dragged */
.sortable-chosen {
  cursor: grabbing;
}

/* Active sorting state */
.sorting-active {
  cursor: grabbing;
}

.sorting-active * {
  cursor: grabbing !important;
}

/* Dragging element */
.dragging {
  transform: rotate(5deg);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  opacity: 0.9;
}

/* Fallback for browsers that don't support touch */
.sortable-fallback {
  display: none;
}

/* Drag handle */
.drag-handle {
  transition: all 0.2s ease;
}

.drag-handle:hover {
  background-color: #e5e7eb;
}

.drag-handle:active {
  background-color: #d1d5db;
}

/* Section node styling during drag */
.section-node {
  transition: all 0.2s ease;
  border-radius: 0.375rem;
  margin: 1px 0;
}

.section-node:hover {
  background-color: #f9fafb;
}

.section-node.dragging {
  background-color: #fef3c7;
  border: 1px solid #f59e0b;
}

/* Drop zone highlighting for sections that can accept children */
.drop-zone-highlight {
  background-color: #dbeafe !important;
  border: 2px dashed #3b82f6 !important;
  border-radius: 0.5rem;
}

/* Nesting target highlighting */
.nesting-target {
  position: relative;
  border: 2px dashed transparent !important;
  transition: all 0.2s ease;
}

.sorting-active .nesting-target {
  border-color: #3b82f6 !important;
  background-color: #eff6ff !important;
}

/* Nesting drop zone overlay */
.nesting-drop-zone {
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  background: rgba(59, 130, 246, 0.15);
  border: 2px dashed #3b82f6;
  border-radius: 0.5rem;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 1;
  transition: all 0.2s ease;
  cursor: pointer;
}

.nesting-drop-zone:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #1d4ed8;
  transform: scale(1.02);
}

.nesting-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #3b82f6;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  pointer-events: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.nesting-indicator svg {
  width: 1rem;
  height: 1rem;
}

/* Show nesting zones only when dragging */
.sorting-active .nesting-drop-zone {
  display: flex;
}

.drop-zone-highlight .children-container {
  background-color: #eff6ff;
  border-radius: 0.375rem;
  min-height: 40px;
  border: 1px dashed #93c5fd;
}

/* Parent section drop zones */
.section-node[data-has_children="true"] {
  border-left: 3px solid transparent;
}

.section-node[data-has_children="true"]:hover {
  border-left-color: #6b7280;
}

/* Depth indicators */
.section-node.depth-0 {
  border-left: 3px solid #84cc16;
}

.section-node.depth-1 {
  border-left: 3px solid #06b6d4;
}

.section-node.depth-2 {
  border-left: 3px solid #8b5cf6;
}

.section-node.depth-3 {
  border-left: 3px solid #f97316;
}

/* Children container styling */
.children-container {
  min-height: 20px;
  transition: all 0.2s ease;
}

/* Nested sortable areas */
.children-container[data-controller*="section-sortable"] {
  min-height: 30px;
  padding: 4px;
}