@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Rajdhani:wght@300;400;500;600;700&display=swap');

:root {
  --primary-bg: #1a1a1a;
  --secondary-bg: #2d2d2d;
  --panel-bg: rgba(30, 30, 40, 0.95);
  --accent-purple: #a855f7;
  --accent-purple-light: #c084fc;
  --accent-dark: #7c3aed;
  --text-primary: #ffffff;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --border-color: #4b5563;
  --hover-bg: rgba(139, 92, 246, 0.1);

  /* Palette unifiée des équipes (1 à 20) */
  --team-1:  #10b981; /* emerald */
  --team-2:  #3b82f6; /* blue */
  --team-3:  #f59e0b; /* amber */
  --team-4:  #ec4899; /* pink */
  --team-5:  #06b6d4; /* cyan */
  --team-6:  #ef4444; /* red */
  --team-7:  #8b5cf6; /* violet */
  --team-8:  #22c55e; /* green */
  --team-9:  #eab308; /* yellow */
  --team-10: #14b8a6; /* teal */
  --team-11: #f97316; /* orange */
  --team-12: #a855f7; /* purple */
  --team-13: #0ea5e9; /* sky */
  --team-14: #84cc16; /* lime */
  --team-15: #ef4444; /* red (alt) */
  --team-16: #f43f5e; /* rose */
  --team-17: #06d6a0; /* mint */
  --team-18: #ffd166; /* sand */
  --team-19: #118ab2; /* ocean */
  --team-20: #8338ec; /* grape */
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--primary-bg);
  color: var(--text-primary);
}

#map {
  width: 100vw;
  height: 100vh;
  background-color: #000;
  background-image: url('../assets/svg/background.svg');
  background-size: cover;
}

/* Panel principal à gauche */
#main-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  height: 100vh;
  background: var(--panel-bg);
  border-right: 2px solid var(--accent-purple);
  transform: translateX(-300px);
  transition: transform 0.3s ease;
  z-index: 1000;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

#main-panel.open {
  transform: translateX(0);
}

#main-panel:hover {
  transform: translateX(0);
}

.panel-toggle {
  position: absolute;
  right: -42px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 80px;
  background: var(--accent-purple);
  border: none;
  border-radius: 0 8px 8px 0;
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
  z-index: 3; /* au-dessus du contenu scrollable */
}

.panel-toggle:hover {
  background: var(--accent-purple-light);
  transform: translateY(-50%) translateX(3px);
}

#main-panel:not(.open):not(:hover) .panel-toggle {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: translateY(-50%);
  }
  50% {
    transform: translateY(-50%) translateX(2px);
  }
}

.panel-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(168, 85, 247, 0.2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.panel-header-content {
  position: relative;
  z-index: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Contenu scrollable du panel (à partir d'"Affichage Joueurs") */
#panel-scroll {
  flex: 1;            /* occupe l'espace restant et scrolle */
  overflow-y: auto;
  overflow-x: hidden;
}

.panel-title {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 4px 0;
  color: #ffffff;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.panel-subtitle {
  font-size: 13px;
  color: rgba(148, 163, 184, 0.9);
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.025em;
}

/* Amélioration des sections du panel */
.panel-section {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(75, 85, 99, 0.3);
  transition: all 0.2s ease;
}

.panel-section:hover {
  background: rgba(139, 92, 246, 0.02);
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-purple-light);
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
}

.section-title::before {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 30px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-purple), transparent);
  border-radius: 1px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.stat-item {
  background: var(--secondary-bg);
  padding: 10px;
  border-radius: 6px;
  border-left: 3px solid var(--accent-purple);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

/* Styles pour le statut de connexion */
.connection-status {
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  transition: background-color 0.3s ease;
}

.status-dot.connected {
  background: #10b981;
}

.status-dot.connecting {
  background: #f59e0b;
  animation: pulse 1.5s infinite;
}

.status-dot.detected {
  background: #3b82f6;
  animation: pulse 1.5s infinite;
}

.status-dot.warning {
  background: #f97316;
  animation: pulse 2s infinite;
}

.status-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.status-details {
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.8;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.control-group {
  margin-bottom: 12px;
}

.control-label {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.control-label:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.control-label input[type="checkbox"] {
  margin-right: 10px;
  accent-color: var(--accent-purple);
  transform: scale(1.1);
}

.players-list {
  max-height: 200px;
  overflow-y: auto;
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 4px;
  background: var(--secondary-bg);
  border-radius: 6px;
  border-left: 3px solid transparent;
}

.player-item.team-1 {  border-left-color: var(--team-1); }
.player-item.team-2 {  border-left-color: var(--team-2); }
.player-item.team-3 {  border-left-color: var(--team-3); }
.player-item.team-4 {  border-left-color: var(--team-4); }
.player-item.team-5 {  border-left-color: var(--team-5); }
.player-item.team-6 {  border-left-color: var(--team-6); }
.player-item.team-7 {  border-left-color: var(--team-7); }
.player-item.team-8 {  border-left-color: var(--team-8); }
.player-item.team-9 {  border-left-color: var(--team-9); }
.player-item.team-10 { border-left-color: var(--team-10); }
.player-item.team-11 { border-left-color: var(--team-11); }
.player-item.team-12 { border-left-color: var(--team-12); }
.player-item.team-13 { border-left-color: var(--team-13); }
.player-item.team-14 { border-left-color: var(--team-14); }
.player-item.team-15 { border-left-color: var(--team-15); }
.player-item.team-16 { border-left-color: var(--team-16); }
.player-item.team-17 { border-left-color: var(--team-17); }
.player-item.team-18 { border-left-color: var(--team-18); }
.player-item.team-19 { border-left-color: var(--team-19); }
.player-item.team-20 { border-left-color: var(--team-20); }

.player-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.player-info {
  font-size: 10px;
  color: var(--text-muted);
}

.spectator-count {
  background: var(--accent-purple);
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

/* Styles pour les marqueurs de joueurs (flèches) */
.player-arrow-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  pointer-events: none;
}

.player-arrow-marker.team-1  { color: var(--team-1); }
.player-arrow-marker.team-2  { color: var(--team-2); }
.player-arrow-marker.team-3  { color: var(--team-3); }
.player-arrow-marker.team-4  { color: var(--team-4); }
.player-arrow-marker.team-5  { color: var(--team-5); }
.player-arrow-marker.team-6  { color: var(--team-6); }
.player-arrow-marker.team-7  { color: var(--team-7); }
.player-arrow-marker.team-8  { color: var(--team-8); }
.player-arrow-marker.team-9  { color: var(--team-9); }
.player-arrow-marker.team-10 { color: var(--team-10); }
.player-arrow-marker.team-11 { color: var(--team-11); }
.player-arrow-marker.team-12 { color: var(--team-12); }
.player-arrow-marker.team-13 { color: var(--team-13); }
.player-arrow-marker.team-14 { color: var(--team-14); }
.player-arrow-marker.team-15 { color: var(--team-15); }
.player-arrow-marker.team-16 { color: var(--team-16); }
.player-arrow-marker.team-17 { color: var(--team-17); }
.player-arrow-marker.team-18 { color: var(--team-18); }
.player-arrow-marker.team-19 { color: var(--team-19); }
.player-arrow-marker.team-20 { color: var(--team-20); }

/* Status info modernisé */
.status-info {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--panel-bg);
  padding: 15px;
  border-radius: 8px;
  font-size: 12px;
  z-index: 1000;
  border: 1px solid var(--border-color);
  min-width: 200px;
}

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

.status-item:last-child {
  margin-bottom: 0;
}

.status-label {
  color: var(--text-muted);
}

.status-value {
  color: var(--accent-purple-light);
  font-weight: 600;
}

/* Scrollbar custom */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--secondary-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-purple);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-purple-light);
}

