/* ============================================
   STYLES PRINCIPAUX - VUE GLOBALE
   ============================================ */

/* Configuration de base de la page */
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background: #f0f2f5;  /* Fond légèrement grisé pour un meilleur contraste */
  overflow: hidden;     /* Empêche le défilement de la page */
  user-select: none;    /* Empêche la sélection de texte */
  min-height: 100vh;
  width: 100vw;
  /*color: #2c3e50;*/
  transition: background-color 0.5s ease, color 0.5s ease;
}

/* ============================================
   GRILLE DES INDICATEURS CLÉS (KPI)
   ============================================ */

/* Structure de la grille principale */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas: "wait connect ongoing";
  gap: clamp(15px, 2vw, 25px);
  width: 100%;
  height: auto;
  box-sizing: border-box;
  padding: 0 clamp(20px, 3vw, 40px);
  margin: 0 auto 20px auto;
  padding-top: clamp(0px, 1vh, 10px); /* KPI collés en haut */
  transform: none;
  align-items: stretch;
  min-height: 28vh;
}

/* Style commun pour tous les blocs KPI */
.kpi-block {
  background: #ffffff;
  border-radius: clamp(10px, 2vw, 20px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: clamp(10px, 2vw, 20px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
  min-width: 0;
  max-width: 100%;
  height: 100%;
  min-height: 18vh;
}

/* Positionnement spécifique de chaque bloc KPI */
#waitingCallsBlock { grid-area: wait; }     /* Appels en attente */
#connectedAgentsBlock { grid-area: connect; } /* Agents disponibles */
#ongoingCallsBlock { grid-area: ongoing; }   /* Agents en ligne */

/* Animation d'alerte pour les appels en attente */
#waitingCallsBlock.blinkAlert {
  animation: blinkBlue 1s infinite;
}

/* Style des titres KPI */
.kpi-block h2 {
  margin: 0 0 15px 0;
  font-size: clamp(2rem, 4vw, 5rem);
  text-align: center;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.5vw, 15px);
  width: 100%;
  overflow: hidden;
}

/* Style des icônes dans les titres KPI */
.kpi-block h2 i {
  font-size: clamp(1.5rem, 3vw, 3.5rem);
}

/* Style des valeurs KPI */
.kpi-block p {
  margin: 0;
  font-size: clamp(4rem, 10vw, 12rem);
  font-weight: bold;
  text-align: center;
  line-height: 1;
}

/* Animation de pulsation pour les changements */
@keyframes kpiPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Animation des icônes lors des changements d'état */
.kpi-block:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Animation spéciale pour l'icône des appels en attente */
#waitingCallsBlock.blinkAlert h2 i {
  animation: shake 0.5s infinite;
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

/* ============================================
   ZONE DATE/HEURE
   ============================================ */

/* Conteneur de la date et l'heure */
.datetime-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed; /* Reste visible même en scrollant */
  bottom: 0; /* Ancré en bas */
  left: 50%; /* Commence à 50% du bord gauche */
  transform: translateX(-50%); /* Décale de la moitié de sa largeur vers la gauche pour centrer */
  width: 100%;
  height: auto;
  background: transparent;
  z-index: 997; /* Augmente le z-index pour être au-dessus des autres éléments */
  padding-bottom: clamp(10px, 2vh, 20px); /* Ajoute un peu d'espace en bas */
}

/* Style de l'affichage date/heure */
#datetimeDisplay {
  font-size: clamp(2rem, 5vw, 8rem);
  font-weight: bold;
  color: #2c3e50;
  margin: 0;
  padding: 0;
}

/* Conteneur principal pour l'horloge et les KPIs */
.main-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100vh;
  padding: clamp(20px, 3vh, 40px) 0;
  box-sizing: border-box;
  /*margin-top: -80px;*/ /* Rétablit la marge supérieure du conteneur principal à 0 */
}

/* Media Queries pour la responsivité */
@media screen and (max-width: 1200px) {
  .stats-grid {
    gap: 15px;
    padding: 0 20px;
  }
  
  .kpi-block {
    padding: 15px;
  }
}

@media screen and (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
    grid-template-areas: 
      "wait"
      "connect"
      "ongoing";
    gap: 10px;
    padding: 0 15px;
    margin: 0 auto 10px auto;
    padding-top: clamp(0px, 1vh, 5px);
    min-height: 18vh;
  }
  
  .kpi-block {
    padding: 10px;
    min-height: 12vh;
  }
  
  .datetime-container {
    padding-bottom: 10px;
  }
}

