/* ================================================================= */
/* TABLEAU DE PRODUCTION COSMÉTIQUE - AFFICHAGE PARFAIT TOUS ÉCRANS */
/* Correction complète mobile/desktop sans débordement + FIXES INDUSTRIELS */
/* ================================================================= */

/* STYLES FIXES POUR AFFICHAGE INDUSTRIEL PROPRE */

/* ÉTAT DE LIGNE - STATUTS INDUSTRIELS CLAIRS */
.line-status-box {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* STATUTS AVEC COULEURS INDUSTRIELLES CORRECTES */
.status-optimal {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color: white;
  border-color: #059669;
}

.status-degraded {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: white;  
  border-color: #d97706;
}

.status-critical {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: white;
  border-color: #b91c1c;
}

.status-attention {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: white;
  border-color: #d97706;
}

/* ===================================================================== */
/* STYLES COMPTEURS TRS/TRG - AFFICHAGE PARFAIT MOBILE ET DESKTOP */
/* ===================================================================== */

/* Container des jauges */
.trs-gauge-container, .trg-gauge-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  height: 128px;
  margin: 0 auto;
}

/* SVG des jauges */
.trs-gauge, .trg-gauge {
  width: 128px;
  height: 128px;
  transform: rotate(0deg);
  transition: all 0.3s ease;
}

/* Cercles de progression */
.trs-progress, .trg-progress {
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 1.5s ease-out;
  transform-origin: center;
}

/* Aiguilles des compteurs */
.trs-needle, .trg-needle {
  transition: transform 1.5s ease-out;
  transform-origin: 64px 64px;
  stroke-width: 3px;
  stroke: #1f2937;
}

/* Labels de graduation */
.gauge-labels {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.gauge-label-0 {
  position: absolute;
  bottom: 20px;
  left: 8px;
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
}

.gauge-label-50 {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
}

.gauge-label-100 {
  position: absolute;
  bottom: 20px;
  right: 8px;
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
}

/* Animations des jauges */
.trs-gauge-container:hover,
.trg-gauge-container:hover {
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
  .trs-gauge-container, .trg-gauge-container {
    width: 100px;
    height: 100px;
  }
  
  .trs-gauge, .trg-gauge {
    width: 100px;
    height: 100px;
  }
  
  .gauge-label-0,
  .gauge-label-50,
  .gauge-label-100 {
    font-size: 9px;
  }
}

/* Couleurs spécifiques TRS */
.trs-progress {
  stroke: #3b82f6;
}

/* Couleurs spécifiques TRG */
.trg-progress {
  stroke: #10b981;
}

/* Animation de chargement */
@keyframes gaugeLoad {
  from {
    stroke-dashoffset: 314;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.gauge-loading .trs-progress,
.gauge-loading .trg-progress {
  animation: gaugeLoad 2s ease-out;
}

/* LABELS DE STATUT UNIFORMES */
.status-label-optimal {
  background: #10b981;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 10px;
  text-align: center;
  display: inline-block;
}

.status-label-degraded {
  background: #f59e0b;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 10px;
  text-align: center;
  display: inline-block;
}

.status-label-critical {
  background: #dc2626;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 10px;
  text-align: center;
  display: inline-block;
}

.status-label-attention {
  background: #f59e0b;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 10px;
  text-align: center;
  display: inline-block;
}

/* INDICATEURS EFFICACITÉ/QUALITÉ ALIGNÉS */
.efficiency-indicator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2px 0;
  font-size: 10px;
}

.efficiency-label {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.efficiency-value {
  font-weight: bold;
  font-size: 11px;
}

.efficiency-good { color: #22c55e; }
.efficiency-warning { color: #f59e0b; }
.efficiency-critical { color: #ef4444; }

/* ALERTES TEMPORELLES VISIBLES */
.time-alert {
  background: rgba(239, 68, 68, 0.9);
  color: white;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: bold;
  text-align: center;
  margin-top: 4px;
  border: 1px solid #dc2626;
  animation: pulse-alert 2s infinite;
}

@keyframes pulse-alert {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* INDICATEURS FONCTIONNELS POSITIONNÉS */
.functional-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 4px;
  padding: 2px 4px;
  background: rgba(34, 197, 94, 0.1);
  border-radius: 4px;
  font-size: 9px;
  color: #059669;
  font-weight: 600;
}

.functional-indicator i {
  font-size: 10px;
}

/* ALIGNEMENT COLONNES HEADERS */
.modern-production-table th {
  text-align: center !important;
  vertical-align: middle !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* CELLULES CORPS ALIGNÉES */
.modern-production-table td {
  text-align: center !important;
  vertical-align: middle !important;
  overflow: hidden;
}

/* 🆕 ANIMATION CLIGNOTEMENT LIGNE ENTIÈRE POUR ARRÊTS NON JUSTIFIÉS */
.row-blinking-unjustified {
  animation: row-blink-alert 600ms infinite;
}

@keyframes row-blink-alert {
  0%, 100% {
    background-color: #fef2f2;
    box-shadow: 0 0 0 2px #dc2626 inset;
  }
  50% {
    background-color: #fee2e2;
    box-shadow: 0 0 0 3px #ef4444 inset;
  }
}

/* TEMPS D'ARRÊT - AFFICHAGE PROPRE */
.downtime-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 35px;
  padding: 4px;
  border-radius: 4px;
}

.downtime-display.critical {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.downtime-display.warning {
  background: #fffbeb;
  color: #f59e0b;
  border: 1px solid #fed7aa;
}

.downtime-display.optimal {
  background: #f0fdf4;
  color: #22c55e;
  border: 1px solid #bbf7d0;
}

/* BOUTONS IA DANS TEMPS D'ARRÊT - DEPRECATED (Maintenant dans colonne IA) */
.ai-mandatory-btn {
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 10px;
  cursor: pointer;
  margin-left: 4px;
  transition: all 0.2s ease;
}

.ai-mandatory-btn:hover {
  background: #2563eb;
  transform: scale(1.05);
}

.ai-mandatory-btn.critical {
  background: #dc2626;
}

.ai-mandatory-btn.warning {
  background: #f59e0b;
}

/* ================================================================= */
/* NOUVELLE COLONNE IA DÉDIÉE */
/* ================================================================= */



.ai-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  margin: 0 auto;
}

.ai-btn:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.2);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ai-btn:hover:before {
  opacity: 1;
}

.ai-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* BOUTON IA OBLIGATOIRE - ROUGE */
.ai-btn.ai-mandatory {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  animation: ai-pulse-critical 2s infinite;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.4);
}

/* BOUTON IA RECOMMANDÉ - ORANGE */
.ai-btn.ai-recommended {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  animation: ai-pulse-warning 3s infinite;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

/* BOUTON IA DISPONIBLE - BLEU */
.ai-btn.ai-available {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  box-shadow: 0 0 4px rgba(59, 130, 246, 0.3);
}

@keyframes ai-pulse-critical {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0.7; }
}

@keyframes ai-pulse-warning {
  0%, 60%, 100% { opacity: 1; }
  30% { opacity: 0.8; }
}

/* ================================================================= */
/* SYSTÈME DE NOTIFICATIONS IA AUTOMATIQUES */
/* ================================================================= */

/* CONTENEUR NOTIFICATION IA */
.ai-notification-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* BADGE NOTIFICATION IA */
.ai-notification-badge {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 12px;
  transition: all 0.3s ease;
  overflow: hidden;
}

.ai-notification-badge:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* TYPES DE NOTIFICATIONS */
.ai-notification-critical {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  animation: ai-notification-pulse-critical 1s infinite;
}

.ai-notification-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  animation: ai-notification-pulse-warning 2s infinite;
}

.ai-notification-info {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

/* ICÔNE ET COMPTEUR */
.ai-icon {
  font-size: 16px;
  line-height: 1;
}

.ai-count {
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  margin-top: 1px;
}

/* EFFET PULSE POUR NOTIFICATIONS */
.ai-pulse {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.3);
  opacity: 0;
}

@keyframes ai-notification-pulse-critical {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0.6; }
}

@keyframes ai-notification-pulse-warning {
  0%, 70%, 100% { opacity: 1; }
  35% { opacity: 0.8; }
}

/* ALERTES TOAST IA */
.ai-alert-toast {
  position: relative;
  width: 100%;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border-left: 5px solid;
  transform: translateX(450px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
}

.ai-alert-toast.show {
  transform: translateX(0);
  opacity: 1;
}

.ai-alert-toast.fade-out {
  transform: translateX(450px);
  opacity: 0;
}

.ai-alert-toast.critical {
  border-left-color: #dc2626;
  animation: ai-alert-shake 0.5s ease-in-out;
}

.ai-alert-toast.high {
  border-left-color: #f59e0b;
}

.ai-alert-toast.medium {
  border-left-color: #3b82f6;
}

/* CONTENU ALERTE */
.ai-alert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  border-bottom: 1px solid #e5e7eb;
}

.ai-alert-icon {
  font-size: 18px;
  margin-right: 8px;
}

.ai-alert-title {
  font-weight: 600;
  font-size: 14px;
  color: #1f2937;
  flex: 1;
}

.ai-alert-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-alert-close:hover {
  color: #4b5563;
}

.ai-alert-content {
  padding: 12px 16px;
}

.ai-alert-summary {
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
}

.ai-alert-preview {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}

.ai-alert-actions {
  display: flex;
  gap: 8px;
  padding: 8px 16px 12px;
}

.ai-btn-primary, .ai-btn-secondary {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.ai-btn-primary {
  background: #3b82f6;
  color: white;
}

.ai-btn-primary:hover {
  background: #2563eb;
}

.ai-btn-secondary {
  background: #f3f4f6;
  color: #374151;
}

.ai-btn-secondary:hover {
  background: #e5e7eb;
}

/* 🆕 CONTENEUR SCROLLABLE NOTIFICATIONS IA */
.ai-notifications-stack {
  position: fixed;
  top: 80px;
  right: 20px;
  max-height: calc(100vh - 100px);
  width: 400px;
  max-width: calc(100vw - 40px);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 8px;
  
  /* Scrollbar personnalisée */
  scrollbar-width: thin;
  scrollbar-color: #d1d5db #f3f4f6;
}

.ai-notifications-stack::-webkit-scrollbar {
  width: 6px;
}

.ai-notifications-stack::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.ai-notifications-stack::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.ai-notifications-stack::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* 🆕 INDICE DE SWIPE */
.swipe-hint {
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  padding: 6px 0 4px;
  border-top: 1px solid #e5e7eb;
  user-select: none;
}

/* 🆕 CURSEUR POUR DRAG */
.ai-alert-toast {
  cursor: grab;
  user-select: none;
}

.ai-alert-toast:active {
  cursor: grabbing;
}

/* 📱 RESPONSIVE MOBILE - Notifications */
@media (max-width: 768px) {
  .ai-notifications-stack {
    top: 60px;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 80px);
    padding-right: 4px;
  }
  
  .swipe-hint {
    font-size: 10px;
    padding: 4px 0 2px;
  }
}

/* CARTES DE NOTIFICATIONS */
.ai-notification-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  background: white;
  transition: all 0.3s ease;
}

.ai-notification-card.critical {
  border-left: 4px solid #dc2626;
  background: linear-gradient(135deg, #fef2f2 0%, #fff 100%);
}

.ai-notification-card.high {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #fff 100%);
}

.ai-notification-card.medium {
  border-left: 4px solid #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #fff 100%);
}

.ai-notification-card.read {
  opacity: 0.7;
  background: #f9fafb;
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.notification-priority {
  font-weight: 600;
  font-size: 12px;
}

.notification-time {
  font-size: 11px;
  color: #6b7280;
}

.notification-title {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 8px;
}

.notification-content {
  color: #374151;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.action-list {
  margin: 8px 0;
  padding-left: 16px;
}

.action-list li {
  margin: 4px 0;
  color: #4b5563;
  font-size: 12px;
}

.notification-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 11px;
  color: #6b7280;
}

.estimated-time {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ANIMATIONS */
@keyframes ai-alert-shake {
  0%, 50%, 100% { transform: translateX(0); }
  10%, 30% { transform: translateX(-3px); }
  20%, 40% { transform: translateX(3px); }
}

/* ================================================================= */
/* CARTES DE SOLUTIONS CONTEXTUELLES */
/* ================================================================= */

.solution-card {
  transition: all 0.3s ease;
  border: 1px solid #e5e7eb;
}

.solution-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.solution-header h4 {
  color: #1f2937;
}

.solution-steps ol {
  background: #f8fafc;
  padding: 12px;
  border-radius: 6px;
  border-left: 3px solid #3b82f6;
}

.solution-steps li {
  padding: 2px 0;
  transition: background 0.2s ease;
}

.solution-steps li:hover {
  background: rgba(59, 130, 246, 0.1);
  padding-left: 4px;
}

.solution-tools span {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border: 1px solid #cbd5e1;
}

.solution-prevention {
  background: #fffbeb;
  padding: 8px;
  border-radius: 4px;
  border-left: 3px solid #f59e0b;
}

.solution-actions button {
  transition: all 0.2s ease;
  font-weight: 500;
}

.solution-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* TIMER NOTIFICATION */
@keyframes slideDown {
  from {
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.timer-notification {
  font-family: 'Courier New', monospace;
}

.timer-countdown {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 14px;
}

/* RESPONSIVE MOBILE */
@media (max-width: 768px) {
  .ai-alert-toast {
    width: calc(100vw - 16px);
    right: 8px;
    left: 8px;
    top: 60px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.3;
    transform: translateX(calc(100vw + 20px));
  }
  
  .ai-alert-toast.show {
    transform: translateX(0);
  }
  
  .ai-alert-toast.fade-out {
    transform: translateX(calc(100vw + 20px));
  }
  
  .ai-notification-badge {
    width: 32px;
    height: 32px;
  }
  
  .ai-icon {
    font-size: 14px;
  }
  
  .ai-count {
    font-size: 9px;
  }
  
  .solution-card {
    padding: 12px;
  }
  
  .solution-steps ol {
    padding: 8px;
  }
  
  .solution-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .solution-actions button {
    width: 100%;
  }
}

/* HINT DE SCROLL HORIZONTAL POUR UTILISATEURS */
.scroll-hint {
  position: absolute;
  bottom: 10px;
  right: 20px;
  background: rgba(59, 130, 246, 0.9);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  z-index: 10;
  animation: scroll-hint-pulse 2s infinite;
  pointer-events: none;
}

@keyframes scroll-hint-pulse {
  0%, 100% { opacity: 0.7; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(5px); }
}

.scroll-hint.hidden {
  display: none;
}

/* BOUTON FLOTTANT POUR SCROLL VERS COLONNE IA */
.scroll-to-ia {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 16px;
  cursor: pointer;
  z-index: 15;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.scroll-to-ia:hover {
  background: #2563eb;
  transform: scale(1.1);
}

.scroll-to-ia.hidden {
  display: none;
}

/* STYLES POUR MODALS IA SCROLLABLES */

/* Modal IA avec scroll optimisé */
#smartDiagnosticModal .flex-1 {
  /* Container principal scrollable */
  max-height: calc(85vh - 120px); /* Hauteur maximale moins header/footer */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Scroll fluide iOS */
}

/* Mode diagnostic rapide scrollable */
#quickMode {
  max-height: none;
  overflow-y: visible;
}

#quickDiagnosticContent {
  /* Contenu principal extensible */
  max-height: none;
  overflow: visible;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Mode chat avec scroll séparé */
#chatMessages {
  /* Zone de messages avec scroll indépendant */
  overflow-y: auto !important;
  max-height: 400px !important;
  min-height: 200px;
  -webkit-overflow-scrolling: touch;
}

#chatMessagesList {
  /* Liste des messages extensible */
  min-height: min-content;
  padding-bottom: 10px;
}

/* Boutons d'action fixes en bas */
.sticky.bottom-0 {
  /* S'assurer que les boutons restent visibles */
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid #e5e7eb;
  margin: 0 -24px -24px -24px;
  padding: 16px 24px;
}

/* Scrollbar personnalisée pour modals */
#smartDiagnosticModal .flex-1::-webkit-scrollbar,
#chatMessages::-webkit-scrollbar {
  width: 6px;
}

#smartDiagnosticModal .flex-1::-webkit-scrollbar-track,
#chatMessages::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

#smartDiagnosticModal .flex-1::-webkit-scrollbar-thumb,
#chatMessages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

#smartDiagnosticModal .flex-1::-webkit-scrollbar-thumb:hover,
#chatMessages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Espacement du contenu dans les modals */
#quickDiagnosticContent pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  margin-bottom: 1rem;
}

