/* ==========================================================
   Pokédex Clássica - Estilos
   CSS puro, sem frameworks. Layout responsivo com Grid/Flexbox.
   ========================================================== */

/* ---------- Variáveis de cor (paleta inspirada na Pokédex) ---------- */
:root {
  --vermelho: #e3350d;
  --vermelho-escuro: #b3200a;
  --amarelo: #ffcb05;
  --azul: #2a75bb;
  --azul-escuro: #1d2c5e;
  --fundo: #f4f6fb;
  --branco: #ffffff;
  --texto: #1f2430;
  --texto-suave: #5b6275;
  --borda: #e1e5ee;
  --sombra: 0 6px 18px rgba(29, 44, 94, 0.12);
  --raio: 16px;
  --fonte-retro: "Press Start 2P", monospace;
  --fonte-texto: "Nunito", system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--fonte-texto);
  background: var(--fundo);
  color: var(--texto);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--azul);
}

/* ---------- Botões ---------- */
.botao {
  font-family: var(--fonte-texto);
  font-weight: 800;
  font-size: 1rem;
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1.6rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.botao:hover {
  transform: translateY(-2px);
}

.botao--primario {
  background: var(--amarelo);
  color: var(--azul-escuro);
  box-shadow: 0 4px 0 #c7a008;
}

.botao--favoritos {
  background: var(--branco);
  color: var(--vermelho);
  border: 2px solid var(--vermelho);
}

.botao--favoritos[aria-pressed="true"] {
  background: var(--vermelho);
  color: var(--branco);
}

/* ---------- Cabeçalho ---------- */
.topo {
  background: var(--vermelho);
  border-bottom: 6px solid var(--azul-escuro);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topo__conteudo {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--branco);
  text-decoration: none;
  font-family: var(--fonte-retro);
  font-size: 0.8rem;
}

.logo strong {
  color: var(--amarelo);
  margin-left: 0.3rem;
}

.logo__icone {
  width: 34px;
  height: 34px;
}

.menu {
  display: flex;
  gap: 1.2rem;
}

.menu a {
  color: var(--branco);
  text-decoration: none;
  font-weight: 700;
}

.menu a:hover {
  color: var(--amarelo);
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--azul-escuro), var(--azul));
  color: var(--branco);
  padding: 4rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.hero__texto {
  max-width: 560px;
}

.hero__selo {
  display: inline-block;
  background: var(--amarelo);
  color: var(--azul-escuro);
  font-weight: 800;
  padding: 0.2rem 0.8rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.hero h1 {
  font-family: var(--fonte-retro);
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  line-height: 1.4;
  color: var(--amarelo);
  text-shadow: 3px 3px 0 var(--azul-escuro);
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.1rem;
  margin-bottom: 1.6rem;
}

.hero__pokebola {
  width: clamp(140px, 22vw, 240px);
  animation: balancar 2.5s ease-in-out infinite;
}

@keyframes balancar {
  0%, 100% { transform: rotate(-12deg); }
  50% { transform: rotate(12deg); }
}

/* ---------- Títulos das seções ---------- */
.titulo-secao {
  font-family: var(--fonte-retro);
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  line-height: 1.5;
  text-align: center;
  color: var(--azul-escuro);
  margin-bottom: 2rem;
}

/* ---------- História ---------- */
.historia {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 1rem;
}

.historia__grade {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.info {
  background: var(--branco);
  border-radius: var(--raio);
  padding: 1.5rem;
  box-shadow: var(--sombra);
  border-top: 6px solid var(--amarelo);
}

.info__numero {
  font-family: var(--fonte-retro);
  color: var(--vermelho);
  font-size: 1.1rem;
}

.info h3 {
  margin: 0.6rem 0 0.4rem;
  color: var(--azul-escuro);
}

.info p {
  color: var(--texto-suave);
}

/* ---------- Pokédex (área dos cards) ---------- */
.pokedex {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.pokedex__subtitulo {
  text-align: center;
  color: var(--texto-suave);
  margin: -1.2rem 0 2rem;
}

.controles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.controles__busca,
.controles__select {
  font-family: var(--fonte-texto);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--borda);
  border-radius: 999px;
  background: var(--branco);
  color: var(--texto);
}

.controles__busca {
  flex: 1 1 260px;
  max-width: 420px;
}

.controles__busca:focus,
.controles__select:focus {
  outline: none;
  border-color: var(--azul);
}

.status {
  text-align: center;
  color: var(--texto-suave);
  font-weight: 700;
  min-height: 1.6rem;
  margin-bottom: 1rem;
}

.status--erro {
  color: var(--vermelho);
}

/* Spinner de carregamento em forma de Pokébola */
.carregando::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 0.5rem;
  vertical-align: -3px;
  border-radius: 50%;
  border: 3px solid var(--azul-escuro);
  background: linear-gradient(var(--vermelho) 50%, var(--branco) 50%);
  animation: girar 0.8s linear infinite;
}

@keyframes girar {
  to { transform: rotate(360deg); }
}

/* Grade responsiva dos cards */
.lista-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.5rem;
}

