/* ===== RESET & BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --type-color: #667eea;
  --type-color-light: #764ba2;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

body.no-scroll {
  overflow: hidden;
}

/* ===== HEADER ===== */
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.logo-section {
  text-align: center;
}

.logo-title {
  font-size: 2rem;
  color: #667eea;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===== SEARCH SECTION ===== */
.search-section {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

.search-input {
  flex: 1;
  max-width: 400px;
  padding: 0.75rem 1rem;
  border: 2px solid #667eea;
  border-radius: 25px;
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: #764ba2;
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.search-button {
  padding: 0.75rem 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.search-button:active {
  transform: translateY(0);
}

/* ===== CLEAR SEARCH BUTTON ===== */
.clear-search-button {
  padding: 0.75rem 1.5rem;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.clear-search-button:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(239, 68, 68, 0.4);
}

.clear-search-button.hidden {
  display: none;
}

/* ===== MAIN CONTAINER ===== */
.main-container {
  max-width: 1440px;
  margin: 2rem auto;
  padding: 0 1rem;
  align-items: center;
}

/* ===== POKEMON GRID ===== */
.pokemon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* ===== POKEMON CARD ===== */
.pokemon-card {
  background: white;
  border-radius: 15px;
  padding: 1.5rem;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.pokemon-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: inherit;
}

.pokemon-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

/* ===== FAVORITE HEART ON CARDS ===== */
.card-favorite-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.card-favorite-button:hover {
  transform: scale(1.15);
  background: white;
}

.card-favorite-button svg {
  width: 20px;
  height: 20px;
  stroke: #ff6b6b;
  stroke-width: 2;
  fill: none;
  transition: fill 0.3s ease;
}

.card-favorite-button.favorited svg {
  fill: #ff6b6b;
  stroke: #ff6b6b;
}

.pokemon-id {
  font-size: 0.9rem;
  color: #666;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.pokemon-image {
  width: 100%;
  height: 200px;
  object-fit: contain;
  margin: 1rem 0;
}

.pokemon-name {
  font-size: 1.5rem;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: #333;
}

.pokemon-types {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.type-badge {
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: bold;
  color: white;
  text-transform: uppercase;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* ===== TYPE COLORS ===== */
.type-normal {
  background: #a8a77a;
}
.type-fire {
  background: #ee8130;
}
.type-water {
  background: #6390f0;
}
.type-electric {
  background: #f7d02c;
  color: #333;
}
.type-grass {
  background: #7ac74c;
}
.type-ice {
  background: #96d9d6;
}
.type-fighting {
  background: #c22e28;
}
.type-poison {
  background: #a33ea1;
}
.type-ground {
  background: #e2bf65;
}
.type-flying {
  background: #a98ff3;
}
.type-psychic {
  background: #f95587;
}
.type-bug {
  background: #a6b91a;
}
.type-rock {
  background: #b6a136;
}
.type-ghost {
  background: #735797;
}
.type-dragon {
  background: #6f35fc;
}
.type-dark {
  background: #705746;
}
.type-steel {
  background: #b7b7ce;
}
.type-fairy {
  background: #d685ad;
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
  text-align: center;
  padding: 2rem;
  color: white;
  font-size: 1.2rem;
  font-weight: 600;
}

.loading-screen.hidden {
  display: none;
}

.pokeball-loader {
  width: 60px;
  height: 60px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #667eea;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ===== NO RESULTS MESSAGE ===== */
.no-results-message {
  text-align: center;
  padding: 3rem 2rem;
  color: white;
  font-size: 1.2rem;
}

.no-results-message h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.no-results-message p {
  opacity: 0.8;
}

/* ===== LOAD MORE BUTTON ===== */
.load-more-section {
  text-align: center;
  margin: 2rem 0;
  display: flex;
  justify-content: center;
}

.load-more-button {
  padding: 1rem 3rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 30px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.load-more-button:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.load-more-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #999;
  align-items: center !important;
}

/* ===== OVERLAY ===== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay.hidden {
  display: none;
}

.overlay-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

/* ===== POKEMON DETAIL CARD ===== */
.pokemon-detail-card {
  position: relative;
  background: white;
  border-radius: 30px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  z-index: 1001;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ===== CLOSE BUTTON (X) ===== */
.close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1003;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.close-button:hover {
  background: #ef4444;
  color: white;
  transform: scale(1.1);
}

.close-button svg {
  stroke-width: 2.5;
}

/* ===== DETAIL HEADER ===== */
.detail-header {
  position: relative;
  padding: 3rem 1.5rem 2rem;
  background: linear-gradient(
    180deg,
    var(--type-color) 0%,
    var(--type-color-light) 100%
  );
  color: white;
  border-radius: 30px 30px 0 0;
  text-align: center;
}

.favorite-button {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  backdrop-filter: blur(10px);
  z-index: 1002;
}

.favorite-button:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.favorite-button.favorited svg {
  fill: white;
  stroke: white;
}

.detail-pokemon-image-container {
  margin: 1rem 0;
}

.detail-pokemon-image {
  width: 180px;
  height: 180px;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

.detail-pokemon-name {
  font-size: 1.8rem;
  font-weight: bold;
  text-transform: capitalize;
  margin: 0.5rem 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.detail-pokemon-types {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin: 0.75rem 0;
}

.detail-pokemon-types .type-badge {
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  padding: 0.4rem 1.2rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: capitalize;
  color: white;
}

.detail-pokemon-id {
  font-size: 1rem;
  opacity: 0.9;
  font-weight: 600;
  margin-top: 0.5rem;
}

/* ===== TAB NAVIGATION ===== */
.tab-navigation {
  display: flex;
  background: white;
  border-bottom: 2px solid #f0f0f0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.tab-button {
  flex: 1;
  padding: 0.875rem 0.5rem;
  background: none;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: #999;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  text-transform: capitalize;
}

.tab-button.active {
  color: var(--type-color, #667eea);
}

.tab-button.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--type-color, #667eea);
  border-radius: 3px 3px 0 0;
}

.tab-button:hover {
  color: #333;
}

/* ===== TAB CONTENT ===== */
.tab-content-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  background: white;
  border-radius: 0 0 30px 30px;
}

/* Hide scrollbar until content overflows */
.tab-content-container::-webkit-scrollbar {
  width: 6px;
}

.tab-content-container::-webkit-scrollbar-track {
  background: transparent;
}

.tab-content-container::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

.tab-content-container::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== INFO GRID ===== */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.info-label {
  font-size: 0.8rem;
  color: #999;
  font-weight: 600;
}

.info-value {
  font-size: 0.95rem;
  color: #333;
  font-weight: 600;
  text-transform: capitalize;
}

.section-title {
  font-size: 1rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 0.875rem;
  margin-top: 1.5rem;
}

.breeding-section {
  margin-top: 1.5rem;
}

/* ===== STATS CONTAINER ===== */
.stats-container {
  margin-bottom: 1.5rem;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 0.875rem;
}

.stat-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  min-width: 90px;
}

.stat-value {
  font-size: 0.95rem;
  font-weight: bold;
  color: #333;
  min-width: 35px;
}

.stat-bar-container {
  flex: 1;
  height: 7px;
  background: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
}

.stat-bar {
  height: 100%;
  background: var(--type-color, #667eea);
  border-radius: 10px;
  transition: width 0.6s ease;
}

/* ===== TYPE DEFENSES ===== */
.type-defenses {
  margin-top: 1.5rem;
}

.type-defenses-subtitle {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 0.875rem;
}

.type-effectiveness-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
  gap: 0.625rem;
}

.effectiveness-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.effectiveness-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  color: white;
}

.effectiveness-multiplier {
  font-size: 0.7rem;
  font-weight: bold;
  color: #666;
}

/* ===== EVOLUTION CHAIN ===== */
.evolution-chain {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
}

.evolution-stage {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.evolution-pokemon {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.875rem;
  background: #f8f8f8;
  border-radius: 12px;
  min-width: 110px;
}

.evolution-pokemon img {
  width: 70px;
  height: 70px;
  object-fit: contain;
}

.evolution-pokemon-name {
  font-weight: 600;
  text-transform: capitalize;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.evolution-arrow {
  font-size: 1.75rem;
  color: #ccc;
}

/* ===== MOVES LIST ===== */
.moves-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.move-item {
  padding: 0.875rem;
  background: #f8f8f8;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.move-name {
  font-weight: 600;
  text-transform: capitalize;
  color: #333;
  font-size: 0.9rem;
}

.move-type {
  padding: 0.25rem 0.625rem;
  border-radius: 15px;
  font-size: 0.7rem;
  font-weight: bold;
  color: white;
}

.info-message {
  text-align: center;
  color: #999;
  padding: 1.5rem;
  font-size: 0.95rem;
}

/* ===== NAVIGATION ARROWS ===== */
.nav-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  z-index: 1002;
  color: #333;
}

.nav-arrow-left {
  left: 20px;
}

.nav-arrow-right {
  right: 20px;
}

.nav-arrow:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  background: var(--type-color, #667eea);
  color: white;
}

.nav-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (min-width: 768px) {
  .header-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .logo-title {
    font-size: 2.5rem;
  }

  .pokemon-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .search-section {
    justify-content: flex-end;
  }
}

@media (min-width: 1024px) {
  .pokemon-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
  }
}

@media (min-width: 1920px) {
  .main-container {
    max-width: 1920px;
  }
}

@media (max-width: 768px) {
  .pokemon-detail-card {
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .tab-content-container {
    border-radius: 0;
  }

  .nav-arrow {
    width: 42px;
    height: 42px;
    bottom: 80px;
    top: auto;
    transform: none;
  }

  .nav-arrow-left {
    left: 15px;
  }

  .nav-arrow-right {
    right: 15px;
  }

  .nav-arrow:hover:not(:disabled) {
    transform: scale(1.1);
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .tab-button {
    font-size: 0.8rem;
    padding: 0.75rem 0.25rem;
  }

  .detail-pokemon-image {
    width: 140px;
    height: 140px;
  }

  .detail-pokemon-name {
    font-size: 1.5rem;
  }

  .close-button {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 320px) {
  .pokemon-grid {
    grid-template-columns: 1fr;
  }

  .search-section {
    flex-direction: column;
  }

  .tab-button {
    font-size: 0.7rem;
    padding: 0.625rem 0.25rem;
  }
}
