/* Enhanced animations and editing features */
@keyframes bounce-in {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse-green {
  0%, 100% { background-color: transparent; }
  50% { background-color: rgba(34, 197, 94, 0.2); }
}

@keyframes slide-in-right {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-bounce-in {
  animation: bounce-in 0.3s ease-out;
}

.animate-slide-up {
  animation: slide-up 0.4s ease-out;
}

.animate-pulse-green {
  animation: pulse-green 0.5s ease-in-out;
}

.animate-slide-in-right {
  animation: slide-in-right 0.3s ease-out;
}

.animate-fade-in {
  animation: fade-in 0.2s ease-out;
}

/* Enhanced transitions for all interactive elements */
button, input, select, textarea {
  transition: all 0.2s ease-in-out;
}

/* Inline editing enhancements */
.inline-edit-field {
  position: relative;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.inline-edit-field:hover {
  background-color: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.inline-edit-field.editing {
  background-color: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

/* Enhanced edit mode indicators */
.edit-mode-active {
  cursor: pointer;
  position: relative;
}

.edit-mode-active::after {
  content: '✏️';
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.edit-mode-active:hover::after {
  opacity: 1;
}

/* Bulk selection highlights */
.bulk-selected {
  background-color: rgba(59, 130, 246, 0.1);
  border-left: 4px solid #3B82F6;
}

/* Enhanced sidebar styling */
.edit-sidebar {
  animation: slide-in-right 0.3s ease-out;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
}

/* Custom scrollbar for edit areas */
.edit-scrollbar::-webkit-scrollbar {
  width: 6px;
}

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

.edit-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.edit-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Enhanced focus states for accessibility */
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Edit history timeline styling */
.edit-history-timeline {
  position: relative;
}

.edit-history-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #3B82F6, #10B981);
}

.edit-history-item {
  position: relative;
  padding-left: 24px;
}

.edit-history-item::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  width: 8px;
  height: 8px;
  background: #3B82F6;
  border-radius: 50%;
  border: 2px solid white;
}

/* Undo/Redo button styling */
.undo-redo-button {
  position: relative;
  overflow: hidden;
}

.undo-redo-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.undo-redo-button:hover::before {
  left: 100%;
}

/* Enhanced table hover effects */
tr:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Status badge enhancements */
.status-badge {
  transition: all 0.2s ease-in-out;
  position: relative;
}

.status-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Auto-save indicator */
.auto-save-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #10B981;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  transform: translateY(-100px);
  opacity: 0;
  transition: all 0.3s ease;
}

.auto-save-indicator.show {
  transform: translateY(0);
  opacity: 1;
}

/* Enhanced form validation styles */
input:invalid:not(:placeholder-shown) {
  border-color: #EF4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

input:valid:not(:placeholder-shown) {
  border-color: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Quick action buttons */
.quick-action-btn {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.15s ease;
  border: 1px solid;
}

.quick-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dark mode specific enhancements */
.dark .edit-mode-active:hover {
  background-color: rgba(59, 130, 246, 0.1);
}

.dark .auto-save-indicator {
  background: #374151;
  border: 1px solid #4B5563;
}

/* Mobile responsiveness for editing */
@media (max-width: 768px) {
  .edit-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 50;
    overflow-y: auto;
  }
  
  .table-container {
    font-size: 0.875rem;
  }
  
  .table-container th,
  .table-container td {
    padding: 0.5rem;
  }
  
  .bulk-edit-controls {
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* Keyboard navigation highlights */
.keyboard-focus {
  box-shadow: 0 0 0 2px #3B82F6, 0 0 0 4px rgba(59, 130, 246, 0.2);
  border-radius: 4px;
}

/* Print optimizations for edit reports */
@media print {
  .no-print {
    display: none !important;
  }
  
  .edit-history-timeline::before {
    background: #000 !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .edit-sidebar {
    position: static !important;
    box-shadow: none !important;
  }
}

/* Loading states for async operations */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3B82F6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Enhanced tooltips for edit features */
.edit-tooltip {
  position: relative;
}

.edit-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.edit-tooltip:hover::after {
  opacity: 1;
}

/* Drag and drop styling for future enhancement */
.drag-over {
  background-color: rgba(59, 130, 246, 0.1);
  border: 2px dashed #3B82F6;
  border-radius: 8px;
}

.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}