/* CORRECTION DÉBORDEMENTS MOBILES */
@media (max-width: 768px) {
  /* Ajustements mobile pour modals IA */
  #smartDiagnosticModal .bg-white {
    max-height: 90vh;
    margin: 5vh 10px;
  }
  
  #smartDiagnosticModal .flex-1 {
    max-height: calc(90vh - 140px);
  }
  
  #chatMessages {
    max-height: 300px !important;
    min-height: 150px;
  }
  
  #quickDiagnosticContent {
    font-size: 14px;
    line-height: 1.4;
  }
  .line-status-box {
    min-height: 50px;
    padding: 4px;
  }
  
  .efficiency-indicator {
    font-size: 9px;
  }
  
  .time-alert {
    font-size: 8px;
    padding: 2px 4px;
  }
  
  .functional-indicator {
    font-size: 8px;
    padding: 1px 2px;
  }
  
  /* Optimisations mobile pour scroll */
  .modern-production-table {
    min-width: 750px; /* Avec colonne État élargie sur mobile */
  }
  
  .scroll-hint {
    bottom: 80px; /* Évite les barres de navigation mobile */
    right: 10px;
    padding: 4px 8px;
    font-size: 10px;
  }
  
  .scroll-to-ia {
    bottom: 80px; /* Évite les barres de navigation mobile */
    right: 10px;
    width: 45px;
    height: 45px;
    font-size: 14px;
  }
}



/* RESET ET BASE */
* {
  box-sizing: border-box;
}

/* BANDEAU FIXE CORRIGÉ */
.fullscreen-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: white;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  border-bottom: 2px solid #60a5fa;
  height: 50px; /* Hauteur fixe réduite */
}

.fullscreen-header i {
  margin-right: 6px;
  color: #93c5fd;
}

/* CONTAINER PRINCIPAL OPTIMISÉ */
.modern-table-container {
  margin-top: 55px; /* Ajusté pour bandeau plus petit */
  padding: 16px 8px;
  min-height: calc(100vh - 55px);
  background: linear-gradient(145deg, #f8fafc 0%, #e2e8f0 100%);
  overflow-x: hidden; /* Empêche débordement horizontal */
}

/* WRAPPER TABLE RESPONSIVE AVEC SCROLL HORIZONTAL */
.modern-table-wrapper {
  width: 100%;
  max-width: 100vw; /* Ne jamais dépasser largeur écran */
  background: white;
  border-radius: 12px;
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden; /* Cache le débordement du container */
}

/* CONTENEUR DE SCROLL HORIZONTAL AVEC INDICATEURS VISUELS */
.table-scroll-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch; /* Scroll fluide iOS */
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
  position: relative;
}

/* INDICATEURS DE SCROLL - OMBRES LATÉRALES */
.table-scroll-container::before,
.table-scroll-container::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Ombre gauche (indique scroll vers la gauche) */
.table-scroll-container::before {
  left: 0;
  background: linear-gradient(90deg, rgba(0,0,0,0.1) 0%, transparent 100%);
  opacity: 0;
}

/* Ombre droite (indique scroll vers la droite) */
.table-scroll-container::after {
  right: 0;
  background: linear-gradient(270deg, rgba(0,0,0,0.1) 0%, transparent 100%);
  opacity: 1; /* Visible par défaut car il y a du contenu à droite */
}

