/* 基本样式 */
:root {
  --primary-color: #EF5350;
  --secondary-color: #30A7D7;
  --dark-color: #212121;
  --light-color: #F5F5F5;
  --success-color: #78C850;
  --danger-color: #F08030;
  --info-color: #6890F0;
  --bg-color: #F7F7F7;
  --border-radius: 8px;
  --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

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

body {
  font-family: 'Roboto', Arial, sans-serif;
  line-height: 1.6;
  background-color: var(--bg-color);
  color: var(--dark-color);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* 导航栏 */
.navbar {
  background-color: var(--primary-color);
  color: white;
  padding: 15px 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
  text-decoration: none;
}

.navbar-brand img {
  height: 40px;
  margin-right: 10px;
}

.navbar-nav {
  display: flex;
  align-items: center;
  list-style: none;
}

.navbar-nav li {
  margin-left: 20px;
}

.navbar-nav a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.navbar-nav a:hover {
  color: #FFD700;
}

.search-form {
  display: flex;
  margin-left: 20px;
}

.search-form input {
  padding: 8px 12px;
  border: none;
  border-radius: var(--border-radius) 0 0 var(--border-radius);
  outline: none;
}

.search-form button {
  background-color: var(--secondary-color);
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  cursor: pointer;
  transition: var(--transition);
}

.search-form button:hover {
  background-color: #2486b9;
}

/* 英雄区域 */
.hero {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 60px 0;
  text-align: center;
  margin-bottom: 40px;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 20px;
}

.hero p {
  font-size: 1.2rem;
  max-width: 700px;
  margin: 0 auto 30px;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: var(--success-color);
  color: white;
  text-decoration: none;
  border-radius: var(--border-radius);
  transition: var(--transition);
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.btn-primary {
  background-color: var(--primary-color);
}

.btn-secondary {
  background-color: var(--secondary-color);
}

/* 宝可梦卡片 */
.pokemon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 25px;
  margin-bottom: 40px;
}

.pokemon-grid-list {
  grid-template-columns: 1fr;
}

.pokemon-grid-list .pokemon-card {
  display: flex;
  align-items: center;
  max-width: 100%;
}

.pokemon-grid-list .pokemon-card-image {
  width: 100px;
  min-width: 100px;
  height: 100px;
  margin-right: 20px;
  margin-bottom: 0;
}

.pokemon-grid-list .pokemon-card-content {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pokemon-grid-list .pokemon-name {
  margin-bottom: 10px;
}

.pokemon-grid-list .pokemon-types {
  margin-right: 20px;
}

/* 所有视图下按钮样式优化 */
.pokemon-card .btn {
  padding: 6px 10px;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* 列表视图下按钮的特殊样式 */
.btn-list-view {
  min-width: 70px;
  margin-top: 10px;
  text-align: center;
}

.pokemon-card {
  background-color: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  position: relative;
}

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

.pokemon-card-image {
  height: 200px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f0f0f0;
}

.pokemon-card-image img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  transition: var(--transition);
}

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

.pokemon-card-content {
  padding: 15px;
}

.pokemon-id {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: var(--secondary-color);
  color: white;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
}

.pokemon-name {
  font-size: 1.3rem;
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--dark-color);
}

.pokemon-types {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.type-icon {
  width: 20px;
  height: 20px;
  background-image: url('../images/types.webp');
  background-size: 20px 420px; /* 按比例缩放：50/50*20 = 20px宽度，1050/50*20 = 420px高度 */
  background-repeat: no-repeat;
  display: inline-block;
}

.type-icon.type-一般 { background-position: 0 0; }
.type-icon.type-格斗 { background-position: 0 -20px; }
.type-icon.type-飞行 { background-position: 0 -40px; }
.type-icon.type-毒 { background-position: 0 -60px; }
.type-icon.type-地面 { background-position: 0 -80px; }
.type-icon.type-岩石 { background-position: 0 -100px; }
.type-icon.type-虫 { background-position: 0 -120px; }
.type-icon.type-幽灵 { background-position: 0 -140px; }
.type-icon.type-钢 { background-position: 0 -160px; }
.type-icon.type-火 { background-position: 0 -180px; }
.type-icon.type-水 { background-position: 0 -200px; }
.type-icon.type-草 { background-position: 0 -220px; }
.type-icon.type-电 { background-position: 0 -240px; }
.type-icon.type-超能力 { background-position: 0 -260px; }
.type-icon.type-冰 { background-position: 0 -280px; }
.type-icon.type-龙 { background-position: 0 -300px; }
.type-icon.type-恶 { background-position: 0 -320px; }
.type-icon.type-妖精 { background-position: 0 -340px; }

.type-badge {
  padding: 4px 10px;
  border-radius: 20px;
  color: white;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  min-width: 70px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 详情页样式 */
.pokemon-detail {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: 40px;
  overflow: hidden;
}

.detail-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-header h1 {
  font-size: 2rem;
  display: flex;
  align-items: center;
}

.detail-header h1 span {
  font-size: 1.2rem;
  margin-left: 10px;
  opacity: 0.8;
}

.detail-body {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 30px;
  padding: 30px;
}

.detail-image {
  background-color: #f0f0f0;
  border-radius: var(--border-radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
}

.detail-image img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.detail-info h2 {
  margin-bottom: 20px;
  font-size: 1.5rem;
  color: var(--secondary-color);
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.stat-item {
  background-color: var(--light-color);
  padding: 10px;
  border-radius: var(--border-radius);
  text-align: center;
}

.stat-item h4 {
  font-size: 0.9rem;
  color: var(--dark-color);
  margin-bottom: 5px;
  opacity: 0.7;
}

.stat-item p {
  font-weight: bold;
  font-size: 1.1rem;
}

.detail-section {
  margin-bottom: 30px;
}

/* 图鉴描述列表样式 */
.description-list {
  list-style-type: disc;
  padding-left: 20px;
  margin: 10px 0;
}

.description-list li {
  margin-bottom: 8px;
  line-height: 1.5;
}

/* 特性列表样式 */
.ability-list {
  list-style-type: disc;
  padding-left: 20px;
}

.ability-list li {
  margin-bottom: 12px;
}

.ability-list ul {
  margin-top: 5px;
  list-style-type: circle;
}

.ability-list strong {
  font-weight: bold;
}

.detail-section h3 {
  margin-bottom: 10px;
  font-size: 1.2rem;
  color: var(--primary-color);
  border-bottom: 2px solid var(--light-color);
  padding-bottom: 5px;
}

.evolution-chain {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.evolution-item {
  text-align: center;
  flex: 1;
  min-width: 120px;
}

.evolution-item img {
  max-width: 100px;
  max-height: 100px;
  margin-bottom: 10px;
}

.evolution-arrow {
  font-size: 1.5rem;
  color: var(--secondary-color);
  margin: 0 10px;
}

/* API文档页样式 */
.api-docs {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 30px;
  margin-bottom: 40px;
}

.api-section {
  margin-bottom: 30px;
}

.api-section h2 {
  margin-bottom: 15px;
  font-size: 1.5rem;
  color: var(--secondary-color);
}

.api-endpoint {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.method-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    margin-right: 10px;
}

.method-get {
    background-color: #61affe;
}

.method-post {
    background-color: #49cc90;
}

.code-block {
    background-color: #272822;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    white-space: pre;
    line-height: 1.5;
    font-size: 14px;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
}

.code-block code {
    font-family: 'Courier New', monospace;
    display: block;
}

/* 搜索页样式 */
.search-results {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 20px;
  margin-bottom: 40px;
}

.search-results h2 {
  margin-bottom: 20px;
  font-size: 1.5rem;
  color: var(--secondary-color);
}

.no-results {
  text-align: center;
  padding: 40px;
  color: var(--dark-color);
  opacity: 0.7;
}

/* 底部样式 */
.footer {
  background-color: var(--dark-color);
  color: white;
  padding: 40px 0;
  margin-top: 40px;
}

.footer .container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 30px;
}

.footer-logo {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 15px;
}

.footer h3 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: var(--secondary-color);
}

.footer p {
  margin-bottom: 10px;
  opacity: 0.8;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  color: white;
  opacity: 0.8;
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  opacity: 1;
  color: var(--secondary-color);
}

.copyright {
  text-align: center;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0.6;
  font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .navbar .container {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .navbar-nav {
    margin-top: 15px;
    flex-direction: column;
    align-items: flex-start;
  }
  
  .navbar-nav li {
    margin-left: 0;
    margin-bottom: 10px;
  }
  
  .search-form {
    margin-left: 0;
    margin-top: 15px;
    width: 100%;
  }
  
  .search-form input {
    flex-grow: 1;
  }
  
  .detail-body {
    grid-template-columns: 1fr;
  }
  
  .detail-image {
    height: 250px;
  }
  
  .evolution-chain {
    flex-direction: column;
  }
  
  .evolution-arrow {
    transform: rotate(90deg);
    margin: 10px 0;
  }
}

/* 动画效果 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

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

.pokemon-grid .pokemon-card:nth-child(1) { animation-delay: 0.1s; }
.pokemon-grid .pokemon-card:nth-child(2) { animation-delay: 0.2s; }
.pokemon-grid .pokemon-card:nth-child(3) { animation-delay: 0.3s; }
.pokemon-grid .pokemon-card:nth-child(4) { animation-delay: 0.4s; }
.pokemon-grid .pokemon-card:nth-child(5) { animation-delay: 0.5s; }
.pokemon-grid .pokemon-card:nth-child(6) { animation-delay: 0.6s; }
.pokemon-grid .pokemon-card:nth-child(7) { animation-delay: 0.7s; }
.pokemon-grid .pokemon-card:nth-child(8) { animation-delay: 0.8s; }
.pokemon-grid .pokemon-card:nth-child(9) { animation-delay: 0.9s; }
.pokemon-grid .pokemon-card:nth-child(10) { animation-delay: 1s; }

/* 404页面 */
.error-page {
  text-align: center;
  padding: 60px 20px;
}

.error-page h1 {
  font-size: 5rem;
  margin-bottom: 20px;
  color: var(--primary-color);
}

.error-page p {
  font-size: 1.2rem;
  margin-bottom: 30px;
  color: var(--dark-color);
  opacity: 0.7;
}

.error-image {
  max-width: 300px;
  margin: 0 auto 30px;
}
