/* Enhanced Loading Styles for Forms */

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-radius: 50%;
  border-top: 2px solid #d2e8e3;
  animation: spin 1s linear infinite;
}

/* Larger spinner for overlays */
.loading-spinner.large {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

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

/* Form Submission States */
.submitting {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.submitting::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.3);
  z-index: 1;
  border-radius: 8px;
}

/* Button Loading States */
button[type="submit"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

button[type="submit"]:disabled .loading-spinner {
  margin-right: 8px;
}

/* Progress Indicators */
.upload-progress {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
  animation: fadeIn 0.3s ease-in;
}

.progress-container {
  width: 100%;
  height: 8px;
  background-color: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #d2e8e3 0%, #a7d4c1 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
  animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

.loading-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  max-width: 300px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.loading-text {
  margin-top: 1rem;
  color: #374151;
  font-weight: 500;
}

/* Field Validation States */
.field-error {
  color: #dc2626;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: block;
  animation: fadeIn 0.2s ease-in;
}

input.border-red-500,
select.border-red-500,
textarea.border-red-500 {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 1px #dc2626 !important;
}

/* Message Styles */
.form-message {
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Auto-save Indicator */
.auto-save-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #10b981;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1000;
}

/* Connection Status */
.connection-warning {
  animation: slideDown 0.3s ease-out;
}

/* File Info Display */
.file-info {
  color: #6b7280;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  padding: 4px 8px;
  background: #f9fafb;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
}

/* Enhanced Input Focus States */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #d2e8e3 !important;
  box-shadow: 0 0 0 3px rgba(210, 232, 227, 0.1) !important;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* Form Enhancement Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Responsive Loading States */
@media (max-width: 640px) {
  .loading-content {
    margin: 1rem;
    padding: 1.5rem;
  }
  
  .auto-save-indicator {
    bottom: 10px;
    right: 10px;
    font-size: 0.7rem;
    padding: 6px 10px;
  }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  .loading-spinner,
  .progress-bar,
  .form-message,
  .connection-warning {
    animation: none;
  }
  
  .loading-overlay {
    transition: none;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .loading-content {
    background: #1f2937;
    color: #f9fafb;
  }
  
  .loading-text {
    color: #d1d5db;
  }
  
  .file-info {
    background: #374151;
    color: #d1d5db;
    border-color: #4b5563;
  }
} 