/* Reset et styles globaux pour CSS2D */
.css2dLabel {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

/* Container parent du nametag - FORCER la transparence */
.sandbox-nametag,
.sandbox-nametag > *,
.sandbox-nametag:before,
.sandbox-nametag:after {
  background-color: transparent !important;
  background: transparent !important;
}

/* Styles pour les nametags SandBox */
.sandbox-nametag {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  transition: all 0.2s ease; 
  white-space: nowrap;
  transform-origin: center bottom;
  /* PAS de fond par défaut */
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
  backdrop-filter: none !important;
  /* Empêcher le texte d'être coupé */
  overflow: visible !important;
}

/* Style par défaut - FORCER aucun fond */
.sandbox-nametag:not(.has-chat) {
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
  backdrop-filter: none !important;
  border-radius: 0 !important;
  overflow: visible !important;
}

/* Style quand il y a un message de chat - Bulle violette comme l'image */
.sandbox-nametag.has-chat {
  padding: 12px 18px !important;
  background: #2f044797 !important;
  backdrop-filter: none !important;
  border: 2px solid #6170fd  !important;
  max-width: 500px;
  position: relative;
  overflow: visible;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

/* Suppression de l'effet de brillance pour correspondre à l'image */

/* Flèche pointant vers le bas - pointe triangulaire violette */
.sandbox-nametag.has-chat:after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #6366f1;
  background: transparent !important;
  z-index: 10;
}

/* Photo de profil - cachée par défaut */
.sandbox-nametag-picture {
  display: none !important;
}

/* Icône speaker à gauche dans un carré - style image de référence */
/* Photo de profil - style simple */
.sandbox-nametag.has-chat .sandbox-nametag-picture {
  display: block !important;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Container pour le texte */
.sandbox-nametag-username-chat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

/* Container pour le texte avec chat - disposition horizontale */
.sandbox-nametag.has-chat .sandbox-nametag-username-chat {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

/* Style du nom d'utilisateur - Style HUD */
.sandbox-nametag-username {
  color: white;
  font-size: 28px;  
  font-weight: 800; 
  text-shadow: 1px 1px 0px rgba(0, 0, 0, 1);
  line-height: 1.2;
  word-break: break-word;
  text-align: center;
  font-family: 'Oswald', 'Arial Black', Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Style du message de chat - Style bulle violette */
.sandbox-nametag-chat {
  color: white;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.3;
  word-break: break-word;
  margin-top: 0px;
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  text-shadow: none;
  letter-spacing: 0px;
}

/* Message de chat caché par défaut */
.sandbox-nametag:not(.has-chat) .sandbox-nametag-chat {
  display: none !important;
}

/* Animation de transition - Améliorée */
.sandbox-nametag {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

/* Animation d'apparition du nametag */
.sandbox-nametag {
  animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Suppression de l'animation de pulsation */

/* Responsive - RÉDUIT pour mobile */
@media (max-width: 768px) {
  /* RÉDUCTION GLOBALE des nametags sur mobile */
  .sandbox-nametag {
    transform: scale(0.7) !important; /* Réduction de 30% */
    transform-origin: center bottom !important;
  }
  
  .sandbox-nametag-username {
    font-size: 20px; /* Réduit encore plus */
  }
  
  .sandbox-nametag-chat {
    font-size: 16px; /* Réduit encore plus */
  }
  
  .sandbox-nametag.has-chat .sandbox-nametag-picture {
    width: 24px; /* Plus petit */
    height: 24px;
  }
  
  .sandbox-nametag.has-chat {
    padding: 8px 12px !important; /* Moins de padding */
    max-width: 300px; /* Plus étroit */
  }
}

/* Style spécial pour très petits écrans - ENCORE PLUS RÉDUIT */
@media (max-width: 480px) {
  /* RÉDUCTION ENCORE PLUS IMPORTANTE pour petits écrans */
  .sandbox-nametag {
    transform: scale(0.6) !important; /* Réduction de 40% */
    transform-origin: center bottom !important;
  }
  
  .sandbox-nametag-username {
    font-size: 18px; /* Encore plus petit */
    letter-spacing: 0.5px;
  }
  
  .sandbox-nametag-chat {
    font-size: 14px; /* Encore plus petit */
  }
  
  .sandbox-nametag.has-chat {
    padding: 6px 10px !important; /* Encore moins de padding */
    max-width: 280px; /* Plus étroit pour petit écran */
  }
  
  .sandbox-nametag.has-chat .sandbox-nametag-picture {
    width: 20px; /* Plus petit */
    height: 20px;
  }
}

/* Style pour cacher COMPLETEMENT le nametag du joueur local */
.sandbox-nametag.is-local-player {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* Classe pour cacher les nametags trop proches de la caméra */
.sandbox-nametag.too-close {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Classe spéciale pour les éléments cachés définitivement */
.hidden-local-player-nametag {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  position: absolute !important;
  left: -99999px !important;
  top: -99999px !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  z-index: -9999 !important;
}

/* Forcer la transparence sur TOUS les divs parents */
div:has(.sandbox-nametag:not(.has-chat)) {
  background: transparent !important;
  background-color: transparent !important;
  backdrop-filter: none !important;
}

/* MODE PAYSAGE MOBILE - Nametags TRÈS RÉDUITS */
@media screen and (max-width: 1024px) and (max-height: 600px) and (orientation: landscape) {
  /* RÉDUCTION MAXIMALE en mode paysage */
  .sandbox-nametag {
    transform: scale(0.5) !important; /* Réduction de 50% */
    transform-origin: center bottom !important;
  }
  
  .sandbox-nametag-username {
    font-size: 16px; /* Très petit */
    letter-spacing: 0px;
  }
  
  .sandbox-nametag-chat {
    font-size: 12px; /* Très petit */
    line-height: 1.2;
  }
  
  .sandbox-nametag.has-chat {
    padding: 4px 8px !important; /* Padding minimal */
    max-width: 200px; /* Très étroit */
    gap: 6px !important;
  }
  
  .sandbox-nametag.has-chat .sandbox-nametag-picture {
    width: 18px; /* Très petit */
    height: 18px;
  }
  
  /* Flèche plus petite en mode paysage */
  .sandbox-nametag.has-chat:after {
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #6366f1;
    bottom: -6px;
  }
}

/* MODE PAYSAGE TRÈS PETIT - Ultra réduit */
@media screen and (max-width: 768px) and (max-height: 500px) and (orientation: landscape) {
  .sandbox-nametag {
    transform: scale(0.4) !important; /* Réduction de 60% */
    transform-origin: center bottom !important;
  }
  
  .sandbox-nametag-username {
    font-size: 14px; /* Ultra petit */
  }
  
  .sandbox-nametag-chat {
    font-size: 10px; /* Ultra petit */
  }
  
  .sandbox-nametag.has-chat {
    padding: 3px 6px !important; /* Padding ultra minimal */
    max-width: 150px; /* Ultra étroit */
  }
  
  .sandbox-nametag.has-chat .sandbox-nametag-picture {
    width: 16px; /* Ultra petit */
    height: 16px;
  }
} 