/* ===========================================================================
 * MENU.CSS - Navigation de l'application Pokémon Battle Tracker
 * ===========================================================================
 */

/* =============================================================================
 * VARIABLES GLOBALES
 * =============================================================================
 */
:root {
  /* Variables spécifiques au menu */
  --sidebar-width: 260px;
  --sidebar-header-height: 60px;
  --menu-item-height: 40px;
  --menu-toggle-size: 40px;
  --menu-transition-speed: 0.3s;
  
  /* Couleurs du header (toujours en bleu) */
  --header-bg-start: #3a57e8;
  --header-bg-end: #2a47d8;
}

/* =============================================================================
 * STRUCTURE DE BASE DU SIDEBAR
 * =============================================================================
 */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--dark-bg, #1a1c2e);
  color: var(--text-light);
  overflow-y: auto;
  z-index: 1000;
  transition: transform var(--menu-transition-speed) ease;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
  
  /* Fond avec image Pokémon */
  background-image: 
    linear-gradient(125deg, rgba(26, 28, 46, 0.97) 0%, rgba(30, 33, 58, 0.97) 100%),
    url('https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/149.png');
  background-size: cover;
  background-position: center 80%;
  background-blend-mode: overlay;
  background-attachment: fixed;
}

/* =============================================================================
 * HEADER DU SIDEBAR
 * =============================================================================
 */
.sidebar-header {
  /* Toujours garder le dégradé bleu */
  background: linear-gradient(90deg, var(--header-bg-start) 0%, var(--header-bg-end) 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  padding: 0 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--sidebar-header-height);
}

.logo {
  color: var(--text-light);
  text-decoration: none;
  font-weight: bold;
  font-size: 1.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.close-sidebar {
  display: none;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
  transition: background-color 0.2s;
  border-radius: 4px;
}

.close-sidebar:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* =============================================================================
 * ZONE DE NAVIGATION
 * =============================================================================
 */
.sidebar-menu {
  padding: 15px;
}

/* Catégories de menu */
.menu-category {
  margin-bottom: 20px;
}

.category-header {
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.category-header i {
  margin-right: 10px;
}

.category-items {
  padding-left: 5px;
}

/* Éléments de menu (liens) */
.menu-item {
  display: flex;
  align-items: center;
  padding: 10px;
  color: var(--text-light);
  text-decoration: none;
  margin-bottom: 5px;
  border-radius: 4px;
  transition: all 0.2s;
  height: var(--menu-item-height);
}

.menu-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.menu-item.active {
  background-color: rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--primary-color, var(--header-bg-start));
  padding-left: 7px;
}

.menu-item i {
  margin-right: 10px;
  width: 20px;
  text-align: center;
}

.menu-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =============================================================================
 * COMPOSANTS MOBILES
 * =============================================================================
 */
/* Bouton de menu hamburger */
.menu-toggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 200;
  background-color: var(--header-bg-start);
  color: white;
  border: none;
  border-radius: 5px;
  width: var(--menu-toggle-size);
  height: var(--menu-toggle-size);
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s;
}

.menu-toggle:hover {
  background-color: var(--primary-light, #4a67f8);
}

.menu-toggle:active {
  background-color: var(--header-bg-end);
}

/* Overlay semi-transparent */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.overlay.active {
  display: block;
  opacity: 1;
}

/* =============================================================================
 * THÈMES PAR PAGE
 * =============================================================================
 */
/* Page Pokédex - Mewtwo */
body.pokedex-page .sidebar {
  background-image: 
    linear-gradient(125deg, rgba(26, 28, 46, 0.97) 0%, rgba(30, 33, 58, 0.97) 100%),
    url('https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/150.png');
}

/* Page Combats - Dracaufeu */
body.battles-page .sidebar {
  background-image: 
    linear-gradient(125deg, rgba(26, 28, 46, 0.97) 0%, rgba(30, 33, 58, 0.97) 100%),
    url('https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/6.png');
}

/* Page Centre Pokémon - Leveinard */
body.center-page .sidebar {
  background-image: 
    linear-gradient(125deg, rgba(26, 28, 46, 0.97) 0%, rgba(30, 33, 58, 0.97) 100%),
    url('https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/113.png');
}

/* Page Arènes - Pikachu */
body.arena-page .sidebar {
  background-image: 
    linear-gradient(125deg, rgba(26, 28, 46, 0.97) 0%, rgba(30, 33, 58, 0.97) 100%),
    url('https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/25.png');
}

/* =============================================================================
 * RESPONSIVE
 * =============================================================================
 */
@media screen and (max-width: 992px) {
  /* Sur mobile, cacher le sidebar par défaut */
  .sidebar {
    transform: translateX(-100%);
    z-index: 1001;
  }
  
  /* Quand le sidebar est ouvert */
  .sidebar.open, 
  .sidebar.active {
    transform: translateX(0);
  }
  
  /* Afficher les contrôles mobiles */
  .close-sidebar,
  .menu-toggle {
    display: block;
  }
  
  /* Le menu-toggle doit être en flex pour centrer l'icône */
  .menu-toggle {
    display: flex;
  }
}

/* Adaptation du logo selon la taille d'écran */
@media screen and (max-width: 768px) {
  .logo {
    font-size: 1.1rem;
  }
}

@media screen and (max-width: 480px) {
  .logo {
    font-size: 0.9rem;
  }
  
  .sidebar-header {
    padding: 0 10px;
  }
}

/* Préférence pour la réduction de mouvement */
@media (prefers-reduced-motion: reduce) {
  .sidebar, 
  .overlay {
    transition: none;
  }
}