/* États des indicateurs selon le scroll */
.table-scroll-container.can-scroll-left::before {
  opacity: 1;
}

.table-scroll-container.can-scroll-right::after {
  opacity: 1;
}

.table-scroll-container.scroll-end::after {
  opacity: 0;
}

/* SCROLLBAR PERSONNALISÉE WEBKIT */
.table-scroll-container::-webkit-scrollbar {
  height: 8px;
}

.table-scroll-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.table-scroll-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
  border: 2px solid #f1f5f9;
}

.table-scroll-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* CONTAINER SCROLL HORIZONTAL CONTRÔLÉ */
.table-scroll-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

/* TABLE PRINCIPALE AVEC LARGEUR MINIMALE POUR SCROLL */
.modern-production-table {
  width: 100%;
  min-width: 800px; /* LARGEUR MINIMALE avec colonne État élargie */
  border-collapse: separate;
  border-spacing: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  table-layout: fixed; /* Force respect largeurs colonnes */
  font-size: 11px; /* Réduction taille police globale */
  white-space: nowrap; /* Empêche retour à la ligne dans les cellules */
}

/* ============================================== */
/* HEADERS OPTIMISÉS */
/* ============================================== */

.modern-production-table thead th {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #475569;
  font-weight: 600;
  font-size: 12px;
  padding: 10px 8px; /* Padding réduit et harmonieux */
  text-align: center;
  vertical-align: middle;
  border-bottom: 2px solid #cbd5e1;
  border-right: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap; /* Empêche retour ligne */
  line-height: 1.2;
}

/* CELLULE HEURE MODERNE - COMPATIBLE AVEC CASES DYNAMIQUES */
.modern-hour-cell {
  text-align: center;
  vertical-align: middle;
  padding: 4px;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
}

/* Assurer l'alignement sur toutes les cellules */
.modern-production-table td {
  padding: 8px 6px;
  text-align: center;
  vertical-align: middle;
  border-right: 1px solid #e2e8f0;
  font-size: 11px;
}

.modern-production-table thead th:last-child {
  border-right: none;
}

.modern-production-table thead th i {
  margin-right: 4px;
  opacity: 0.8;
  font-size: 11px;
}

/* ============================================== */
/* CELLULES BODY OPTIMISÉES */
/* ============================================== */

.modern-production-table tbody td {
  padding: 8px; /* Espacement harmonieux demandé */
  text-align: center;
  vertical-align: middle;
  font-size: 13px;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f1f5f9;
  background: white;
  transition: all 0.2s ease;
  white-space: nowrap; /* Empêche débordement texte */
}

.modern-production-table tbody td:last-child {
  border-right: none;
}

/* HAUTEUR LIGNES RÉDUITE ET COMPACTE */
.modern-production-table tbody tr {
  height: 45px; /* Hauteur réduite comme demandé */
  transition: all 0.2s ease;
}

/* OMBRAGE SOUS CHAQUE LIGNE POUR SÉPARATION */
.modern-production-table tbody tr:hover {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08); /* Ombrage subtil */
  transform: translateY(-1px);
}

.modern-production-table tbody tr:not(:hover) {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); /* Ombrage permanent léger */
}

/* ============================================== */
/* LARGEURS COLONNES OPTIMISÉES POUR SCROLL HORIZONTAL */
/* ============================================== */

/* Largeurs optimales pour permettre scroll fluide */
.modern-production-table th:nth-child(1), 
.modern-production-table td:nth-child(1) { 
  width: 70px; /* Heure - légèrement plus large */
  min-width: 70px;
  max-width: 70px;
}

.modern-production-table th:nth-child(2), 
.modern-production-table td:nth-child(2) { 
  width: 80px; /* Équipe - plus confortable */
  min-width: 80px;
  max-width: 80px;
}

.modern-production-table th:nth-child(3), 
.modern-production-table td:nth-child(3) { 
  width: 70px; /* Qté Produite - plus compact */
  min-width: 70px;
  max-width: 70px;
}

.modern-production-table th:nth-child(4), 
.modern-production-table td:nth-child(4) { 
  width: 70px; /* Qté Conforme - plus compact */
  min-width: 70px;
  max-width: 70px;
}

.modern-production-table th:nth-child(5), 
.modern-production-table td:nth-child(5) { 
  width: 70px; /* Rebuts - plus visible */
  min-width: 70px;
  max-width: 70px;
}

.modern-production-table th:nth-child(6), 
.modern-production-table td:nth-child(6) { 
  width: 120px; /* Temps d'Arrêt - plus large pour IA */
  min-width: 120px;
  max-width: 120px;
}

.modern-production-table th:nth-child(7), 
.modern-production-table td:nth-child(7) { 
  width: 150px; /* Commentaire - plus lisible */
  min-width: 150px;
  max-width: 150px;
}

.modern-production-table th:nth-child(8), 
.modern-production-table td:nth-child(8) { 
  width: 180px; /* État Ligne - espace suffisant pour les badges */
  min-width: 180px;
  max-width: 180px;
}

.modern-production-table th:nth-child(9), 
.modern-production-table td:nth-child(9) { 
  width: 100px; /* Actions - boutons */
  min-width: 100px;
  max-width: 100px;
}

/* ============================================== */
/* CHAMPS DE SAISIE PARFAITEMENT CONTENUS */
/* ============================================== */

.modern-input, 
.production-input, 
.compliant-input {
  width: 100% !important; /* Remplit exactement la cellule */
  max-width: 100%;
  height: 30px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  background: white;
  color: #374151;
  transition: all 0.2s ease;
  padding: 0 4px;
  box-sizing: border-box;
}

.modern-input:focus,
.production-input:focus,
.compliant-input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
  outline: none;
}

/* COULEURS CONSERVÉES COMME DEMANDÉ */
.production-input {
  border-color: #93c5fd; /* Bleu équipe */
  color: #1d4ed8;
}

.production-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.compliant-input {
  border-color: #86efac; /* Vert conforme */
  color: #15803d;
}

.compliant-input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.comment-input {
  width: 100% !important;
  max-width: 100%;
  height: 30px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 11px;
  background: white;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.comment-input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
  outline: none;
}

/* ============================================== */
/* ÉLÉMENTS VISUELS COULEURS CONSERVÉES */
/* ============================================== */

.modern-hour-cell {
  font-weight: 600;
  color: #475569;
  font-size: 13px;
}

.modern-team-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
}

.modern-team-1 {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af; /* Bleu équipe conservé */
  border: 1px solid #93c5fd;
}

.modern-team-2 {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #047857; /* Vert équipe conservé */
  border: 1px solid #86efac;
}

.modern-rejects {
  font-weight: 600;
  color: #dc2626; /* Rouge rebuts conservé */
  padding: 2px 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
  display: inline-block;
}

/* ============================================== */
/* SYSTÈME PERFORMANCE AVEC COULEURS CONSERVÉES */
/* ============================================== */

.performance-excellent {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%) !important;
  border-left: 3px solid #10b981 !important;
}

.performance-good {
  background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%) !important;
  border-left: 3px solid #f97316 !important;
}

.performance-poor {
  background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%) !important;
  border-left: 3px solid #ef4444 !important;
}

.performance-neutral {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%) !important;
  border-left: 3px solid #9ca3af !important;
}

.break-time {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
  border-left: 3px solid #f59e0b !important;
}

.performance-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 4px;
}

.performance-badge.excellent {
  background: #10b981;
  color: white;
}

.performance-badge.good {
  background: #f97316;
  color: white;
}

.performance-badge.poor {
  background: #ef4444;
  color: white;
}

.performance-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  margin-left: 4px;
}

.performance-indicator.neutral {
  background: #9ca3af;
  color: white;
}

/* ============================================== */
/* BOUTONS ET ACTIONS */
/* ============================================== */

.save-btn, .chat-btn {
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}

.save-btn {
  color: #10b981;
  border-color: #86efac;
}

.save-btn:hover {
  background: #10b981;
  color: white;
  transform: scale(1.05);
}

.chat-btn {
  color: #3b82f6;
  border-color: #93c5fd;
}

.chat-btn:hover {
  background: #3b82f6;
  color: white;
  transform: scale(1.05);
}

/* ============================================== */
/* RESPONSIVE MOBILE PARFAIT */
/* ============================================== */

