* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  background-color: #eef2f7;
  font-family: "Segoe UI", sans-serif;
}

header {
  text-align: center;
  color: #6b7280;
  margin-top: 20px;
}

header h1 {
  font-size: 56px;
  margin-bottom: 10px;
  color: #1f2937;
}

.search-container {
  margin: auto;
  max-width: 400px;
  padding: 0 10px;
}

.search-bar {
  border-radius: 8px;
  margin-top: 20px;
  margin-bottom: 20px;
  border: #d1d5db;
  padding: 10px;
  width: 100%;
  max-width: 400px;
}

/* ===== GRID ===== */
#pokemon-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== CARDS ===== */
.card {
  background: white;
  border-radius: 16px;
  padding: 24px 16px 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.card img {
  width: 100px;
  height: 100px;
  margin-bottom: 12px;
}

.card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: #1a1a2e;
}

/* ===== TYPE BADGES ===== */
.badges {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: white;
}

/* Couleurs de badge par type de Pokémon */
.badge.fire {
  background: #bb540a;
}
.badge.water {
  background: #2e69c8;
}
.badge.grass {
  background: #38764e;
}
.badge.poison {
  background: #702cb1;
}
.badge.electric {
  background: #a16207;
}
.badge.psychic {
  background: #ec4899;
}
.badge.ice {
  background: #0891b2;
}
.badge.dragon {
  background: #6366f1;
}
.badge.dark {
  background: #374151;
}
.badge.fairy {
  background: #be185d;
}
.badge.normal {
  background: #454545;
}
.badge.fighting {
  background: #b45309;
}
.badge.flying {
  background: #0369a1;
}
.badge.ground {
  background: #7f5729;
}
.badge.rock {
  background: #78716c;
}
.badge.bug {
  background: #84cc16;
}
.badge.ghost {
  background: #7c3aed;
}
.badge.steel {
  background: #94a3b8;
}

/* ===== PAGINATION ===== */
#pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 30px 5px 40px;
}

#pagination button {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: white;
  color: #1a1a2e;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

#pagination button:hover {
  background: #6366f1;
  color: white;
}

#pagination button.active {
  background: #3d3f95;
  color: white;
}

#pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== DETAIL VIEW ===== */
#detail-view {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

#back-btn {
  background: none;
  border: none;
  color: #155dfc;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#back-btn:hover {
  text-decoration: underline;
}

.detail-card {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.detail-card h2 {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 20px;
}

/* Sprites face/dos */
.sprites {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 16px;
}

.sprites div {
  text-align: center;
}

.sprites img {
  width: 90px;
  height: 90px;
  image-rendering: pixelated;
}

.sprites p {
  font-size: 0.85rem;
  color: black;
  margin-top: 4px;
}

/* Infos physiques */
.physical {
  display: flex;
  gap: 16px;
  margin: 20px 0;
}

.physical div {
  flex: 1;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 14px;
}

.physical span.label {
  font-size: 0.8rem;
  color: #59677a;
  display: block;
  margin-bottom: 4px;
}

.physical span.value {
  font-size: 1rem;
  font-weight: 700;
}

/* Stats */
.stats h3,
.abilities-section h3,
.evolution h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 24px 0 16px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.stat-name {
  font-size: 0.85rem;
  color: #555;
  width: 120px;
  flex-shrink: 0;
}

.stat-bar-bg {
  flex: 1;
  background: #e2e8f0;
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
}

.stat-bar {
  height: 100%;
  border-radius: 10px;
  background: #155dfc;
  transition: width 0.6s ease;
}

.stat-value {
  font-size: 0.85rem;
  font-weight: 700;
  width: 30px;
  text-align: right;
}

/* Capacités */
.ability-badge {
  display: inline-block;
  background: #f3e8ff;
  color: #7e22ce;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-right: 8px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
}

.ability-badge.is-hidden {
  color: #7e22ce;
}

/* Chaîne d'évolution */
.evo-chain {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.evo-name {
  padding: 8px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  background: #f1f5f9;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.evo-name:focus-visible {
  outline: 3px solid #1518d8;
}

.evo-name.current {
  background: #155dfc;
  color: white;
}

.evo-arrow {
  color: #454545;
  font-size: 1.2rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  #pokemon-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  #pokemon-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  header h1 {
    font-size: 2rem;
  }
  .evo-chain {
    flex-direction: column;
  }
}

@media (max-width: 380px) {
  #pokemon-grid {
    grid-template-columns: 1fr;
  }
  .evo-chain {
    flex-direction: column;
  }
}