/* Styles pour les éléments de formulaire */
select, input[type="range"] {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
}

select {
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

select:hover, select:focus {
  border-color: var(--accent-purple);
  outline: none;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

select option {
  background: var(--secondary-bg);
  color: var(--text-primary);
  padding: 8px;
}

/* Styles pour les sliders (input range) */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--secondary-bg);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: background 0.3s ease;
  width: 100%;
}

input[type="range"]:hover {
  background: rgba(139, 92, 246, 0.1);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent-purple);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--accent-purple-light);
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(139, 92, 246, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent-purple);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb:hover {
  background: var(--accent-purple-light);
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(139, 92, 246, 0.4);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: var(--secondary-bg);
  border-radius: 3px;
  border: none;
}

/* Amélioration des contrôles existants */
.control-label {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin-bottom: 6px;
  position: relative;
}

.control-label:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
  transform: translateX(2px);
}

.control-label input[type="checkbox"] {
  /* Masquer la checkbox par défaut */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  
  /* Taille et position */
  width: 20px;
  height: 20px;
  margin-right: 12px;
  cursor: pointer;
  
  /* Style de base */
  background: var(--secondary-bg);
  border: 2px solid rgba(168, 85, 247, 0.3);
  border-radius: 6px;
  
  /* Transitions */
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Positionnement pour le checkmark */
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.control-label input[type="checkbox"]:hover {
  border-color: var(--accent-purple);
  background: rgba(168, 85, 247, 0.1);
  transform: scale(1.05);
}

.control-label input[type="checkbox"]:checked {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.3);
}

.control-label input[type="checkbox"]:checked:hover {
  background: var(--accent-purple-light);
  border-color: var(--accent-purple-light);
  transform: scale(1.05);
}

/* Checkmark (✓) */
.control-label input[type="checkbox"]:checked::before {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
}

.control-label input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

/* Styles pour les labels avec sliders */
.control-label.slider-label {
  flex-direction: column;
  align-items: flex-start;
  padding: 12px;
  background: rgba(139, 92, 246, 0.05);
  border: 1px solid rgba(139, 92, 246, 0.1);
}

.control-label.slider-label:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.2);
  transform: none;
}

.slider-info {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 6px;
}

.slider-value {
  color: var(--accent-purple-light);
  font-weight: 600;
  font-size: 12px;
}

/* Styles pour les marqueurs de joueurs */
.custom-marker {
  background: transparent !important;
  border: none !important;
}

/* Marqueur flèche principal (remplace le cercle) */
.player-arrow-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  pointer-events: none;
}

/* Couleurs par équipe pour les flèches */
.player-arrow-marker.team-1 { 
  color: #10b981; 
}
.player-arrow-marker.team-2 { 
  color: #3b82f6; 
}
.player-arrow-marker.team-3 { 
  color: #f59e0b; 
}
.player-arrow-marker.team-4 { 
  color: #ec4899; 
}
.player-arrow-marker.team-5 { 
  color: #06b6d4; 
}

/* Styles pour les tooltips */
.leaflet-tooltip {
  color: white !important;
  border: none !important;
  background: transparent !important;
  border-radius: 5px !important;
  background-color: #74747444 !important;
}

/* Overlay d'accès restreint (room-required) */
.locked-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.locked-overlay.hidden {
  display: none;
}

.locked-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-purple);
  border-radius: 10px;
  padding: 24px 28px;
  width: min(420px, 90vw);
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.locked-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.locked-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.locked-message {
  font-size: 13px;
  color: var(--text-secondary);
}