@media (max-width: 768px) {
  .fullscreen-header {
    font-size: 14px;
    padding: 8px 12px;
    height: 45px;
  }
  
  .modern-table-container {
    margin-top: 50px;
    padding: 12px 4px;
  }
  
  .modern-table-wrapper {
    border-radius: 8px;
    margin: 0;
  }
  
  /* COLONNES MOBILE ULTRA-COMPACTES - CACHE COLONNES NON ESSENTIELLES */
  .modern-production-table th:nth-child(5), /* Rebuts */
  .modern-production-table td:nth-child(5),
  .modern-production-table th:nth-child(7), /* Commentaire */
  .modern-production-table td:nth-child(7),
  .modern-production-table th:nth-child(9), /* État ligne */
  .modern-production-table td:nth-child(9) {
    display: none;
  }
  
  /* COLONNES ESSENTIELLES RÉDUITES */
  .modern-production-table th:nth-child(1), 
  .modern-production-table td:nth-child(1) { width: 35px; } /* H */
  
  .modern-production-table th:nth-child(2), 
  .modern-production-table td:nth-child(2) { width: 30px; } /* Eq */
  
  .modern-production-table th:nth-child(3), 
  .modern-production-table td:nth-child(3) { width: 50px; } /* Prod */
  
  .modern-production-table th:nth-child(4), 
  .modern-production-table td:nth-child(4) { width: 50px; } /* Conf */
  
  .modern-production-table th:nth-child(6), 
  .modern-production-table td:nth-child(6) { width: 45px; } /* Arrêt */
  
  .modern-production-table th:nth-child(8), 
  .modern-production-table td:nth-child(8) { width: 70px; } /* État Ligne - plus large sur mobile */
  
  .modern-production-table th:nth-child(9), 
  .modern-production-table td:nth-child(9) { width: 50px; } /* Actions */
  
  /* TEXTE ABRÉGÉ POUR HEADERS MOBILES */
  .modern-production-table th:nth-child(1)::after { content: "H"; }
  .modern-production-table th:nth-child(2)::after { content: "Eq"; }
  .modern-production-table th:nth-child(3)::after { content: "Prod"; }
  .modern-production-table th:nth-child(4)::after { content: "Conf"; }
  .modern-production-table th:nth-child(6)::after { content: "Arrêt"; }
  .modern-production-table th:nth-child(8)::after { content: "État"; }
  .modern-production-table th:nth-child(9)::after { content: "Act"; }
  
  /* CACHER TEXTE ORIGINAL SUR MOBILE */
  .modern-production-table th {
    font-size: 0 !important;
    padding: 4px 2px;
  }
  
  .modern-production-table th::after {
    font-size: 9px;
    font-weight: 600;
    color: #475569;
  }
  
  /* HEADERS MOBILE */
  .modern-production-table thead th {
    padding: 4px 2px;
    font-size: 9px;
    line-height: 1.1;
    font-weight: 600;
  }
  
  /* CELLULES MOBILE */
  .modern-production-table tbody td {
    padding: 3px 2px;
    font-size: 10px;
  }
  
  /* INPUTS ET BOUTONS COMPACTS POUR MOBILE */
  .modern-production-table input[type="number"],
  .modern-production-table textarea {
    padding: 1px 3px;
    font-size: 9px;
    min-height: 22px;
    width: 100%;
    border: 1px solid #d1d5db;
  }
  
  .modern-production-table .action-btn {
    padding: 1px 3px;
    font-size: 8px;
    min-width: 26px;
    height: 22px;
  }
  
  .modern-production-table tbody tr {
    height: 40px;
  }
  
  /* INPUTS MOBILE CONTENUS */
  .modern-input, 
  .production-input, 
  .compliant-input {
    height: 26px;
    font-size: 11px;
    padding: 0 2px;
  }
  
  .comment-input {
    height: 26px;
    font-size: 10px;
    padding: 0 4px;
  }
  
  .modern-team-badge {
    padding: 2px 4px;
    font-size: 9px;
  }
  
  .performance-badge {
    padding: 1px 4px;
    font-size: 9px;
  }
  
  /* MASQUER ICÔNES SUR MOBILE POUR ÉCONOMISER ESPACE */
  /* CACHER TOUS LES ÉLÉMENTS NON ESSENTIELS */
  .modern-production-table thead th i {
    display: none !important;
  }
  
  .modern-production-table th .fas,
  .modern-production-table th .fa-keyboard,
  .modern-production-table th .fa-calculator,
  .modern-production-table th .fa-clock,
  .modern-production-table th .fa-robot,
  .modern-production-table th .fa-heartbeat {
    display: none !important;
  }
}

/* TRÈS PETITS ÉCRANS */
@media (max-width: 480px) {
  .fullscreen-header {
    font-size: 12px;
    padding: 6px 8px;
    height: 40px;
  }
  
  .modern-table-container {
    margin-top: 45px;
    padding: 8px 2px;
  }
  
  /* COLONNES TRÈS PETITS ÉCRANS */
  .modern-production-table th:nth-child(1), 
  .modern-production-table td:nth-child(1) { width: 45px; }
  
  .modern-production-table th:nth-child(2), 
  .modern-production-table td:nth-child(2) { width: 50px; }
  
  .modern-production-table th:nth-child(3), 
  .modern-production-table td:nth-child(3) { width: 65px; }
  
  .modern-production-table th:nth-child(4), 
  .modern-production-table td:nth-child(4) { width: 65px; }
  
  .modern-production-table th:nth-child(5), 
  .modern-production-table td:nth-child(5) { width: 45px; }
  
  .modern-production-table th:nth-child(6), 
  .modern-production-table td:nth-child(6) { width: 60px; }
  
  .modern-production-table thead th {
    padding: 6px 2px;
    font-size: 10px;
  }
  
  .modern-production-table tbody td {
    padding: 5px 2px;
    font-size: 11px;
  }
  
  .modern-production-table tbody tr {
    height: 36px;
  }
  
  .modern-input, 
  .production-input, 
  .compliant-input {
    height: 24px;
    font-size: 10px;
    padding: 0 1px;
  }
  
  .comment-input {
    height: 24px;
    font-size: 9px;
    padding: 0 2px;
  }
}

/* ============================================== */
/* DESKTOP LARGE ÉCRAN */
/* ============================================== */

@media (min-width: 1024px) {
  .modern-table-container {
    padding: 24px;
    max-width: 1200px;
    margin: 60px auto 0;
  }
  
  .modern-production-table thead th {
    padding: 12px 10px;
    font-size: 13px;
  }
  
  .modern-production-table tbody td {
    padding: 10px;
    font-size: 14px;
  }
  
  .modern-production-table tbody tr {
    height: 50px;
  }
  
  .modern-input, 
  .production-input, 
  .compliant-input {
    height: 32px;
    font-size: 13px;
    padding: 0 6px;
  }
  
  .comment-input {
    height: 32px;
    font-size: 12px;
    padding: 0 8px;
  }
}

/* ============================================== */
/* ANIMATIONS ET TRANSITIONS */
/* ============================================== */

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

.modern-table-wrapper {
  display: block !important; /* FORCE L'AFFICHAGE DU TABLEAU */
  visibility: visible !important;
  opacity: 1 !important;
  animation: fadeInUp 0.4s ease-out;
}

/* ÉTATS DE MODIFICATION */
.production-input.modified,
.compliant-input.modified,
.comment-input.modified {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.production-input.error,
.compliant-input.error {
  border-color: #ef4444;
  background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
}

/* COLONNES SPÉCIALES */
.line-status-cell {
  min-width: 120px;
  max-width: 140px;
}

.line-status-box {
  font-size: 10px;
  line-height: 1.2;
  padding: 4px;
  border-radius: 4px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
  .line-status-cell {
    min-width: 100px;
    max-width: 120px;
  }
  
  .line-status-box {
    font-size: 8px;
    padding: 2px 4px;
    min-height: 35px;
    line-height: 1.1;
  }
}

/* ================================================================= */
/* 🚦 CASES HORAIRES DYNAMIQUES - RÉACTIVITÉ SELON PERFORMANCE */
/* ================================================================= */

/* CONTAINER DE LA CASE HORAIRE DYNAMIQUE */
.dynamic-hour-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  min-width: 65px;
  min-height: 55px;
}

/* ================================================================= */
/* 📊 SECTION TABLEAU MINIMISABLE - NOUVEAU SYSTÈME */
/* ================================================================= */

/* Container principal de la section tableau */
#tableSection {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  transition: all 0.3s ease;
}

/* Header de la section tableau avec contrôles */
.table-section-header {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.table-section-header:hover {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
}

.table-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #374151;
  font-size: 16px;
}

.table-section-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-control-btn {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #6b7280;
  font-size: 14px;
}

.table-control-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #374151;
}

.minimize-btn {
  color: #3b82f6;
  border-color: #93c5fd;
}

.minimize-btn:hover {
  background: #dbeafe;
  border-color: #3b82f6;
}

.close-btn {
  color: #ef4444;
  border-color: #fca5a5;
}

.close-btn:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

/* Contenu du tableau - scrollable et responsive */
.table-section-content {
  max-height: 600px;
  overflow-y: auto;
  overflow-x: auto;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

/* État minimisé */
.table-section-content.minimized {
  max-height: 0;
  padding: 0;
  overflow: hidden;
}

/* Scrollbars personnalisées pour la section tableau */
.table-section-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-section-content::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.table-section-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
  border: 2px solid #f1f5f9;
}

.table-section-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.table-section-content::-webkit-scrollbar-corner {
  background: #f1f5f9;
}

/* Statistiques en bas du tableau */
.table-stats {
  background: #f8fafc;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  color: #6b7280;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-value {
  font-weight: 600;
  color: #374151;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
  #tableSection {
    margin: 12px 0;
    border-radius: 8px;
  }
  
  .table-section-header {
    padding: 10px 12px;
  }
  
  .table-section-title {
    font-size: 14px;
  }
  
  .table-control-btn {
    padding: 4px 6px;
    font-size: 12px;
  }
  
  .table-section-content {
    max-height: 400px;
  }
  
  .table-stats {
    padding: 8px 12px;
    font-size: 12px;
    flex-direction: column;
    gap: 8px;
  }
}

/* Animation d'expansion/contraction */
@keyframes tableExpand {
  from {
    max-height: 0;
    opacity: 0;
  }
  to {
    max-height: 600px;
    opacity: 1;
  }
}

@keyframes tableContract {
  from {
    max-height: 600px;
    opacity: 1;
  }
  to {
    max-height: 0;
    opacity: 0;
  }
}

.table-section-content.expanding {
  animation: tableExpand 0.3s ease-out;
}

.table-section-content.contracting {
  animation: tableContract 0.3s ease-out;
}
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

/* TEXTE DE L'HEURE */
.hour-time {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
  z-index: 2;
  position: relative;
}

/* INDICATEUR DE STATUT */
.hour-status-indicator {
  font-size: 10px;
  z-index: 2;
  position: relative;
}

/* BADGE DE CONFORMITÉ */
.hour-conformity-badge {
  font-size: 8px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  padding: 1px 3px;
  border-radius: 3px;
  margin-top: 1px;
  z-index: 2;
  position: relative;
}

/* ================================================================= */
/* ÉTATS DES CASES HORAIRES */
/* ================================================================= */

/* 🟢 TEMPS POSITIF - PERFORMANCE EXCELLENTE */
.hour-positive {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: 2px solid #047857;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.hour-positive:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.hour-positive .hour-status-indicator {
  color: #ecfdf5;
}

/* 🔴 TEMPS NÉGATIF - RETARD DÉTECTÉ */
.hour-negative {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: 2px solid #b91c1c;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
  animation: pulse-warning 2s infinite;
}

