/* ── Reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:        #cc0000;
  --red-dark:   #9b0000;
  --red-light:  #e63232;
  --bg:         #f2f2f2;
  --surface:    #ffffff;
  --surface-2:  #f7f7f7;
  --line:       #e0e0e0;
  --text:       #1a1a1a;
  --muted:      #777777;
  --white:      #ffffff;
  --radius:     12px;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Header / Nav ─────────────────────────────────────── */
header.sticky-top {
  background: var(--red);
  border-bottom: 3px solid var(--red-dark);
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  z-index: 100;
}

.navbar {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--white) !important;
  text-decoration: none;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-brand::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 28px;
  background:
    radial-gradient(circle at 50% 50%, var(--white) 6px, transparent 6px),
    linear-gradient(to bottom, var(--white) 50%, var(--red-dark) 50%);
  border: 2px solid var(--white);
  border-radius: 50%;
}

#pokemon-search {
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  color: var(--white);
  padding: 7px 16px;
  font-size: 0.9rem;
  width: 220px;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
}

#pokemon-search::placeholder { color: rgba(255,255,255,0.6); }

#pokemon-search:focus {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.7);
}

/* ── Main grid ────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 20px 64px; }

.pokemon-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  list-style: none;
  padding: 0;
}

.pokemon-list li { display: contents; }

/* ── Type card tints ──────────────────────────────────── */
.card-fire     { background: linear-gradient(160deg, #fff0e6, #ffe0cc); border-color: #f5c09a !important; }
.card-water    { background: linear-gradient(160deg, #e6f0ff, #ccdeff); border-color: #9ab8f5 !important; }
.card-grass    { background: linear-gradient(160deg, #e8f5e6, #d0edcc); border-color: #9ad09a !important; }
.card-poison   { background: linear-gradient(160deg, #f5e6ff, #ead0ff); border-color: #c49ae8 !important; }
.card-electric { background: linear-gradient(160deg, #fffde6, #fff9cc); border-color: #f5e09a !important; }
.card-psychic  { background: linear-gradient(160deg, #ffe6f0, #ffd0e4); border-color: #f59ab8 !important; }
.card-ice      { background: linear-gradient(160deg, #e6fafa, #ccf5f5); border-color: #9ae8e8 !important; }
.card-dragon   { background: linear-gradient(160deg, #ede6ff, #ddd0ff); border-color: #a89af5 !important; }
.card-dark     { background: linear-gradient(160deg, #ede8e4, #e0d8d0); border-color: #c0b0a0 !important; }
.card-fighting { background: linear-gradient(160deg, #ffe8e6, #ffd0cc); border-color: #f5a09a !important; }
.card-rock     { background: linear-gradient(160deg, #f5f0e6, #ede4cc); border-color: #d0c09a !important; }
.card-ground   { background: linear-gradient(160deg, #fff5e6, #ffe8cc); border-color: #e8cc9a !important; }
.card-ghost    { background: linear-gradient(160deg, #ede6f5, #e0d0f0); border-color: #b09ad8 !important; }
.card-steel    { background: linear-gradient(160deg, #eef0f5, #dde0ee); border-color: #b0b8d8 !important; }
.card-bug      { background: linear-gradient(160deg, #f0f5e6, #e4edcc); border-color: #b8d09a !important; }
.card-flying   { background: linear-gradient(160deg, #eeeeff, #dde0ff); border-color: #b0b8f5 !important; }
.card-normal   { background: linear-gradient(160deg, #f5f5f0, #eeeee8); border-color: #d0d0c0 !important; }
.card-fairy    { background: linear-gradient(160deg, #fff0f5, #ffe0ec); border-color: #f5a0bc !important; }

/* ── Pokémon card / button ────────────────────────────── */
.poke-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 12px 14px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: capitalize;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  width: 100%;
  min-height: 160px;
  position: relative;
  overflow: hidden;
}

.poke-button::before {
  content: "";
  position: absolute;
  top: -24px;
  right: -24px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 18px solid rgba(255,255,255,0.5);
  pointer-events: none;
}

.poke-button:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.15);
}

.poke-button img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
  transition: transform 0.2s ease;
}

.poke-button:hover img {
  transform: scale(1.08) translateY(-2px);
}

.poke-number {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 2px;
  font-weight: 600;
}

/* ── Type badges ──────────────────────────────────────── */
.type-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 10px;
  margin: 2px;
  color: #fff;
}

.type-fire     { background: #f08030; }
.type-water    { background: #6890f0; }
.type-grass    { background: #78c850; }
.type-poison   { background: #a040a0; }
.type-electric { background: #f8d030; color: #333; }
.type-psychic  { background: #f85888; }
.type-ice      { background: #98d8d8; color: #333; }
.type-dragon   { background: #7038f8; }
.type-dark     { background: #705848; }
.type-fighting { background: #c03028; }
.type-rock     { background: #b8a038; }
.type-ground   { background: #e0c068; color: #333; }
.type-ghost    { background: #705898; }
.type-steel    { background: #b8b8d0; color: #333; }
.type-bug      { background: #a8b820; color: #333; }
.type-flying   { background: #a890f0; }
.type-normal   { background: #a8a878; color: #333; }
.type-fairy    { background: #f0b6bc; color: #333; }

/* ── Modal overlay ────────────────────────────────────── */
.poke-modal-overlay {
  display: none;
}

.poke-modal-overlay.is-visible {
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
  padding: 20px;
  overflow: auto;
  backdrop-filter: blur(4px);
}

/* ── Modal card ───────────────────────────────────────── */
.poke-modal {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  animation: pop-in 0.2s ease;
}

@keyframes pop-in {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.poke-modal-header {
  background: var(--red);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--red-dark);
}

.modal-header h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--white);
  text-transform: capitalize;
  margin: 0;
}

.poke-modal-close {
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  line-height: 1;
}

.poke-modal-close:hover { background: rgba(255,255,255,0.35); }

.poke-modal-body {
  padding: 24px;
  text-align: center;
}

.poke-modal-sprite {
  width: 180px;
  height: 180px;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.2));
  margin-bottom: 16px;
}

.poke-modal-number {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.poke-modal-types {
  margin: 10px 0 18px;
}

.poke-modal-stats {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: left;
}

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

.stat-row:last-child { margin-bottom: 0; }

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  width: 56px;
  flex-shrink: 0;
}

.stat-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.stat-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--red);
  transition: width 0.4s ease;
}

.stat-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Height stat ──────────────────────────────────────── */
.poke-modal-height {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 14px;
}

/* ── Loading skeleton ─────────────────────────────────── */
.poke-placeholder {
  width: 80px;
  height: 80px;
  background: #e8e8e8;
  border-radius: 50%;
  margin-bottom: 8px;
  animation: pulse 1.2s ease-in-out infinite;
}

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

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 480px) {
  .pokemon-list { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
  #pokemon-search { width: 140px; }
}
