@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;800&display=swap");

:root {
  --color-bg: #f0f3f8;
  --color-text: #2b2b33;
  --color-text-light: #6b6b6b;
  --color-accent: #ef5350;
  --max-width: 1440px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --side-padding: clamp(16px, 4vw, 32px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", system-ui, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

/* ===== Header ===== */

.siteHeader {
  background-color: var(--color-accent);
  color: white;
  padding: 16px var(--side-padding);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.headerInner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.logoIcon {
  width: 32px;
  height: 32px;
}

.logoText {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.searchBar {
  display: flex;
  gap: 8px;
}

.searchInput {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  min-width: 200px;
}

.searchButton {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  background-color: white;
  color: var(--color-accent);
  font-weight: 700;
  transition: opacity 0.15s;
}

.searchButton:hover {
  opacity: 0.85;
}

.searchButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Content / Grid ===== */

.content {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 32px var(--side-padding);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  flex: 1;
  align-content: start;
}

/* ===== Pokémon Card ===== */

.pokemonCard {
  border-radius: var(--radius-md);
  padding: 16px 18px;
  color: white;
  text-align: left;
  position: relative;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
}

.pokemonCard:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.pokemonCard:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

.pokemonNumber {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
}

.pokemonName {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.pokemonTypes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.typeBadge {
  background-color: rgba(255, 255, 255, 0.25);
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
}

.pokemonImage {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 100px;
  height: 100px;
  pointer-events: none;
}

/* ===== Not Found Message ===== */

.notFound {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--color-text-light);
  font-size: 1.1rem;
  padding: 40px 20px;
}

/* ===== Load More ===== */

.loadMoreWrapper {
  display: flex;
  justify-content: center;
  padding: 16px var(--side-padding) 48px;
}

.loadMoreButton {
  background-color: var(--color-accent);
  color: white;
  font-weight: 700;
  padding: 12px 32px;
  border-radius: 999px;
  font-size: 1rem;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  min-height: 48px;
}

.loadMoreButton:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 83, 80, 0.4);
}

.loadMoreButton:active {
  transform: translateY(0);
}

.loadMoreButton:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* ===== Loading Pokeball ===== */

.loadingSpinner {
  position: relative;
  height: 28px;
  width: 28px;
  background: linear-gradient(to bottom, rgb(254, 0, 1) 50%, white 50%);
  border-radius: 50%;
  border: 2px solid black;
  animation: spin 1s ease-in-out infinite alternate;
}

.loadingSpinner::before {
  content: '';
  position: absolute;
  height: 2px;
  width: 28px;
  background: black;
  top: 12px;
  left: -2px;
}

.loadingSpinner::after {
  content: '';
  position: absolute;
  height: 10px;
  width: 10px;
  border-radius: 50%;
  background: white;
  top: 14px;
  left: 14px;
  transform: translate(-50%, -50%);
  box-shadow: inset 0 0 0 2px black, inset 0 0 0 3px white, inset 0 0 0 4px black;
}

.hidden {
  display: none;
}

@keyframes spin {
  from { transform: rotate(-180deg); }
  to { transform: rotate(180deg); }
}

/* ===== Dialog ===== */

.dialog {
  border: none;
  border-radius: var(--radius-md);
  padding: 0;
  max-width: 400px;
  width: 90vw;
  background: transparent;
}

.dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.6);
}

.dialogInner {
  color: white;
  padding: 24px;
  border-radius: var(--radius-md);
  position: relative;
}

.closeDialogButton {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.closeDialogButton:hover {
  background: rgba(0, 0, 0, 0.4);
}

.dialogNumber {
  font-size: 0.9rem;
  opacity: 0.75;
  font-weight: 700;
}

.dialogName {
  margin: 4px 0 12px 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.dialogTypes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.dialogImage {
  display: block;
  margin: 0 auto 16px;
  width: 160px;
  height: 160px;
}

/* ===== Dialog Stats ===== */

.dialogStats {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.dialogStatsLabel {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  opacity: 0.85;
  margin-bottom: 12px;
}

.statRow {
  display: grid;
  grid-template-columns: 60px 32px 1fr;
  gap: 10px;
  align-items: center;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.statRow:last-child {
  margin-bottom: 0;
}

.statValue {
  font-weight: 700;
  text-align: right;
}

.statBar {
  height: 6px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 999px;
  overflow: hidden;
}

.statBarFill {
  height: 100%;
  background: white;
  border-radius: 999px;
}

/* ===== Dialog Navigation ===== */

.dialogNav {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

.navButton {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  color: white;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.navButton:hover {
  background: rgba(0, 0, 0, 0.4);
}

.noScroll {
  overflow: hidden;
}

/* ===== Footer ===== */

.siteFooter {
  background-color: var(--color-accent);
  color: white;
  padding: 20px var(--side-padding);
}

.footerInner {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
  font-size: 0.9rem;
}

.footerInner p {
  margin: 0;
}

/* ===== Responsive ===== */

@media (max-width: 640px) {
  .headerInner {
    flex-direction: column;
    align-items: stretch;
  }

  .searchBar {
    width: 100%;
  }

  .searchInput {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .content {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .pokemonName {
    font-size: 1.1rem;
  }

  .pokemonImage {
    width: 80px;
    height: 80px;
  }
}

@media (max-width: 360px) {
  .content {
    grid-template-columns: 1fr;
  }

  .logoText {
    font-size: 1.4rem;
  }
}