.hour-negative:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.hour-negative .hour-status-indicator {
  color: #fef2f2;
}

/* 🟠 PRODUCTION OK - QUALITÉ À SURVEILLER */
.hour-warning-quality {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: 2px solid #b45309;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.hour-warning-quality:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.hour-warning-quality .hour-status-indicator {
  color: #fffbeb;
}

/* 🟠 RETARD PRODUCTION - BONNE QUALITÉ */
.hour-warning-quantity {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  border: 2px solid #6d28d9;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.hour-warning-quantity:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.hour-warning-quantity .hour-status-indicator {
  color: #f3f4f6;
}

/* 🔴 PRODUCTION OK - QUALITÉ CRITIQUE */
.hour-critical-quality {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: white;
  border: 2px solid #7f1d1d;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
  animation: pulse-critical 1.5s infinite;
}

.hour-critical-quality:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.5);
}

.hour-critical-quality .hour-status-indicator {
  color: #fef2f2;
}

/* ☕ PAUSE - TEMPS DE PAUSE */
.hour-break {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: 2px solid #b45309;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.hour-break:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.hour-break .hour-status-indicator {
  color: #fffbeb;
}

/* ================================================================= */
/* STYLES PROFESSIONNELS POUR PANNEAU DE CONTRÔLE RÉORGANISÉ */
/* ================================================================= */

/* Conteneur principal du panneau */
.control-panel-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
  transition: all 0.3s ease;
}

.control-panel-container:hover {
  transform: translateY(-1px);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.12),
    0 2px 6px rgba(0, 0, 0, 0.08);
}

/* En-tête des sections */
.section-header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  padding: 16px 24px;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  position: relative;
}

.section-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
}

.section-header i {
  font-size: 18px;
  opacity: 0.9;
}

/* Sous-titres des sections */
.section-subtitle {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
}

.section-subtitle i {
  font-size: 14px;
  color: #3b82f6;
}

/* Conteneurs de sections */
.section-content {
  padding: 24px;
  border-bottom: 1px solid #f1f5f9;
}

.section-content:last-child {
  border-bottom: none;
}

/* Grille de boutons professionnelle */
.professional-button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

/* Boutons professionnels réorganisés */
.professional-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  min-height: 48px;
}

.professional-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.professional-btn:hover::before {
  opacity: 1;
}

.professional-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.professional-btn:active {
  transform: translateY(0);
  transition: transform 0.1s ease;
}

/* Types de boutons */
.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-color: #2563eb;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  border-color: #4f46e5;
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-color: #059669;
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border-color: #d97706;
}

.btn-warning:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border-color: #dc2626;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

.btn-neutral {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: white;
  border-color: #4b5563;
}

.btn-neutral:hover {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
  box-shadow: 0 8px 25px rgba(107, 114, 128, 0.4);
}

/* Icônes des boutons */
.professional-btn i {
  font-size: 18px;
  opacity: 0.9;
  transition: all 0.3s ease;
}

.professional-btn:hover i {
  opacity: 1;
  transform: scale(1.1);
}

/* Animations spécifiques par bouton */
.btn-refresh:hover i {
  animation: spin 0.5s linear;
}

.btn-config:hover i {
  animation: rotate 0.3s ease;
}

.btn-test:hover i {
  animation: bounce 0.6s ease;
}

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

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(90deg); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Responsive pour mobile */
@media (max-width: 768px) {
  .professional-button-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .professional-btn {
    padding: 10px 14px;
    font-size: 13px;
    min-height: 44px;
  }
  
  .professional-btn i {
    font-size: 16px;
  }
  
  .section-content {
    padding: 16px;
  }
  
  .section-header {
    padding: 12px 16px;
    font-size: 15px;
  }
  
  .section-subtitle {
    font-size: 11px;
    margin-bottom: 12px;
  }
}

/* Grille 2 colonnes pour écrans moyens */
@media (min-width: 768px) and (max-width: 1024px) {
  .professional-button-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Grille 3 colonnes pour grands écrans */
@media (min-width: 1024px) {
  .professional-button-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Effet de focus pour accessibilité */
.professional-btn:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Indicateur de statut sur les boutons */
.btn-status-indicator {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
}

.btn-status-active {
  background: #10b981;
}

.btn-status-warning {
  background: #f59e0b;
}

.btn-status-error {
  background: #ef4444;
}

/* ================================================================= */
/* ANIMATIONS ET TRANSITIONS */
/* ================================================================= */

/* Animation de pulsation pour les retards critiques */
@keyframes pulse-warning {
  0%, 100% { 
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3); 
  }
  50% { 
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.6); 
  }
}

/* Animation de pulsation pour qualité critique */
@keyframes pulse-critical {
  0%, 100% { 
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.7);
    transform: scale(1.02);
  }
}

/* Effet de mise à jour en temps réel */
.updating {
  transform: scale(1.05);
  transition: transform 0.3s ease !important;
}

/* ================================================================= */
/* RESPONSIVE MOBILE */
/* ================================================================= */

/* TABLETTES */
@media (max-width: 768px) {
  .dynamic-hour-cell {
    min-width: 50px;
    min-height: 45px;
    padding: 6px;
  }
  
  .hour-time {
    font-size: 12px;
  }
  
  .hour-status-indicator {
    font-size: 9px;
  }
}

/* MOBILES */
@media (max-width: 480px) {
  .dynamic-hour-cell {
    min-width: 40px;
    min-height: 35px;
    padding: 4px;
  }
  
  .hour-time {
    font-size: 10px;
  }
  
  .hour-status-indicator {
    font-size: 8px;
  }
  
  .hour-conformity-badge {
    font-size: 6px;
    padding: 0px 2px;
  }
}

/* TRÈS PETITS ÉCRANS */
@media (max-width: 320px) {
  .dynamic-hour-cell {
    min-width: 35px;
    min-height: 30px;
    padding: 3px;
  }
  
  .hour-time {
    font-size: 9px;
  }
  
  .hour-status-indicator {
    font-size: 7px;
  }
  
  .hour-conformity-badge {
    font-size: 5px;
    padding: 0px 1px;
  }
}

/* ================================================================= */
/* 🏭 JUSTIFICATION D'ARRÊTS COSMÉTIQUES */
/* ================================================================= */

/* BOUTON JUSTIFICATION DANS TEMPS D'ARRÊT */
.justify-btn {
  padding: 2px 4px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 10px;
  margin-left: 4px;
  transition: all 0.2s ease;
  opacity: 0.8;
}

.justify-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.justify-btn.critical {
  background: #dc2626;
  color: white;
}

.justify-btn.warning {
  background: #f59e0b;
  color: white;
}

.justify-btn.standard {
  background: #3b82f6;
  color: white;
}

/* MODAL DE JUSTIFICATION - SCROLL OPTIMISÉ MOBILE */
#downtimeJustificationModal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  overflow-y: auto; /* Scroll vertical */
  -webkit-overflow-scrolling: touch; /* Scroll fluide iOS */
  padding: 8px;
}

#downtimeJustificationModal > div {
  margin: auto;
  max-height: calc(100vh - 16px); /* Hauteur maximale adaptative */
  overflow-y: auto; /* Scroll interne */
  -webkit-overflow-scrolling: touch; /* Scroll fluide iOS */
}

#downtimeJustificationModal .flex-1 {
  max-height: calc(100vh - 200px); /* Réserve espace header/footer */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#equipmentCategories {
  max-height: 40vh; /* Limite hauteur catégories */
  overflow-y: auto;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
}

#downtimeCauses {
  max-height: 30vh; /* Limite hauteur causes */
  overflow-y: auto;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
}

/* AMÉLIORATION SCROLL TACTILE SPÉCIFIQUE */
#equipmentCategories::-webkit-scrollbar,
#downtimeCauses::-webkit-scrollbar {
  width: 6px;
}

#equipmentCategories::-webkit-scrollbar-track,
#downtimeCauses::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

#equipmentCategories::-webkit-scrollbar-thumb,
#downtimeCauses::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

#equipmentCategories::-webkit-scrollbar-thumb:hover,
#downtimeCauses::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.equipment-category {
  margin-bottom: 8px;
}

.category-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  text-align: center;
}

.category-btn:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.category-btn i {
  font-size: 24px;
  color: #6b7280;
  margin-bottom: 6px;
}

.category-btn:hover i {
  color: #3b82f6;
}

.category-btn span {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  line-height: 1.2;
}

.category-btn:hover span {
  color: #1e40af;
}

/* BOUTONS CAUSES D'ARRÊT */
.cause-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: left;
  font-size: 12px;
  color: #374151;
}

.cause-btn:hover {
  border-color: #f59e0b;
  background: #fef3c7;
  transform: translateX(2px);
}

.cause-btn i {
  color: #f59e0b;
  font-size: 14px;
  min-width: 14px;
}

.cause-btn:hover i {
  color: #d97706;
}

.downtime-cause-item {
  margin-bottom: 6px;
}

/* NOUVEAU MODAL SÉPARÉ POUR LES CAUSES */
#downtimeCausesModal {
  z-index: 9999; /* Au-dessus du modal équipements */
}

.cause-item-separate {
  margin-bottom: 8px;
}

.cause-btn-separate {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
}