@media screen and (max-height: 600px) {
  .stats-grid {
    margin-top: 0;
    padding-top: 5px;
  }
  
  .kpi-block h2 {
    margin-bottom: 10px;
  }
  
  .kpi-block p {
    font-size: clamp(3rem, 8vh, 8rem);
  }
}

/* ============================================
   NOTIFICATIONS ET ALERTES
   ============================================ */

/* Style de base pour les notifications */
.snackbar, .snackbarAgent {
  position: fixed;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: clamp(15px, 2vw, 30px) clamp(20px, 3vw, 40px);
  border-radius: clamp(8px, 1.5vw, 12px);
  font-size: clamp(2rem, 4vw, 6rem);
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  width: auto;
  min-width: 100%;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  border: 3px solid rgba(255, 255, 255, 0.25);
  transition: opacity 0.3s ease;
  opacity: 0;
  display: none;
}

/* La snackbar d'appels est toujours au-dessus de la snackbar agent */
.snackbar {
  z-index: 1005;
  top: 65%;
}

.snackbarAgent {
  z-index: 1000;
  top: 90%;
}

/* État visible des snackbars */
.snackbar.visible {
  opacity: 1;
  display: block;
  font-size: 5rem;
}

.snackbarAgent.visible {
  opacity: 1;
  display: block;
}

/* Animation de clignotement pour la snackbar d'appels */
.snackbar.snackbarAlert {
  animation: blinkBlue 1s infinite;
}

/* États d'alerte pour les KPI */
.kpi-alert {
  background-color: #fe9c29 !important;
  color: #fff !important;
}

.kpi-alert h2, 
.kpi-alert p, 
.kpi-alert h2 i {
  color: #fff !important;
}

/* Classes de couleur pour les notifications */
.snackbarAlert {
  background-color: #fe9c29;
  color: #fff;
}

.snackbarGreen { 
  background-color: #28a745;
  color: #fff;
}

.snackbarBrown { 
  background-color: #3f98e0;
  color: #fff;
}

.snackbarYellow { 
  background-color: #ffc107;
  color: #000;
}

/* Animation clignotante pour les alertes */
@keyframes blinkBlue {
  0%, 100% { 
    background-color: #fe9c29; 
    color: #fff; 
  }
  50% { 
    background-color: #fff; 
    color: #fe9c29; 
  }
}

/* Animation pour le texte */
@keyframes textBlink {
  0%, 100% { 
    color: #fff; 
  }
  50% { 
    color: #fe9c29; 
  }
}

/* Animation d'alerte pour les appels en attente */
#waitingCallsBlock.blinkAlert {
  animation: blinkBlue 1s infinite;
}

#waitingCallsBlock.blinkAlert h2,
#waitingCallsBlock.blinkAlert p,
#waitingCallsBlock.blinkAlert h2 i {
  animation: textBlink 1s infinite;
}

/* ============================================
   ÉTATS ET COULEURS DES INDICATEURS
   ============================================ */
#waitingCalls {
  color: #fe9c29;
}

#ongoingCalls{
  color: #3f98e0;
}

/* États d'alerte pour les KPI */
.kpi-alert {
  background-color: #dc3545 !important;  /* Rouge pour les alertes */
  color: #fff !important;
}
.kpi-alert h2, .kpi-alert p {
  color: #fff !important;
}
.kpi-alert h2 i {
  color: #fff !important;
}

.kpi-green {
  background-color: #28a745 !important;  /* Vert pour le positif */
  color: #fff !important;
}
.kpi-green h2, .kpi-green p {
  color: #fff !important;
}
.kpi-green h2 i {
  color: #fff !important;
}

.kpi-brown {
  background-color: #3f98e0 !important;  /* Marron pour l'attention */
  color: #fff !important;
}
.kpi-brown h2, .kpi-brown p {
  color: #fff !important;
}
.kpi-brown h2 i {
  color: #fff !important;
}

.kpi-yellow {
  background-color: #ffc107 !important;  /* Jaune pour l'avertissement */
  color: #000 !important;
}
.kpi-yellow h2, .kpi-yellow p {
  color: #000 !important;
}
.kpi-yellow h2 i {
  color: #000 !important;
}

