/* ============================================
   FILE UPLOAD SYSTEM - Modern Drag & Drop
   ============================================ */

/* Upload Zone - Drag & Drop Area */
.upload-zone {
  position: relative;
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, #fafafa 0%, #f9fafb 100%);
  cursor: pointer;
  overflow: hidden;
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.upload-zone:hover::before,
.upload-zone.drag-over::before {
  opacity: 1;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: #ec4899;
  background: linear-gradient(135deg, #fdf2f8 0%, #faf5ff 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(236, 72, 153, 0.15);
}

.upload-zone.drag-over {
  border-style: solid;
  border-width: 3px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: translateY(-2px) scale(1); }
  50% { transform: translateY(-2px) scale(1.02); }
}

/* Upload Label */
.upload-label {
  cursor: pointer;
  display: block;
  user-select: none;
  transition: all 0.3s;
}

.upload-zone:hover .upload-label {
  transform: scale(1.02);
}

/* Upload Icon */
.upload-icon {
  font-size: 3rem;
  color: #6b7280;  /* Changed from #9ca3af - WCAG AA compliant 4.54:1 */
  margin-bottom: 1rem;
  transition: all 0.3s;
  display: inline-block;
}

.upload-zone:hover .upload-icon {
  color: #ec4899;
  transform: scale(1.15) translateY(-4px);
}

.upload-zone.drag-over .upload-icon {
  animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
  0%, 100% { transform: scale(1.15) translateY(-4px); }
  50% { transform: scale(1.25) translateY(-12px); }
}

/* Upload Text */
.upload-text {
  margin-bottom: 0;
}

.upload-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
  transition: color 0.3s;
}

.upload-zone:hover .upload-title {
  color: #ec4899;
}

.upload-subtitle {
  font-size: 0.875rem;
  color: #4b5563;  /* Changed from #6b7280 - WCAG AA compliant 7.54:1 */
  margin-bottom: 0.75rem;
}

.upload-formats {
  font-size: 0.75rem;
  color: #4b5563;  /* Changed from #9ca3af - WCAG AA compliant 7.54:1 */
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Upload Preview */
.upload-preview {
  position: relative;
  max-width: 400px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: fadeInScale 0.4s ease-out;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.upload-preview img {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: cover;
  display: block;
  border-radius: 12px;
}

/* Remove Button */
.btn-remove-upload {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: 3px solid white;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  z-index: 10;
}

.btn-remove-upload:hover {
  transform: scale(1.1) rotate(90deg);
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.6);
}

.btn-remove-upload:active {
  transform: scale(0.95) rotate(90deg);
}

/* Progress Bar */
.upload-progress {
  margin-top: 1.5rem;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ec4899, #8b5cf6, #6366f1);
  background-size: 200% 100%;
  border-radius: 10px;
  transition: width 0.3s ease-out;
  animation: shimmer 2s linear infinite;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.progress-text {
  display: block;
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #4b5563;  /* Changed from #6b7280 - WCAG AA compliant 7.54:1 */
}

/* File Info Display (for non-image files) */
.file-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  transition: all 0.3s;
}

.file-info:hover {
  border-color: #ec4899;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.15);
}

.file-info i {
  font-size: 2.5rem;
  color: #ec4899;
}

.file-info .file-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.file-info .file-name {
  font-weight: 600;
  color: #111827;
  font-size: 0.95rem;
  word-break: break-word;
}

.file-info .file-size {
  font-size: 0.8rem;
  color: #4b5563;  /* Changed from #6b7280 - WCAG AA compliant 7.54:1 */
}

/* Multiple Upload Zone */
.multi-upload-zone {
  position: relative;
}

.uploaded-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.uploaded-file-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
  animation: fadeInScale 0.3s ease-out;
}

.uploaded-file-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.uploaded-file-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.uploaded-file-item .file-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  opacity: 0;
  transition: all 0.3s;
}

.uploaded-file-item:hover .file-remove {
  opacity: 1;
}

.uploaded-file-item .file-remove:hover {
  background: #dc2626;
  transform: scale(1.1) rotate(90deg);
}

/* Validation States */
.upload-zone.upload-error {
  border-color: #ef4444;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.upload-zone.upload-success {
  border-color: #10b981;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.upload-error-message {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #fef2f2;
  border-left: 4px solid #ef4444;
  border-radius: 8px;
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 500;
  animation: fadeIn 0.3s ease-out;
}

.upload-error-message i {
  color: #ef4444;
  font-size: 1.25rem;
}

.upload-success-message {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #ecfdf5;
  border-left: 4px solid #10b981;
  border-radius: 8px;
  color: #059669;
  font-size: 0.875rem;
  font-weight: 500;
  animation: fadeIn 0.3s ease-out;
}

.upload-success-message i {
  color: #10b981;
  font-size: 1.25rem;
}

/* Compact Upload Zone (for multiple file inputs) */
.upload-zone-compact {
  padding: 1rem;
  border-radius: 8px;
}

.upload-zone-compact .upload-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.upload-zone-compact .upload-title {
  font-size: 0.875rem;
}

.upload-zone-compact .upload-subtitle {
  font-size: 0.75rem;
}

/* Image Crop Tool Styles */
.crop-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.3s ease-out;
}

.crop-header {
  width: 100%;
  max-width: 800px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  color: white;
}

.crop-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.crop-canvas-wrapper {
  width: 100%;
  max-width: 800px;
  max-height: 500px;
  background: #1f2937;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.crop-controls {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.crop-controls button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.crop-controls .btn-crop-save {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.crop-controls .btn-crop-save:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.crop-controls .btn-crop-cancel {
  background: #374151;
  color: white;
}

.crop-controls .btn-crop-cancel:hover {
  background: #4b5563;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .upload-zone {
    padding: 1.5rem;
  }

  .upload-icon {
    font-size: 2.5rem;
  }

  .upload-title {
    font-size: 0.9rem;
  }

  .upload-subtitle {
    font-size: 0.8rem;
  }

  .upload-formats {
    font-size: 0.7rem;
  }

  .upload-preview {
    max-width: 100%;
  }

  .uploaded-files-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
  }

  .crop-container {
    padding: 1rem;
  }

  .crop-canvas-wrapper {
    max-height: 400px;
  }

  .crop-controls {
    flex-direction: column;
    width: 100%;
  }

  .crop-controls button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .upload-zone {
    padding: 1rem;
  }

  .upload-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
  }

  .upload-title {
    font-size: 0.85rem;
  }

  .upload-subtitle {
    font-size: 0.75rem;
  }

  .btn-remove-upload {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .uploaded-files-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
  }

  .uploaded-file-item img {
    height: 80px;
  }
}

/* Loading State */
.upload-zone.uploading {
  pointer-events: none;
  opacity: 0.7;
}

.upload-zone.uploading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 4px solid #e5e7eb;
  border-top-color: #ec4899;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Accessibility */
.upload-zone:focus-within {
  outline: 2px solid #ec4899;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