.cause-btn-separate:hover {
  border-color: #f59e0b;
  background: #fef3c7;
  transform: translateX(4px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.cause-btn-separate:active {
  transform: translateX(2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* RESPONSIVE POUR MODAL CAUSES */
@media (max-width: 768px) {
  .cause-btn-separate {
    padding: 10px 12px;
    border-radius: 6px;
  }
  
  .cause-btn-separate span {
    font-size: 12px;
    line-height: 1.4;
  }
  
  .cause-btn-separate i {
    font-size: 14px !important;
  }
}

/* 🚨 CLIGNOTEMENT POUR ARRÊTS NON JUSTIFIÉS */
@keyframes blink-critical {
  0% { background-color: #dc2626; color: white; }
  50% { background-color: #fef2f2; color: #dc2626; }
  100% { background-color: #dc2626; color: white; }
}

@keyframes blink-warning {
  0% { background-color: #f59e0b; color: white; }
  50% { background-color: #fef3c7; color: #f59e0b; }
  100% { background-color: #f59e0b; color: white; }
}

@keyframes blink-standard {
  0% { background-color: #3b82f6; color: white; }
  50% { background-color: #eff6ff; color: #3b82f6; }
  100% { background-color: #3b82f6; color: white; }
}

.downtime-blink-critical {
  animation: blink-critical 1.5s infinite;
  border: 2px solid #dc2626 !important;
  border-radius: 6px;
  padding: 4px 6px;
}

.downtime-blink-warning {
  animation: blink-warning 2s infinite;
  border: 2px solid #f59e0b !important;
  border-radius: 6px;
  padding: 4px 6px;
}

.downtime-blink-standard {
  animation: blink-standard 2.5s infinite;
  border: 2px solid #3b82f6 !important;
  border-radius: 6px;
  padding: 4px 6px;
}

/* BOUTONS IA OBLIGATOIRE */
.ai-mandatory-btn {
  padding: 2px 4px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 10px;
  margin-left: 2px;
  transition: all 0.2s ease;
  opacity: 0.9;
}

.ai-mandatory-btn:hover {
  opacity: 1;
  transform: scale(1.2);
}

.ai-mandatory-btn.critical {
  background: #7c2d12;
  color: white;
  animation: pulse 2s infinite;
}

.ai-mandatory-btn.warning {
  background: #92400e;
  color: white;
}

.ai-mandatory-btn.standard {
  background: #1e40af;
  color: white;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* RESPONSIVE POUR BOUTONS IA */
@media (max-width: 768px) {
  .ai-mandatory-btn {
    padding: 1px 3px;
    font-size: 8px;
  }
}

/* NOUVEAUX INDICATEURS DE STATUT (remplacent les boutons IA dupliqués) */
.status-card {
  display: flex;
  align-items: center;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: white;
  min-height: 40px;
}

.status-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.status-icon {
  font-size: 16px;
  min-width: 16px;
}

.status-info {
  flex: 1;
}

.status-label {
  font-size: 11px;
  font-weight: 600;
  display: block;
}

.status-message {
  font-size: 10px;
  opacity: 0.8;
  line-height: 1.2;
  margin-top: 2px;
}

/* Couleurs par urgence */
.status-card.ai-critical {
  background: #fef2f2;
  border-color: #dc2626;
}

.status-card.ai-critical .status-icon {
  color: #dc2626;
}

.status-card.ai-critical .status-label {
  color: #dc2626;
}

.status-card.ai-warning {
  background: #fef3c7;
  border-color: #f59e0b;
}

.status-card.ai-warning .status-icon {
  color: #f59e0b;
}

.status-card.ai-warning .status-label {
  color: #f59e0b;
}

.status-card.ai-optimal {
  background: #f0fdf4;
  border-color: #10b981;
}

.status-card.ai-optimal .status-icon {
  color: #10b981;
}

.status-card.ai-optimal .status-label {
  color: #10b981;
}

.status-card.ai-standard {
  background: #eff6ff;
  border-color: #3b82f6;
}

.status-card.ai-standard .status-icon {
  color: #3b82f6;
}

.status-card.ai-standard .status-label {
  color: #3b82f6;
}

/* VERSION MOBILE */
.status-indicator-mobile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px;
}

.urgency-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid;
}

.urgency-dot.ai-critical {
  background: #dc2626;
  border-color: #dc2626;
}

.urgency-dot.ai-warning {
  background: #f59e0b;
  border-color: #f59e0b;
}

.urgency-dot.ai-optimal {
  background: #10b981;
  border-color: #10b981;
}

.urgency-dot.ai-standard {
  background: #3b82f6;
  border-color: #3b82f6;
}

.status-text {
  font-size: 8px;
  font-weight: 600;
  text-align: center;
}

@media (max-width: 768px) {
  .status-card {
    padding: 4px;
    min-height: 30px;
  }
  
  .status-icon {
    font-size: 12px;
  }
  
  .status-label {
    font-size: 9px;
  }
  
  .status-message {
    font-size: 8px;
  }
}

/* CAUSES D'ARRÊT */
.downtime-cause-item {
  margin-bottom: 4px;
}

.cause-btn {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: left;
}

.cause-btn:hover {
  border-color: #f59e0b;
  background: #fffbeb;
  transform: translateX(2px);
}

.cause-btn i {
  color: #f59e0b;
  margin-right: 8px;
  font-size: 12px;
}

.cause-btn span {
  font-size: 13px;
  color: #374151;
  line-height: 1.3;
}

.cause-btn:hover span {
  color: #92400e;
  font-weight: 500;
}

/* RESPONSIVE MOBILE */
@media (max-width: 768px) {
  .category-btn {
    padding: 8px;
  }
  
  .category-btn i {
    font-size: 20px;
  }
  
  .category-btn span {
    font-size: 11px;
  }
  
  .cause-btn {
    padding: 6px 8px;
  }
  
  .cause-btn span {
    font-size: 12px;
  }
  
  .justify-btn {
    padding: 1px 3px;
    font-size: 8px;
  }
  
  /* MODAL JUSTIFICATION - OPTIMISATION MOBILE EXTRÊME */
  #downtimeJustificationModal {
    padding: 4px;
  }
  
  #downtimeJustificationModal > div {
    border-radius: 8px;
    max-height: calc(100vh - 8px);
  }
  
  /* MODAL JUSTIFICATION - SCROLL TACTILE PARFAIT */
  #downtimeJustificationModal {
    padding: 2px;
  }
  
  #downtimeJustificationModal > div {
    border-radius: 8px;
    max-height: calc(100vh - 4px);
    margin: 2px auto;
  }
  
  #equipmentCategories {
    grid-template-columns: repeat(2, 1fr); /* 2 colonnes sur très petit écran */
    gap: 6px;
    max-height: 45vh; /* Espace optimisé */
    overflow-y: scroll; /* Force scroll visible */
    -webkit-overflow-scrolling: touch;
    padding: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
  }
  
  .category-btn {
    padding: 6px;
    border-radius: 6px;
    min-height: 60px; /* Hauteur minimale pour touch */
  }
  
  .category-btn i {
    font-size: 16px;
    margin-bottom: 3px;
  }
  
  .category-btn span {
    font-size: 9px;
    line-height: 1.1;
  }
  
  #downtimeCauses {
    max-height: 40vh; /* Plus d'espace pour les causes */
    overflow-y: scroll; /* Force scroll visible */
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
  }
  
  .cause-btn {
    padding: 8px;
    font-size: 11px;
    border-radius: 6px;
    min-height: 40px; /* Hauteur minimale pour touch */
  }
}

/* ================================================================= */
/* NOUVELLE INTERFACE IA - CARTES INTELLIGENTES AVEC HIÉRARCHIE VISUELLE */
/* ================================================================= */

/* CARTE IA BASE */
.ai-suggestion-card {
  border-radius: 8px;
  padding: 8px;
  min-height: 70px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-suggestion-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* HEADER DE LA CARTE */
.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ai-status {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* BOUTONS D'ACTION INTELLIGENTS */
.ai-analyze-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ai-analyze-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* CONTENU DE LA CARTE */
.ai-content {
  margin-top: 4px;
}

.suggestion-display {
  font-size: 10px;
  line-height: 1.3;
  font-weight: 500;
}

/* ================================================================= */
/* VARIANTES PAR NIVEAU D'URGENCE */
/* ================================================================= */

/* 🚨 CRITIQUE */
.ai-critical {
  border-color: #ef4444;
  background: linear-gradient(135deg, #fef2f2 0%, #fecaca 20%, #ffffff 100%);
}

.ai-critical .ai-label {
  color: #dc2626;
}

.btn-critical {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
}

.btn-critical:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}

/* ⚠️ ATTENTION */
.ai-warning {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #fed7aa 20%, #ffffff 100%);
}

.ai-warning .ai-label {
  color: #d97706;
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.btn-warning:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

/* ✅ OPTIMAL */
.ai-optimal {
  border-color: #10b981;
  background: linear-gradient(135deg, #f0fdf4 0%, #bbf7d0 20%, #ffffff 100%);
}

.ai-optimal .ai-label {
  color: #059669;
}

.btn-optimal {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.btn-optimal:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* ℹ️ STANDARD */
.ai-standard {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 20%, #ffffff 100%);
}

.ai-standard .ai-label {
  color: #2563eb;
}

.btn-standard {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.btn-standard:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* ================================================================= */
/* AFFICHAGE INTELLIGENT DU TEMPS D'ARRÊT */
/* ================================================================= */

.downtime-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  position: relative;
  transition: all 0.3s ease;
  min-width: 60px;
}

.downtime-display:hover {
  transform: scale(1.05);
}

/* VARIANTES PAR NIVEAU */
.downtime-display.critical {
  background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
  border: 1px solid #f87171;
}

.downtime-display.warning {
  background: linear-gradient(135deg, #fffbeb 0%, #fed7aa 100%);
  border: 1px solid #fbbf24;
}

.downtime-display.standard {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #93c5fd;
}

.downtime-display.optimal {
  background: linear-gradient(135deg, #f0fdf4 0%, #bbf7d0 100%);
  border: 1px solid #86efac;
}

.downtime-display.break-time {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
}

/* INDICATEUR D'URGENCE */
.urgency-indicator {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.urgency-indicator.critical {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

.urgency-indicator.warning {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

/* ================================================================= */
/* RESPONSIVE MOBILE - CARTES IA OPTIMISÉES */
/* ================================================================= */

@media (max-width: 768px) {
  .ai-suggestion-card {
    padding: 4px;
    min-height: 40px;
    border-radius: 6px;
  }
  
  .ai-header {
    margin-bottom: 2px;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }
  
  .ai-status {
    gap: 2px;
  }
  
  .ai-label {
    font-size: 7px;
    font-weight: 800;
  }
  
  .ai-analyze-btn {
    padding: 2px 4px;
    font-size: 7px;
    gap: 1px;
    border-radius: 4px;
  }
  
  .ai-analyze-btn .btn-text {
    display: none; /* Cache le texte sur mobile, garde que l'icône */
  }
  
  .ai-content {
    display: none; /* Cache complètement le message sur mobile */
  }
  
  /* Version ultra-compacte pour mobile - MINIMALISTE */
  .ai-micro-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px;
    min-height: 24px;
    max-width: 60px;
    border-radius: 4px;
    background: transparent;
  }
  
  .urgency-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  
  .urgency-indicator.ai-critical {
    background: #ef4444;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.6);
  }
  
  .urgency-indicator.ai-warning {
    background: #f59e0b;
    box-shadow: 0 0 4px rgba(245, 158, 11, 0.6);
  }
  
  .urgency-indicator.ai-optimal {
    background: #10b981;
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.6);
  }
  
  .urgency-indicator.ai-standard {
    background: #3b82f6;
    box-shadow: 0 0 4px rgba(59, 130, 246, 0.6);
  }
  
  .ai-btn-tiny {
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
  }
  
  .ai-btn-tiny:hover {
    transform: scale(1.1);
  }
}

/* TRÈS PETITS ÉCRANS - ENCORE PLUS COMPACT */
@media (max-width: 480px) {
  .ai-micro-card {
    max-width: 50px;
    padding: 1px 3px;
    min-height: 20px;
  }
  
  .urgency-indicator {
    width: 6px;
    height: 6px;
  }
  
  .ai-btn-tiny {
    width: 16px;
    height: 16px;
    font-size: 7px;
  }
  
  /* TEMPS D'ARRÊT MOBILE */
  .downtime-display {
    padding: 2px 4px;
    min-width: 45px;
  }
  
  .downtime-display span {
    font-size: 9px;
  }
  
  /* COLONNE IA MOBILE */
  .ai-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  
  .ai-cell {
    padding: 4px 2px !important;
  }
  
  .urgency-indicator {
    width: 6px;
    height: 6px;
  }
}

/* ACCESSIBILITY */
.modern-production-table *:focus {
  outline: 2px solid #60a5fa;
  outline-offset: 1px;
}

/* ================================================================= */
/* AI SOLUTIONS SYSTEM - INTÉGRATION COMPLÈTE */
/* ================================================================= */

/* En-tête des solutions IA */
.ai-solutions-header {
  margin-bottom: 16px;
}

.ai-solutions-header h3 {
  color: #1f2937;
  font-size: 18px;
  font-weight: 700;
}

/* Container du timer IA */
.ai-timer-container {
  margin: 12px 0;
}

.ai-timer-container .bg-orange-50 {
  background-color: #fff7ed;
  border-color: #fed7aa;
}

#aiTimer {
  font-family: 'Courier New', monospace;
  color: #ea580c;
  font-size: 18px;
  font-weight: 700;
}

/* Boutons du timer */
.btn-timer-start, .btn-timer-pause, .btn-timer-reset {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-timer-start {
  background: #22c55e;
  color: white;
}

.btn-timer-start:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

.btn-timer-pause {
  background: #f59e0b;
  color: white;
}

.btn-timer-pause:hover {
  background: #d97706;
}

.btn-timer-reset {
  background: #ef4444;
  color: white;
}

.btn-timer-reset:hover {
  background: #dc2626;
}

/* Container des solutions */
.ai-solutions-container {
  margin-top: 16px;
}

.solutions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Cartes de solution */
.solution-card {
  transition: all 0.3s ease;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.solution-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

.solution-card.solution-completed {
  background: #f0fdf4;
  border-color: #22c55e;
}

/* En-tête de solution */
.solution-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.solution-title {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.solution-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-estimate {
  font-size: 11px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
}

.toggle-details {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.toggle-details:hover {
  background: #f3f4f6;
  color: #374151;
}

/* Détails des solutions */
.solution-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}

/* Étapes de la solution */
.solution-steps {
  margin-bottom: 12px;
}

.steps-title {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.solution-steps ol {
  background: #f8fafc;
  padding: 12px;
  border-radius: 6px;
  border-left: 3px solid #3b82f6;
  margin: 0;
  padding-left: 20px;
}

.solution-steps li {
  font-size: 12px;
  color: #4b5563;
  margin-bottom: 4px;
  line-height: 1.4;
}

.solution-steps li:last-child {
  margin-bottom: 0;
}

/* Outils requis */
.solution-tools {
  margin-bottom: 12px;
}

.tools-title {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.tools-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tool-tag {
  font-size: 10px;
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 6px;
  border-radius: 12px;
  border: 1px solid #bfdbfe;
}

/* Prévention */
.solution-prevention {
  margin-bottom: 12px;
}

.prevention-title {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.prevention-text {
  font-size: 11px;
  color: #6b7280;
  background: #fffbeb;
  padding: 6px 8px;
  border-radius: 4px;
  border-left: 3px solid #f59e0b;
  margin: 0;
}

/* Actions des solutions */
.solution-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-solution-complete, .btn-solution-timer {
  font-size: 11px;
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-solution-complete {
  background: #22c55e;
  color: white;
}

.btn-solution-complete:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

.btn-solution-timer {
  background: #3b82f6;
  color: white;
}

.btn-solution-timer:hover {
  background: #2563eb;
}

/* Actions globales */
.ai-actions-footer {
  border-top: 1px solid #f3f4f6;
  padding-top: 16px;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.btn-complete-all, .btn-additional-help {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-complete-all {
  background: #22c55e;
  color: white;
}

.btn-complete-all:hover {
  background: #16a34a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-additional-help {
  background: #f59e0b;
  color: white;
}

.btn-additional-help:hover {
  background: #d97706;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Section d'aide supplémentaire */
.additional-help-section {
  animation: slideInFromTop 0.3s ease-out;
}

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

/* Indicateur de solution complétée */
.completed-check {
  animation: checkBounce 0.5s ease-out;
}

@keyframes checkBounce {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* ================================================================= */
/* AI MODAL RESPONSIVE - AMÉLIORATION MOBILE */
/* ================================================================= */

@media (max-width: 768px) {
  .solution-card {
    padding: 12px;
  }
  
  .solution-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .solution-meta {
    align-self: flex-end;
  }
  
  .solution-actions {
    flex-direction: column;
  }
  
  .btn-solution-complete, .btn-solution-timer {
    width: 100%;
    padding: 8px 12px;
  }
  
  .ai-actions-footer {
    flex-direction: column;
  }
  
  .btn-complete-all, .btn-additional-help {
    width: 100%;
  }
  
  .tools-list {
    flex-direction: column;
    gap: 2px;
  }
  
  .tool-tag {
    width: fit-content;
  }
}

/* Scrolling amélioré pour mobile */
@media (max-width: 480px) {
  .ai-solutions-container {
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .solution-card {
    margin-bottom: 8px;
  }
  
  .solution-steps ol {
    padding-left: 16px;
  }
  
  #aiTimer {
    font-size: 16px;
  }
}

/* PRINT STYLES */
@media print {
  .fullscreen-header {
    position: static;
    background: #1e40af !important;
  }
  
  .modern-table-container {
    margin-top: 0;
    background: white !important;
  }
  
  /* Masquer les éléments IA en impression */
  .ai-solutions-header,
  .ai-timer-container,
  .ai-solutions-container,
  .solution-actions,
  .ai-actions-footer {
    display: none !important;
  }
}

/* ================================================================= */
/* JUSTIFICATION CONTEXT IN AI NOTIFICATIONS */
/* ================================================================= */

/* Notification avec contexte */
.ai-notification-card.has-context {
  border-left: 4px solid #3b82f6;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

/* Badge de contexte */
.context-badge {
  font-size: 10px;
  background: #22c55e;
  color: white;
  padding: 2px 6px;
  border-radius: 8px;
  margin-left: 8px;
  font-weight: 500;
}

/* Section contexte de justification */
.justification-context {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 12px;
  margin: 8px 0;
}

.context-header {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: #1e40af;
  margin-bottom: 8px;
}

.context-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.context-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.context-label {
  color: #6b7280;
  font-weight: 500;
}

.context-value {
  color: #1f2937;
  font-weight: 600;
  background: #e5e7eb;
  padding: 1px 4px;
  border-radius: 3px;
}

.severity-critical {
  background: #fecaca !important;
  color: #dc2626 !important;
}

.severity-high {
  background: #fed7aa !important;
  color: #ea580c !important;
}

.severity-standard {
  background: #dbeafe !important;
  color: #2563eb !important;
}

/* Solutions spécialisées */
.specialized-solutions {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 12px;
  margin-top: 8px;
}

.solutions-header {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: #15803d;
  margin-bottom: 8px;
}

.solutions-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.solution-preview-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border: 1px solid #d1fae5;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 11px;
}

.solution-preview-title {
  color: #374151;
  font-weight: 500;
}

.solution-preview-time {
  color: #6b7280;
  background: #f3f4f6;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
}

.more-solutions {
  text-align: center;
  font-size: 10px;
  color: #6b7280;
  font-style: italic;
  padding: 4px;
}

.btn-view-detailed-solutions {
  width: 100%;
  background: #22c55e;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-view-detailed-solutions:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

/* Mobile responsive pour contexte */
@media (max-width: 768px) {
  .context-details {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  
  .context-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  
  .solution-preview-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  
  .justification-context,
  .specialized-solutions {
    padding: 8px;
  }
}

/* ================================================================= */
/* COMPTEURS TRS/TRG STYLE MOTO - AIGUILLES ANIMÉES */
/* ================================================================= */

.trs-gauge-container, .trg-gauge-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trs-gauge, .trg-gauge {
  transform: rotate(-90deg);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Animations des arcs de progression */
.trs-progress, .trg-progress {
  transition: stroke-dashoffset 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Animations des aiguilles */
.trs-needle, .trg-needle {
  transition: transform 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Graduations du compteur */
.gauge-labels {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.gauge-label-0, .gauge-label-50, .gauge-label-100 {
  position: absolute;
  font-size: 10px;
  font-weight: bold;
  color: #6b7280;
}

.gauge-label-0 {
  bottom: 8px;
  left: 8px;
}

.gauge-label-50 {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.gauge-label-100 {
  bottom: 8px;
  right: 8px;
}

/* Couleurs d'état pour les compteurs */
.trs-gauge.excellent .trs-progress,
.trg-gauge.excellent .trg-progress {
  stroke: #10b981; /* Vert excellent */
}

.trs-gauge.good .trs-progress,
.trg-gauge.good .trg-progress {
  stroke: #3b82f6; /* Bleu bon */
}

.trs-gauge.average .trs-progress,
.trg-gauge.average .trg-progress {
  stroke: #f59e0b; /* Orange moyen */
}

.trs-gauge.poor .trs-progress,
.trg-gauge.poor .trg-progress {
  stroke: #ef4444; /* Rouge faible */
}

/* Animation de pulsation pour valeurs critiques */
.trs-gauge.critical .trs-progress,
.trg-gauge.critical .trg-progress {
  animation: gauge-pulse 2s ease-in-out infinite;
}

@keyframes gauge-pulse {
  0%, 100% {
    stroke: #ef4444;
    opacity: 1;
  }
  50% {
    stroke: #dc2626;
    opacity: 0.7;
  }
}

/* Responsive pour compteurs */
@media (max-width: 768px) {
  .trs-gauge-container, .trg-gauge-container {
    width: 100px;
    height: 100px;
  }
  
  .trs-gauge, .trg-gauge {
    width: 100px;
    height: 100px;
  }
  
  .gauge-label-0, .gauge-label-50, .gauge-label-100 {
    font-size: 8px;
  }
}
/* ================================================================= */
/* 📋 TRAÇABILITÉ PRODUCTION - SECTION OF ET LOT RESPONSIVE */
/* ================================================================= */

/* Section traçabilité dans l'en-tête */
.traceability-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.traceability-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.traceability-label {
  color: rgb(209, 213, 219);
  font-size: 0.875rem;
  white-space: nowrap;
}

.traceability-value {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-weight: 600;
  margin-left: 0.25rem;
  font-size: 0.875rem;
}

.traceability-value.has-value {
  color: rgb(196, 181, 253); /* Purple-200 pour OF */
}

.traceability-value.lot.has-value {
  color: rgb(252, 211, 77); /* Amber-200 pour Lot */  
}

.traceability-value.empty {
  color: rgb(156, 163, 175); /* Gray-400 pour valeurs vides */
}

/* Responsive design pour mobile */
@media (max-width: 768px) {
  .traceability-section {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  
  .traceability-item {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
  }
  
  .traceability-label,
  .traceability-value {
    font-size: 0.75rem;
  }
}

/* Très petits écrans */
@media (max-width: 480px) {
  .traceability-section {
    width: 100%;
  }
  
  .traceability-item {
    flex: 1;
    justify-content: space-between;
    min-width: 120px;
  }
}

/* Classe force-visible pour garantir l'affichage du tableau */
.force-visible {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
}


/* ================================================================= */
/* STYLES SPÉCIFIQUES POUR LA FENÊTRE POPUP DU TABLEAU */
/* ================================================================= */

/* Optimisations pour fenêtre popup */
.popup-table-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* En-tête compact pour popup */
.popup-header {
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 50%, #06b6d4 100%);
  padding: 16px 20px;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Conteneur du tableau dans popup */
.popup-content {
  padding: 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

/* Barre d'outils compacte */
.popup-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: rgba(248, 250, 252, 0.8);
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  backdrop-filter: blur(10px);
}

/* Statistiques en bas de popup */
.popup-stats {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.popup-stat-card {
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.popup-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.popup-stat-value {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 4px;
}

.popup-stat-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Couleurs pour les statistiques */
.stat-products {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
}

.stat-conformes {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
}

.stat-rebuts {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #dc2626;
}

.stat-downtime {
  background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
  color: #ea580c;
}

/* Boutons dans la popup */
.popup-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
  cursor: pointer;
}

.popup-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Animation pour le bouton d'actualisation */
.popup-btn .fa-sync-alt {
  transition: transform 0.5s ease;
}

.popup-btn:active .fa-sync-alt {
  transform: rotate(360deg);
}

/* Filtres dans la popup */
.popup-filter {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.popup-filter:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

/* Responsive pour la fenêtre popup */
@media (max-width: 1200px) {
  .popup-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .popup-toolbar {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  
  .popup-stats {
    grid-template-columns: 1fr;
  }
}

/* Amélioration de l'affichage du tableau dans la popup */
.popup-table-container .modern-production-table {
  font-size: 14px;
}

.popup-table-container .modern-header-cell {
  padding: 12px 8px;
  font-size: 13px;
}

.popup-table-container .production-table td {
  padding: 10px 8px;
  font-size: 13px;
}

/* Notification pour ouverture popup */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.popup-notification {
  animation: slideInRight 0.3s ease-out;
}

/* ================================================================= */
/* SYSTÈME DE REDIMENSIONNEMENT ET TOGGLE DU TABLEAU PRINCIPAL */
/* ================================================================= */

/* Conteneur redimensionnable du tableau */
.modern-table-wrapper {
  position: relative;
  transition: all 0.3s ease-out;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: auto; /* Barres de défilement si contenu dépasse */
  resize: both; /* Permet le redimensionnement horizontal et vertical */
  min-width: 800px; /* Largeur minimale */
  max-width: 100%; /* Largeur maximale */
  min-height: 400px; /* Hauteur minimale */
  max-height: 80vh; /* Hauteur maximale */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Styles quand le tableau est actif/visible */
.modern-table-wrapper:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

/* Poignée de redimensionnement personnalisée */
.modern-table-wrapper::after {
  content: '↘';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: rgba(59, 130, 246, 0.8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: se-resize;
  border-radius: 2px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.modern-table-wrapper:hover::after {
  opacity: 1;
}

/* Animation d'apparition/disparition */
@keyframes tableSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tableSlideOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-20px) scale(0.98);
  }
}

.table-slide-in {
  animation: tableSlideIn 0.4s ease-out forwards;
}

.table-slide-out {
  animation: tableSlideOut 0.3s ease-out forwards;
}

/* Responsive pour le redimensionnement */
@media (max-width: 768px) {
  .modern-table-wrapper {
    min-width: 100%;
    resize: vertical; /* Seulement redimensionnement vertical sur mobile */
  }
}

/* Notification de toggle */
.table-toggle-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
  z-index: 1000;
  animation: slideInRight 0.3s ease-out;
  font-weight: 500;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ================================================================= */
/* SECTION TABLEAU SÉPARÉE - STYLES AVANCÉS */
/* ================================================================= */

/* Section principale du tableau */
#tableauSection {
  margin: 32px 24px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#tableauSection.hidden {
  display: none !important;
}

/* Header de la section avec curseur pointer */
#tableauHeader {
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
}

#tableauHeader:hover {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1e293b 100%) !important;
}

/* Contenu de la section avec transitions */
#tableauContent {
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#tableauContent.minimized {
  max-height: 0 !important;
  opacity: 0 !important;
}

/* Boutons de contrôle dans l'header */
#tableauHeader button {
  transition: all 0.2s ease;
}

#tableauHeader button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Styles pour les filtres dans l'header */
#tableauTeamFilter,
#tableauDateFilter {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  backdrop-filter: blur(10px);
}

#tableauTeamFilter:focus,
#tableauDateFilter:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(59, 130, 246, 0.5);
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Barre d'informations */
.tableau-info-bar {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
}

/* Animation de pulsation pour l'indicateur temps réel */
@keyframes pulse-green {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-pulse {
  animation: pulse-green 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Tableau dans la section séparée */
#separateProductionTable {
  font-size: 14px;
}

#separateProductionTable th {
  font-size: 13px;
  padding: 12px 8px;
}

#separateProductionTable td {
  padding: 10px 8px;
  font-size: 13px;
}

/* Statistiques en bas */
.tableau-stats {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.tableau-stat-card {
  transition: all 0.2s ease;
}

.tableau-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* États spéciaux pour le header quand réduit */
#tableauHeader.minimized {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 50%, #3b82f6 100%) !important;
}

/* Responsive pour la section séparée */
@media (max-width: 768px) {
  #tableauSection {
    margin: 16px 8px;
  }
  
  #tableauHeader {
    padding: 16px 12px;
  }
  
  #tableauHeader .flex {
    flex-direction: column;
    gap: 12px;
  }
  
  .tableau-stats .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .tableau-stats .grid {
    grid-template-columns: 1fr;
  }
  
  #tableauHeader .flex > div {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  #tableauTeamFilter,
  #tableauDateFilter {
    width: 100%;
  }
}

/* Animation d'ouverture de la section */
@keyframes sectionSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#tableauSection:not(.hidden) {
  animation: sectionSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================================================= */
/* CERVEAU IA PULSANT - COLONNE ACTIONS */
/* ================================================================= */

.ai-brain-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-brain-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: 2px solid #1d4ed8;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
  animation: brainPulse 2s ease-in-out infinite;
}

.ai-brain-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: scale(1.1);
  box-shadow: 0 6px 12px rgba(37, 99, 235, 0.5);
}

.ai-brain-btn i {
  color: white;
  font-size: 18px;
  animation: brainBeat 1.5s ease-in-out infinite;
}

/* Animation pulsation comme un cœur */
@keyframes brainPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
  }
  25% {
    transform: scale(1.05);
    box-shadow: 0 6px 10px rgba(37, 99, 235, 0.4);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 8px 14px rgba(37, 99, 235, 0.5);
  }
  75% {
    transform: scale(1.05);
    box-shadow: 0 6px 10px rgba(37, 99, 235, 0.4);
  }
}

/* Animation battement du cerveau */
@keyframes brainBeat {
  0%, 100% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.15);
  }
  60% {
    transform: scale(1);
  }
}