/* Amélioration de la visibilité des notifications */
.snackbar, .snackbarAgent {
  backdrop-filter: blur(8px);
  border: 3px solid rgba(255, 255, 255, 0.25);
}

/* ============================================
   THÈMES TEMPORELS
   ============================================ */

/* Suppression des thèmes temporels */
:root {
  --bg-color: #f0f2f5;
  --block-bg: #ffffff;
  --text-color: #2c3e50;
  --icon-color: #337ab7;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --datetime-bg: #ffffff;
}

/* Application des variables CSS */
body {
  background: var(--bg-color);
  color: var(--text-color);
}

.kpi-block {
  background: var(--block-bg);
  box-shadow: 0 6px 12px var(--shadow-color);
}

.kpi-block h2 {
  font-size: 4.5rem;
  margin-bottom: 0;
  color: var(--text-color);
}

.kpi-block h2 i {
  color: var(--icon-color);
}

.kpi-block p {
  font-size: 10rem;
  color: var(--text-color);
}

.datetime-container {
  background: var(--block-bg) !important;
  box-shadow: 0 6px 12px var(--shadow-color);
  border-radius: 18px;
  padding: 0.5em 0;
}

#datetimeDisplay {
  color: var(--text-color);
}

/* Animation de transition entre les thèmes */
.kpi-block, .datetime-container {
  transition: all 0.5s ease;
}

#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff; /* Fond blanc */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999; /* Assure qu'il est au-dessus de tout */
    transition: opacity 0.5s ease, visibility 0.5s ease; /* Ajouter la transition pour visibility */
}

#splash-screen.hidden {
    opacity: 0;
    visibility: hidden; /* Cacher complètement l'élément après la transition */
    pointer-events: none; /* Permet l'interaction une fois caché */
}

#splash-logo {
    width: 600px; /* Ajuste la taille du logo selon tes besoins */
    height: auto;
    margin-bottom: 30px; /* Augmenter l'espace sous le logo */
    opacity: 0; /* Commence invisible pour l'animation */
    transform: scale(0.9); /* Commence légèrement plus petit pour l'animation */
    animation: logoFadeIn 1s ease-out forwards; /* Appliquer l'animation */
    animation-delay: 0.2s; /* Petit délai après l'apparition du splash screen */
}

/* Animation pour le logo */
@keyframes logoFadeIn {
    to { opacity: 1; transform: scale(1); }
}

/* Style pour le spinner (lazyloading: circle) - Amélioration */
.loading-spinner {
    border: 8px solid rgba(0, 0, 0, 0.1); /* Couleur de base plus subtile */
    border-top: 8px solid #ff6f00; /* Orange du logo */
    border-radius: 50%;
    width: 60px; /* Un peu plus grand */
    height: 60px; /* Un peu plus grand */
    animation: spin 1s linear infinite;
    margin-bottom: 30px; /* Augmenter l'espace sous le spinner */
}

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

#splash-screen p {
    font-size: 1.5em; /* Texte un peu plus grand */
    color: #555; /* Couleur du texte un peu plus douce */
    font-family: 'Arial', sans-serif; /* S'assurer de la police */
    margin: 0;
}

#cdsCode {
  font-size: 6em;
  color: #2c3e50;
  text-align: center;
  font-family: 'Roboto', sans-serif;
  font-weight: bold;
  letter-spacing: 1px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Police pour les valeurs
.kpi-block p, #datetimeDisplay, #cdsCode {
  font-family: 'Roboto Mono', monospace; /* Police monospace pour les chiffres 
}*/

/* État spécifique quand les deux snackbars sont visibles */
.snackbar.visible,
.snackbarAgent.visible {
  display: block !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Force l'affichage de la snackbar d'appels quand elle est en alerte */
.snackbar.snackbarAlert.visible {
  display: block !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: 1005 !important;
}

.snackbarAgent.snackbarAlert {
  background: #2196f3 !important;
  color: #fff !important;
}
.snackbarAgent.snackbarRed {
  background: #e53935 !important;
  color: #fff !important;
}
.kpi-yellow {
  background: #ffa033 !important;
  color: #fff !important;
}
.snackbar.snackbarAlert {
  background: #ffa033 !important;
  color: #fff !important;
}
.blinkAlert {
  animation: blinkBlue 1s infinite !important;
}
@keyframes blinkBlue {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}
.kpi-green {
  background: #28a745 !important;
  color: #fff !important;
}
.kpi-blue {
  background: #3f98e0 !important;
  color: #fff !important;
}

#cds {
  font-size: 4.2rem !important;
}

