/* ===== IMPROVED DRAG AND DROP STYLES V2 ===== */

/* Dragging state */
.activity.dragging {
  opacity: 0.5;
  transform: scale(0.98);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Drag over indicator */
.activity.drag-over {
  border: 2px solid #43b0b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(67, 176, 179, 0.3);
}

.activities-list.drag-over {
  background: rgba(67, 176, 179, 0.1);
  border: 2px dashed #43b0b3;
  border-radius: 8px;
}

/* Activity cursor - show it's draggable */
.activity[draggable="true"] {
  cursor: move;
  transition: all 0.2s ease;
  position: relative;
}

.activity[draggable="true"]::before {
  content: '⋮⋮';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  color: #94a3b8;
  font-size: 0.9rem;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.activity[draggable="true"]:hover::before {
  opacity: 0.6;
}

/* Make room for the drag indicator */
.activity[draggable="true"] h3 {
  padding-left: 20px;
}

/* Empty day placeholder */
.empty-day-placeholder {
  background: #f8f9fa !important;
  border: 2px dashed #cbd5e1 !important;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  color: #64748b;
  font-style: italic;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default !important;
  user-select: none;
}

.empty-day-placeholder::before {
  display: none !important;
}

.empty-day-placeholder p {
  margin: 0;
  font-size: 0.95rem;
}

/* Drop zone highlighting for empty activities lists */
.activities-list {
  min-height: 60px;
  transition: background 0.2s ease;
}

/* Save indicator */
#save-indicator {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 999;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ===== DAY REORDER BUTTONS ===== */

.day-reorder-buttons {
  display: inline-flex;
  gap: 6px;
  margin-left: 12px;
  vertical-align: middle;
}

.day-reorder-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, #43b0b3, #5fc4c7);
  color: white;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(67, 176, 179, 0.2);
  padding: 0;
  line-height: 1;
}

.day-reorder-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #3a9a9d, #4fb3b6);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(67, 176, 179, 0.3);
}

.day-reorder-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(67, 176, 179, 0.2);
}

.day-reorder-btn:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.5;
}

/* Specific button styles */
.day-up-btn {
  /* Arrow up styling */
}

.day-down-btn {
  /* Arrow down styling */
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .day-reorder-buttons {
    margin-left: 8px;
    gap: 4px;
  }
  
  .day-reorder-btn {
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
  }
  
  .activity[draggable="true"]::before {
    font-size: 0.8rem;
    left: 6px;
  }
  
  #save-indicator {
    bottom: 70px;
    right: 16px;
    padding: 10px 16px;
    font-size: 0.85rem;
  }
  
  .empty-day-placeholder {
    padding: 1.5rem 1rem;
    min-height: 60px;
  }
  
  .empty-day-placeholder p {
    font-size: 0.85rem;
  }
}

/* Touch feedback for mobile */
@media (hover: none) and (pointer: coarse) {
  .activity[draggable="true"]:active {
    background: rgba(67, 176, 179, 0.1);
  }
  
  .activity.dragging {
    opacity: 0.6;
  }
  
  .day-reorder-btn:active:not(:disabled) {
    background: linear-gradient(135deg, #2e8386, #3f9c9f);
  }
}

/* Prevent text selection during drag */
.activity.dragging *,
.activity.dragging {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Animation for save indicator */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#save-indicator {
  animation: slideInRight 0.3s ease;
}

/* Ensure day cards have proper spacing */
.day-card {
  margin-bottom: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.day-card h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

/* Improve touch target sizes for mobile */
@media (max-width: 768px) {
  .activity[draggable="true"] {
    padding: 1rem;
    margin-bottom: 0.8rem;
  }
  
  .day-card h2 {
    padding: 1rem;
    min-height: 48px;
  }
}

/* Accessibility - focus states */
.activity[draggable="true"]:focus-visible {
  outline: 3px solid #43b0b3;
  outline-offset: 2px;
}

.day-reorder-btn:focus-visible {
  outline: 3px solid #43b0b3;
  outline-offset: 2px;
}

/* Ensure edit forms are never draggable */
.new-activity-form,
.edit-activity-form {
  cursor: default !important;
  user-select: auto !important;
}

.new-activity-form::before,
.edit-activity-form::before {
  display: none !important;
}

.new-activity-form[draggable],
.edit-activity-form[draggable] {
  cursor: default !important;
}

/* Make sure buttons and inputs in activities are clickable */
.activity button,
.activity input,
.activity textarea {
  cursor: pointer;
  user-select: auto;
  pointer-events: auto;
}

.activity input,
.activity textarea {
  cursor: text;
}

/* Loading state during drag */
body.is-reordering {
  cursor: move;
}

/* Prevent drag handles from interfering with edit buttons */
.activity .edit-btn,
.activity .delete-btn {
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

/* Day header layout */
.day-card h2 {
  position: relative;
}

.day-card h2 .day-label {
  flex: 0 0 auto;
}

.day-card h2 .delete-day-btn {
  margin-left: auto;
}

.day-card h2 .day-reorder-buttons {
  order: -1; /* Put reorder buttons before the day label */
  margin-left: 0;
  margin-right: 12px;
}

/* Better spacing for day header items */
@media (max-width: 768px) {
  .day-card h2 {
    gap: 8px;
  }
}

/* Smooth transitions for day movements */
.day-card {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Visual feedback when day is being reordered */
.day-card.reordering {
  opacity: 0.7;
  transform: scale(0.98);
}