/**
 * Queue Status Widget - Version Professionnelle Minimaliste
 * Petit badge en bas à droite qui s'ouvre en popup au clic
 */

/* Badge compact (état fermé) */
.queue-widget {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 9998;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Badge rond - Style professionnel compact */
.queue-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 18px;
  font-weight: 400;
  transition: all 0.2s ease;
  user-select: none;
  border: 2px solid rgba(255, 255, 255, 0.2);
  position: relative;
}

.queue-badge:hover {
  background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
  box-shadow: 0 5px 16px rgba(102, 126, 234, 0.4);
  transform: scale(1.08);
}

.queue-badge-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

/* Icône spinner pour "en cours" */
.queue-badge-icon.spinning::before {
  content: '⟳';
  display: inline-block;
  animation: spin 1.5s linear infinite;
  font-size: 24px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.queue-badge-count {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 5px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  line-height: 1;
}

/* Badge texte pour mode inactif */
.queue-badge > span:only-child {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.queue-badge-close {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  border: 2px solid white;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.queue-badge-close:hover {
  background: #dc2626;
  transform: scale(1.1);
}

/* Panel détaillé (état ouvert) */
.queue-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 360px;
  max-height: 480px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border: 1px solid #e5e7eb;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s ease;
}

.queue-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* Header du panel */
.queue-panel-header {
  background: #f9fafb;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.queue-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}

.queue-panel-close {
  background: transparent;
  border: none;
  color: #6b7280;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.queue-panel-close:hover {
  background: #f3f4f6;
  color: #111827;
}

/* Body du panel */
.queue-panel-body {
  max-height: 360px;
  overflow-y: auto;
}

/* Sections */
.queue-section {
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
}

.queue-section:last-of-type {
  border-bottom: none;
}

.queue-section-title {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Jobs */
.queue-job {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 6px;
  transition: all 0.2s;
  background: white;
  border: 1px solid #e5e7eb;
}

.queue-job:last-child {
  margin-bottom: 0;
}

.queue-job.processing {
  background: #eff6ff;
  border-color: #93c5fd;
}

.queue-job.queued {
  background: #fffbeb;
  border-color: #fcd34d;
}

.queue-job:hover {
  transform: translateX(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.queue-job-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.queue-job-icon {
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.8;
}

.queue-job-title {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.queue-job-type {
  font-size: 11px;
  color: #6b7280;
  font-weight: 400;
  margin-left: 4px;
}

/* Progress spinner */
.queue-job-progress {
  display: flex;
  align-items: center;
}

.progress-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #dbeafe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Cancel button */
.queue-job-cancel {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  opacity: 0.6;
  flex-shrink: 0;
}

.queue-job-cancel:hover {
  opacity: 1;
  background: #fee2e2;
}

/* Footer stats */
.queue-panel-footer {
  display: flex;
  justify-content: space-around;
  padding: 12px 16px;
  background: #f9fafb;
  font-size: 12px;
  border-top: 1px solid #e5e7eb;
}

.queue-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: #6b7280;
}

.queue-stat.success {
  color: #059669;
}

.queue-stat.error {
  color: #dc2626;
}

.queue-stat-value {
  font-weight: 600;
}

/* Message vide */
.queue-empty {
  padding: 40px 20px;
  text-align: center;
  color: #9ca3af;
}

.queue-empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.3;
}

.queue-empty-text {
  font-size: 13px;
  font-weight: 500;
}

/* Scrollbar */
.queue-panel-body::-webkit-scrollbar {
  width: 5px;
}

.queue-panel-body::-webkit-scrollbar-track {
  background: transparent;
}

.queue-panel-body::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 3px;
}

.queue-panel-body::-webkit-scrollbar-thumb:hover {
  background: #d1d5db;
}

/* Animation d'entrée */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.queue-job {
  animation: slideInUp 0.2s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
  .queue-panel {
    width: calc(100vw - 40px);
    max-width: 360px;
  }
}

/* État caché */
.queue-widget.hidden {
  display: none;
}