/* ---------- Card do personagem ---------- */
.card {
  position: relative;
  background: var(--branco);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 1.2rem;
  box-shadow: var(--sombra);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: surgir 0.35s ease-out;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 26px rgba(29, 44, 94, 0.2);
}

@keyframes surgir {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.card__numero {
  position: absolute;
  top: 0.9rem;
  left: 1rem;
  font-family: var(--fonte-retro);
  font-size: 0.6rem;
  color: var(--texto-suave);
}

.card__favorito {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--vermelho);
  cursor: pointer;
  transition: transform 0.15s;
}

.card__favorito:hover {
  transform: scale(1.2);
}

.card__nome {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--azul-escuro);
  margin: 1.4rem 0 0.6rem;
}

.card__imagem {
  width: 150px;
  height: 150px;
  object-fit: contain;
  background: radial-gradient(circle, #eef1f8 60%, transparent 61%);
  border-radius: 12px;
  margin-bottom: 0.8rem;
}

.card__tipos {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.tipo {
  color: var(--branco);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: #888;
}

.card__info {
  list-style: none;
  width: 100%;
  font-size: 0.9rem;
  color: var(--texto-suave);
  text-align: left;
}

.card__info li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0;
  border-bottom: 1px dashed var(--borda);
}

.card__info strong {
  color: var(--texto);
}

/* Barras de atributos (HP, Ataque, Defesa) */
.stat {
  display: grid;
  grid-template-columns: 58px 30px 1fr;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  font-size: 0.8rem;
  margin-top: 0.4rem;
}

.stat__nome {
  font-weight: 700;
  text-align: left;
}

.stat__barra {
  height: 8px;
  background: var(--borda);
  border-radius: 999px;
  overflow: hidden;
}

.stat__preenchimento {
  height: 100%;
  background: var(--azul);
  border-radius: 999px;
}

/* Cores dos tipos */
.tipo--normal { background: #a8a77a; }
.tipo--fire { background: #ee8130; }
.tipo--water { background: #6390f0; }
.tipo--electric { background: #d9b400; }
.tipo--grass { background: #5fa83a; }
.tipo--ice { background: #6fc7c2; }
.tipo--fighting { background: #c22e28; }
.tipo--poison { background: #a33ea1; }
.tipo--ground { background: #c9a94f; }
.tipo--flying { background: #8f7be0; }
.tipo--psychic { background: #f95587; }
.tipo--bug { background: #94a51a; }
.tipo--rock { background: #b6a136; }
.tipo--ghost { background: #735797; }
.tipo--dragon { background: #6f35fc; }
.tipo--dark { background: #705746; }
.tipo--steel { background: #8e8ea8; }
.tipo--fairy { background: #d685ad; }

.carregar-mais {
  text-align: center;
  margin-top: 2.5rem;
}

/* ---------- Rodapé ---------- */
.rodape {
  background: var(--azul-escuro);
  color: #c9d2ee;
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

.rodape a {
  color: var(--amarelo);
}

/* ---------- Responsividade ---------- */
@media (max-width: 600px) {
  .topo__conteudo {
    justify-content: center;
  }

  .hero {
    padding: 2.5rem 1rem;
    text-align: center;
    gap: 1.5rem;
  }

  .hero__imagem {
    order: -1;
  }

  .controles__busca,
  .controles__select,
  .botao--favoritos {
    flex: 1 1 100%;
    max-width: none;
  }
}
