/**
 * SEOFlood File Upload - Styles Dropzone Améliorés
 * 
 * Styles pour les cartes de fichiers, previews et animations
 */

/* Container principal */
.seoflood-dropzone-container {
  margin: 15px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
}

/* Zone de drop Dropzone */
.seoflood-dropzone-container .dropzone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  background: #f9fafb;
  transition: all 0.3s ease;
  min-height: 120px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  position: relative;
}

.seoflood-dropzone-container .dropzone:hover,
.seoflood-dropzone-container .dropzone.dz-drag-hover {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.seoflood-dropzone-container .dropzone.dz-drag-hover {
  border-color: #1d4ed8;
  background: #dbeafe;
  border-style: solid;
}

/* Message par défaut */
.seoflood-dropzone-container .dz-default.dz-message {
  margin: 0;
  color: #6b7280;
  display: flex;
  flex-direction: column;
  align-content: center;
  align-items: center;
  justify-content: center;
}
.seoflood-dropzone-container .dz-default.dz-message .limits-info {
  font-style: italic;
}

.seoflood-dropzone-container .upload-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.7;
  filter: grayscale(1);
  transition: all 0.2s ease 0s;
}
.seoflood-dropzone-container:hover {
  cursor: pointer;
}
.seoflood-dropzone-container:hover .upload-icon {
  filter: grayscale(0);
}

.seoflood-dropzone-container .dz-message h3 {
  color: #374151;
  font-size: 2rem;
  font-weight: 600;
}

.seoflood-dropzone-container .dz-message p {
  margin: 4px 0 8px 0;
  color: #6b7280;
  font-size: 1.25rem;
}

.seoflood-dropzone-container .help-text {
  color: #9ca3af;
  font-size: 1.25rem;
  display: block;
  margin-top: 8px;
  margin-bottom: 8px;
}

.seoflood-dropzone-container .dropzone-wrapper {
  border: dotted 2px #00000033;
  border-radius: 1em;
  padding: 1em 1em 0em 1em;
  display: flex;
  justify-content: center;
  background: #00000005;
  transform: scale(1, 1);
  transition: none 0.2s ease 0s;
  transition-property: background, transform;
}
.seoflood-dropzone-container .dropzone-wrapper:hover,
.seoflood-dropzone-container .dropzone-wrapper.dz-drag-hover {
  background: #94e06e14;
  transform: scale(1.025, 1.025);
}

/* Container des fichiers en preview */
.files-preview-container {
  margin-top: 20px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.files-preview-container h4 {
  margin: 0 0 15px 0;
  color: #eeeeee;
  font-size: 1.75rem;
  font-weight: 600;
}

/* Grid des cartes de fichiers */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

/* Cartes de fichiers */
.file-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  position: relative;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  animation: slideInUp 0.3s ease;
}

.file-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: #cbd5e1;
}

.file-card.upload-success {
  border-color: #10b981;
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
}

.file-card.upload-error {
  border-color: #ef4444;
  background: linear-gradient(135deg, #fef2f2 0%, #fef2f2 100%);
}

/* Preview du fichier */
.file-preview {
  width: 100%;
  height: 120px;
  background: #f1f5f9;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  overflow: hidden;
  position: relative;
}

.file-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.file-preview-placeholder,
.file-icon-large {
  font-size: 2.5rem;
  opacity: 0.6;
  color: #64748b;
}

/* Informations du fichier */
.file-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-direction: column;
}

.file-name {
  font-weight: 600;
  color: #1e293b;
  font-size: 0.9rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.file-size {
  color: #64748b;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

/* Barre de progression */
.file-progress {
  margin-bottom: 8px;
}

.progress-bar {
  background: #e2e8f0;
  border-radius: 8px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-fill {
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  height: 100%;
  border-radius: 8px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.progress-text {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

/* Statut du fichier */
.file-status {
  font-size: 0.8rem;
  font-weight: 500;
  color: #64748b;
}

.file-status.success {
  color: #10b981;
}

.file-status.error {
  color: #ef4444;
}

/* Bouton de suppression */
.file-remove {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 16px;
  line-height: 1;
}

.file-remove:hover {
  background: #ef4444;
  color: white;
  transform: scale(1.1);
}

.file-remove .remove-icon {
  font-weight: bold;
}

/* Résumé d'upload */
.upload-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding: 12px 16px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
}

.files-count {
  color: #374151;
  font-weight: 500;
}

.size-indicator {
  color: #9aa7b8;
}

.size-indicator .current {
  font-weight: 600;
  color: #f0f0f0;
}

/* Messages d'erreur */
.error-message {
  margin-top: 12px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Animations */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

.file-card.removing {
  animation: fadeOut 0.3s ease forwards;
}

/* État vide vs avec fichiers */
.seoflood-dropzone-container .dropzone:not(.dz-started) .dz-default {
  display: block;
}

.seoflood-dropzone-container .dropzone.dz-started .dz-default {
  display: none;
}

/* Responsive design */
@media (max-width: 768px) {
  .files-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .file-card {
    padding: 12px;
  }

  .file-preview {
    height: 100px;
  }

  .upload-summary {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .seoflood-dropzone-container .upload-icon {
    font-size: 2rem;
  }

  .seoflood-dropzone-container .dz-message h3 {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .files-preview-container {
    padding: 16px;
    margin-top: 16px;
  }

  .file-card {
    padding: 16px;
  }

  .seoflood-dropzone-container .dropzone {
    padding: 20px 15px;
    min-height: 100px;
  }
}

/* Mode sombre (si applicable) */
@media (prefers-color-scheme: dark) {
  .seoflood-dropzone-container .dropzone {
    background: #1f2937;
    border-color: #374151;
  }

  .seoflood-dropzone-container .dropzone:hover {
    background: #111827;
    border-color: #60a5fa;
  }

  .files-preview-container {
    background: #1f2937;
    border-color: #374151;
  }

  .file-card {
    background: #1f2937;
    border-color: #374151;
  }

  .file-preview {
    background: #374151;
  }

  .file-name {
    color: #f9fafb;
  }

  .upload-summary {
    background: #1f2937;
    border-color: #374151;
  }

  .files-count {
    color: #f9fafb;
  }
}

/* Intégration avec les formulaires SEOFlood */
.form-row .seoflood-dropzone-container {
  margin: 5px 0 15px 0;
}

.form-row label + .seoflood-dropzone-container {
  margin-top: 8px;
}

/* États spéciaux */
.file-card.processing {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.file-card.processing .progress-fill {
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

/* Amélioration de l'accessibilité */
.file-remove:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.seoflood-dropzone-container .dropzone:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Styles pour l'impression */
@media print {
  .file-remove,
  .error-message {
    display: none !important;
  }

  .file-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
  }
}
