@import url("https://fonts.cdnfonts.com/css/pokemon-solid");
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap");

:root {
  --primary-color: #ff3d3d;
  --primary-dark: #cc0000;
  --secondary-color: #ffcb05;
  --secondary-hover: #ffa500;
  --blue-accent: #3d7dca;
  --light-blue: #c1d8f1;
  --dark-text: #2e2e2e;
  --light-text: #ffffff;
  --card-bg: #ffffff;
  --background: #f5f5f5;
}

body {
  font-family: "Montserrat", sans-serif;
  background-color: var(--background);
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23e0e0e0' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  margin: 0;
  padding: 0;
  color: var(--dark-text);
  min-height: 100vh;
}

header {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  padding: 15px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  max-width: 220px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
}

.search-area {
  background-color: var(--card-bg);
  padding: 25px;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  position: relative;
  border: 2px solid rgba(0, 0, 0, 0.05);
}

.search-area::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--primary-color), var(--blue-accent));
  border-radius: 14px 14px 0 0;
}

input[type="text"] {
  padding: 14px 20px;
  width: 300px;
  border-radius: 30px;
  border: 2px solid #e0e0e0;
  font-size: 16px;
  font-family: "Montserrat", sans-serif;
  transition: all 0.3s ease;
  outline: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

input[type="text"]:focus {
  border-color: var(--blue-accent);
  box-shadow: 0 0 0 3px rgba(61, 125, 202, 0.2);
}

button {
  padding: 14px 24px;
  border: none;
  border-radius: 30px;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

#search-button {
  background-color: var(--primary-color);
  color: var(--light-text);
}

#search-button:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(204, 0, 0, 0.2);
}

#toggle-favourites {
  background-color: var(--secondary-color);
  color: var(--dark-text);
}

#toggle-favourites:hover {
  background-color: var(--secondary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(255, 165, 0, 0.2);
}

.spinner {
  width: 80px;
  margin: 30px auto;
  display: block;
  animation: spin 1.5s infinite linear;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;
  justify-content: center;
}

/* Center single Pokémon result */
.card-container.centered {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

.card-container.centered .pokemon-card {
  margin: 0 auto;
}

.pokemon-card {
  background-color: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  padding: 25px;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(0, 0, 0, 0.03);
  max-width: 320px;
  width: 100%;
}

.pokemon-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--primary-color), var(--blue-accent));
  border-radius: 14px 14px 0 0;
}

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

.pokemon-card h2 {
  font-family: "Pokemon Solid", sans-serif;
  color: var(--dark-text);
  margin-bottom: 15px;
  text-transform: capitalize;
  letter-spacing: 1.5px;
  font-size: 1.8rem;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
}

.pokemon-card img {
  width: 180px;
  height: 180px;
  object-fit: contain;
  margin: 10px auto 20px;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.1));
}

.pokemon-card:hover img {
  transform: scale(1.1);
}

.pokemon-card p {
  margin-bottom: 12px;
  text-align: left;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 500;
  background-color: rgba(0, 0, 0, 0.03);
}

.pokemon-card p:nth-of-type(1) {
  background-color: #e3f2fd;
  color: #1565c0;
}

.pokemon-card p:nth-of-type(2) {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.pokemon-card p:nth-of-type(3) {
  background-color: #fff8e1;
  color: #f57f17;
}

.pokemon-card button {
  margin-top: 8px;
  width: 100%;
  display: block;
  font-size: 15px;
  padding: 12px;
}

.pokemon-card button:first-of-type {
  background-color: var(--blue-accent);
  color: white;
  margin-bottom: 8px;
}

.pokemon-card button:first-of-type:hover {
  background-color: #2c5ba2;
}

.pokemon-card button:last-of-type {
  background-color: var(--light-blue);
  color: #1a4b8c;
}

.pokemon-card button:last-of-type:hover {
  background-color: #a8c6e8;
}

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}

.modal-content {
  background-color: white;
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  width: 450px;
  max-width: 90%;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: modalPop 0.3s forwards;
  overflow: auto;
  max-height: 90vh;
}

@keyframes modalPop {
  0% {
    transform: scale(0.9);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 15px;
  position: relative;
}

.modal-id {
  position: absolute;
  right: 0;
  top: 0;
  font-weight: 700;
  color: #888;
  font-size: 1.1rem;
}

.modal-content h2 {
  font-family: "Pokemon Solid", sans-serif;
  color: var(--primary-color);
  font-size: 2rem;
  text-transform: capitalize;
  letter-spacing: 1.5px;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
  margin: 0 auto;
}

.modal-content h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: var(--blue-accent);
  border-bottom: 2px solid var(--light-blue);
  padding-bottom: 5px;
}

.modal-image-container {
  margin-bottom: 20px;
}

.modal-content img {
  width: 200px;
  height: auto;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
}

.modal-info {
  text-align: left;
}

.modal-types {
  margin-bottom: 20px;
}

.types-container {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.type-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  text-transform: capitalize;
  color: white;
}

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

.modal-basic-info {
  display: flex;
  margin-bottom: 20px;
  gap: 20px;
}

.info-column {
  flex: 1;
}

.modal-content p {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background-color: #f5f5f5;
  font-weight: 500;
}

.stats-grid {
  display: grid;
  gap: 12px;
}

.stat-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 10px;
}

.stat-name {
  font-weight: 600;
  text-transform: capitalize;
}

.stat-bar {
  height: 12px;
  background-color: #eee;
  border-radius: 6px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  background-color: var(--primary-color);
  border-radius: 6px;
}

.stat-value {
  font-weight: 700;
}

.close {
  /* position: absolute; */
  right: 20px;
  top: 15px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #888;
  transition: color 0.3s, background-color 0.3s;
  height: 40px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  z-index: 10;
}

.close:hover {
  color: var(--primary-color);
  background-color: rgba(0, 0, 0, 0.05);
}

.hidden {
  display: none;
}

/* Responsive styles */
@media (max-width: 768px) {
  .search-area {
    flex-direction: column;
    padding: 20px;
  }

  input[type="text"] {
    width: 100%;
  }

  button {
    width: 100%;
  }

  .modal-content {
    padding: 20px;
  }

  .modal-basic-info {
    flex-direction: column;
    gap: 10px;
  }

  .stat-row {
    grid-template-columns: 100px 1fr auto;
  }
}

/* Animation for when cards appear */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pokemon-card {
  animation: fadeIn 0.5s ease forwards;
}

/* Add staggered animation for multiple cards */
.pokemon-card:nth-child(1) {
  animation-delay: 0.1s;
}
.pokemon-card:nth-child(2) {
  animation-delay: 0.2s;
}
.pokemon-card:nth-child(3) {
  animation-delay: 0.3s;
}
.pokemon-card:nth-child(4) {
  animation-delay: 0.4s;
}
.pokemon-card:nth-child(5) {
  animation-delay: 0.5s;
}
.pokemon-card:nth-child(6) {
  animation-delay: 0.6s;
}
