/* Shake animation for errors */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
  20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.shake {
  animation: shake 0.5s ease-in-out;
}

/* Smooth transitions for step states */
.step-content-wrapper {
  transition: all 0.2s ease-in-out;
}

.step-content-wrapper.step-state-active {
  position: relative;
  padding-left: 1rem;
}

.step-content-wrapper.step-state-completed {
  opacity: 0.6;
}

.step-content-wrapper.step-state-recovery {
  font-style: italic;
}

/* Edit mode enhancements */
.step-content-edit textarea {
  scrollbar-width: thin;
  scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
}

.step-content-edit textarea::-webkit-scrollbar {
  width: 6px;
}

.step-content-edit textarea::-webkit-scrollbar-track {
  background: transparent;
}

.step-content-edit textarea::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.5);
  border-radius: 3px;
}

.step-content-edit textarea::-webkit-scrollbar-thumb:hover {
  background-color: rgba(156, 163, 175, 0.7);
}

/* Tooltip styles */
.step-content-tooltip {
  animation: fadeIn 0.2s ease-in-out;
  word-wrap: break-word;
  max-width: 20rem;
  z-index: 9999;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Focus ring enhancements */
.step-content-view:focus-within {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Hover effects */
.step-content-view.cursor-pointer:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.dark .step-content-view.cursor-pointer:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Active step trail marker */
.step-state-active::before {
  content: '';
  position: absolute;
  left: -0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
  50% { opacity: 0.7; transform: translateY(-50%) scale(1.2); }
}

/* Loading states */
.step-content-saving {
  position: relative;
  pointer-events: none;
}

.step-content-saving::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(1px);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Character count styling */
.char-count-warning {
  color: #f59e0b;
}

.char-count-danger {
  color: #ef4444;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .step-content-edit textarea {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .step-content-wrapper {
    padding: 0.5rem;
  }
}

/* Print styles */
@media print {
  .step-content-view .edit-indicator {
    display: none !important;
  }

  .step-state-completed {
    text-decoration: line-through;
  }

  .keyboard-hints {
    display: none !important;
  }
}