/* ========================================
   UI - Interface utilisateur
   ======================================== */

/* Leaderboard */
.leaderboard {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.leaderboard h3 {
  color: #ffd700;
  margin-bottom: 10px;
  text-align: center;
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-item {
  background: rgba(255, 255, 255, 0.05);
  border-left: 4px solid #667eea;
  padding: 12px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.player-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.player-item.dead {
  opacity: 0.5;
  border-left-color: #e74c3c;
}

.player-item.you {
  border-left-color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
}

.player-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-name {
  color: white;
  font-weight: bold;
  font-size: 14px;
}

.player-status {
  color: #aaa;
  font-size: 12px;
}

.player-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
}

.player-health {
  color: #e74c3c;
  font-size: 14px;
  font-weight: bold;
}

.player-wave {
  color: #3498db;
  font-size: 12px;
}

/* Waves */
.waves-info {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 10px;
}

.wave-display {
  background: rgba(255, 215, 0, 0.1);
  border: 2px solid #ffd700;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.wave-display h4 {
  color: #ffd700;
  font-size: 14px;
  margin-bottom: 8px;
}

.wave-number {
  font-size: 24px;
  color: white;
  font-weight: bold;
}

.wave-enemies {
  color: #aaa;
  font-size: 12px;
  margin-top: 5px;
}

.wave-countdown {
  background: rgba(52, 152, 219, 0.2);
  border: 2px solid #3498db;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  margin-top: 10px;
}

.countdown-text {
  color: #3498db;
  font-size: 12px;
  margin-bottom: 4px;
}

.countdown-value {
  color: white;
  font-size: 20px;
  font-weight: bold;
}

/* Boutons */
.btn-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn {
  padding: 10px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: white;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.btn-research {
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.btn-research:hover {
  background: linear-gradient(135deg, #af7ac5 0%, #9b59b6 100%);
}

.btn-towers {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.btn-towers:hover {
  background: linear-gradient(135deg, #5dade2 0%, #3498db 100%);
}

.btn-icon {
  font-size: 16px;
}

/* Toast notifications */
#toast-container {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 6px 12px;
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  min-width: 120px;
  max-width: 220px;
  animation: slideIn 0.2s ease-out;
  font-size: 12px;
  line-height: 1.2;
  margin-right: 2px;
}

.toast.info { border-left: 4px solid #3498db; }
.toast.success { border-left: 4px solid #27ae60; }
.toast.warning { border-left: 4px solid #f39c12; }
.toast.error { border-left: 4px solid #e74c3c; }

/* Game Over */
#game-over-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(10px);
  z-index: 3000;
  justify-content: center;
  align-items: center;
}

#game-over-modal:not(.hidden) {
  display: flex;
}

#game-over-modal .modal-content {
  background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
  padding: 50px 60px;
  border-radius: 20px;
  text-align: center;
  border: 4px solid #667eea;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.9), 0 0 50px rgba(102, 126, 234, 0.4);
  max-width: 600px;
  width: 90%;
  position: relative;
  animation: gameOverSlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes gameOverSlideIn {
  from {
    opacity: 0;
    transform: scale(0.7) translateY(-50px) rotate(-5deg);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0) rotate(0);
  }
}

#game-over-modal .modal-content::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #667eea, #764ba2, #f093fb, #4facfe);
  background-size: 400% 400%;
  border-radius: 20px;
  z-index: -1;
  opacity: 0.3;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

#game-over-modal h2 {
  color: #ffd700;
  font-size: 3.5em;
  margin: 0 0 25px 0;
  text-shadow: 0 4px 20px rgba(255, 215, 0, 0.6), 0 0 40px rgba(255, 215, 0, 0.4);
  font-weight: bold;
  letter-spacing: 2px;
  animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

#game-over-message {
  color: #ecf0f1;
  font-size: 1.6em;
  margin: 20px 0;
  font-weight: 500;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  line-height: 1.4;
}

#final-stats {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(102, 126, 234, 0.4);
  border-radius: 15px;
  padding: 25px;
  margin: 30px 0;
  color: white;
  font-size: 1.2em;
}

#final-stats div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  margin: 8px 0;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 8px;
  transition: all 0.3s ease;
}

#final-stats div:hover {
  background: rgba(102, 126, 234, 0.2);
  transform: translateX(5px);
}

#final-stats strong {
  color: #ffd700;
  font-size: 1.1em;
  text-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

#game-over-modal .btn-primary {
  padding: 18px 50px !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  border: none !important;
  border-radius: 12px !important;
  font-size: 1.3em !important;
  font-weight: bold !important;
  cursor: pointer !important;
  transition: all 0.4s ease !important;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4) !important;
  margin-top: 30px !important;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#game-over-modal .btn-primary:hover {
  background: linear-gradient(135deg, #7889ef 0%, #8e5cb8 100%) !important;
  transform: translateY(-3px) scale(1.05) !important;
  box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6) !important;
}

#game-over-modal .btn-primary:active {
  transform: translateY(-1px) scale(1.02) !important;
}

/* Confetti animation pour victoire */
#game-over-modal.victory h2 {
  color: #2ecc71;
  text-shadow: 0 4px 20px rgba(46, 204, 113, 0.6), 0 0 40px rgba(46, 204, 113, 0.4);
}

#game-over-modal.victory .modal-content {
  border-color: #2ecc71;
}

/* Defeat styling */
#game-over-modal.defeat h2 {
  color: #e74c3c;
  text-shadow: 0 4px 20px rgba(231, 76, 60, 0.6), 0 0 40px rgba(231, 76, 60, 0.4);
}

#game-over-modal.defeat .modal-content {
  border-color: #e74c3c;
}

.game-over-content {
  background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  border: 3px solid #667eea;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
}

.game-over-content h2 {
  color: #ffd700;
  font-size: 48px;
  margin-bottom: 20px;
}

.game-over-content p {
  color: white;
  font-size: 24px;
  margin-bottom: 30px;
}

.game-over-content button {
  padding: 15px 40px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}

.game-over-content button:hover {
  background: #5568d3;
}