/* Bordure néon de progression de la journée - version sans halo, collée aux bords */
#progress-neon-border {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}
#progress-neon-border svg {
  width: 100vw;
  height: 100vh;
  display: block;
}
.neon-stroke {
  fill: none;
  stroke: url(#neon-gradient);
  stroke-width: 8px;
  filter: none;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  transition: stroke-width 0.35s cubic-bezier(0.4,0,0.2,1);
}

body.dark-mode {
  --bg-color: #181c24;
  --block-bg: #232837;
  --text-color: #f5f6fa;
  --icon-color: #7fd7ff;
  --shadow-color: rgba(0,0,0,0.7);
  --datetime-bg: #232837;
}
body.dark-mode .kpi-block {
  background: var(--block-bg);
  box-shadow: 0 6px 12px var(--shadow-color);
}
body.dark-mode .kpi-block h2,
body.dark-mode .kpi-block p,
body.dark-mode #datetimeDisplay {
  color: var(--text-color);
}
body.dark-mode .datetime-container {
  background: var(--datetime-bg);
  box-shadow: 0 6px 12px var(--shadow-color);
}
body.dark-mode #progress-neon-border {
  /* La bordure néon reste inchangée */
}
body.dark-mode .snackbar,
body.dark-mode .snackbarAgent {
  /* Snackbars inchangés */
}
body.dark-mode .agent-item.connected,
body.dark-mode .agent-item.oncall,
body.dark-mode .agent-item.reinforcement {
  /* Couleurs agents inchangées */
}
body.dark-mode .agent-initial,
body.dark-mode .agent-photo {
  /* Avatar inchangé */
}
body.dark-mode {
  background: linear-gradient(135deg, #181c24 0%, #232837 100%) !important;
}
body.dark-mode .main-container {
  background: transparent !important;
}
body.dark-mode .stats-grid {
  background: transparent !important;
}
body.dark-mode .agents-scroll-container {
  background: transparent !important;
  /* Optionnel : effet glassmorphism moderne */
  /* backdrop-filter: blur(4px) saturate(120%);
     background: rgba(35, 40, 55, 0.7) !important; */
  border-radius: 18px;
  box-shadow: none;
}
body.dark-mode .agents-container {
  background: transparent !important;
  /* Optionnel : effet glassmorphism moderne */
  /* backdrop-filter: blur(4px) saturate(120%);
     background: rgba(35, 40, 55, 0.7) !important; */
  border-radius: 18px;
  box-shadow: none;
}
body.dark-mode .datetime-container {
  background: var(--datetime-bg) !important;
}
body.dark-mode #cdsCode {
  background: var(--block-bg) !important;
  color: var(--text-color) !important;
}
body, .main-container, .kpi-block, .datetime-container {
  transition: background 0.5s, color 0.5s;
}

.agent-item {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s cubic-bezier(0.4,0,0.2,1), transform 0.4s cubic-bezier(0.4,0,0.2,1);
}
.agent-item.agent-enter {
  opacity: 0;
  transform: translateY(30px);
}
.agent-item.agent-enter-active {
  opacity: 1;
  transform: translateY(0);
}
.agent-item.agent-exit {
  opacity: 1;
  transform: translateY(0);
}
.agent-item.agent-exit-active {
  opacity: 0;
  transform: translateY(-30px);
}
.kpi-waiting-zero {
  background: #232837 !important;
}
.kpi-waiting-zero p {
  color: #ffa033 !important;
}
.kpi-waiting-zero h2 {
  color: #fff !important;
}
.kpi-waiting-active, .snackbarWaitingActive {
  animation: blinkOrangeWhite 1s infinite !important;
  background: #ffa033 !important;
  color: #fff !important;
}
.kpi-waiting-active p, .snackbarWaitingActive {
  color: #fff !important;
  transition: color 0.2s;
}
@keyframes blinkOrangeWhite {
  0%, 100% { background: #ffa033; color: #fff; }
  50% { background: #fff; color: #ffa033; }
}