/* 添加必要的样式 */
.search-container {
  margin: 20px 0;
  display: flex;
  justify-content: center;
}

.api-stats {
  text-align: center;
  margin: 20px 0;
  padding: 10px;
  background-color: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--text-color);
  font-size: 16px;
}

.typewriter {
  display: inline-block;
  overflow: hidden;
  border-right: 2px solid var(--primary); /* 添加闪烁的光标效果 */
  white-space: nowrap;
  animation: blink-caret 0.75s step-end infinite;
}

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: var(--primary) }
}

.search-form {
  width: 100%;
  max-width: 600px;
}

/* 搜索框样式 */
.search-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 0 20px;
}

.search-container {
  width: 100%;
  display: flex;
  justify-content: center;
}

.search-input-group {
  display: flex;
  position: relative;
  width: 100%;
  max-width: 460px; /* 电脑端固定宽度为460px */
}

#searchInput {
  width: 100%;
  height: 46px;
  padding: 12px 15px 12px 40px;
  border: 2px solid #e2e8f0; /* 默认灰色边框 */
  border-radius: 8px;
  font-size: 16px;
  background-color: #fff;
  color: #4a5568;
  transition: all 0.3s ease;
}

#searchInput::placeholder {
  color: #a0aec0;
}

#searchInput:focus {
  outline: none;
  border-color: #e53e3e; /* 选中时红色边框 */
  box-shadow: 0 0 0 1px rgba(229, 62, 62, 0.2); /* 轻微的红色阴影效果 */
}

.search-input-group::before {
  content: "\f002";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #a0aec0;
  z-index: 1;
}

/* 暗色模式适配 */
[data-theme="dark"] #searchInput {
  background-color: #2d3748;
  color: #e2e8f0;
  border-color: #4a5568; /* 暗色模式下的灰色边框 */
}

[data-theme="dark"] #searchInput::placeholder {
  color: #718096;
}

[data-theme="dark"] #searchInput:focus {
  border-color: #e53e3e; /* 选中时红色边框 */
  box-shadow: 0 0 0 1px rgba(229, 62, 62, 0.3); /* 暗色模式下稍微加深阴影 */
}

[data-theme="dark"] .search-input-group::before {
  color: #718096;
}

/* 响应式适配 */
@media (max-width: 768px) {
  .search-input-group {
    max-width: 100%; /* 移动端全宽 */
  }
}

.search-input {
  flex: 1;
  padding: 12px 15px;
  border: none;
  font-size: 16px;
  background-color: var(--card-bg);
  color: var(--text-color);
}

.search-button {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0 20px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.search-button:hover {
  background-color: #c53030;
}

/* 赞助商模块样式 */
.sponsor-section {
  margin: 30px 0;
  padding: 20px;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.sponsor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.sponsor-header h3 {
  margin: 0;
  color: #4a5568;
  font-size: 18px;
}

.toggle-btn {
  background: none;
  border: none;
  color: #718096;
  font-size: 16px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.toggle-btn:hover {
  background-color: #f7fafc;
  color: #4a5568;
}

.toggle-btn:focus {
  outline: none;
}

.toggle-btn.collapsed i {
  transform: rotate(180deg);
}

.sponsor-content {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.sponsor-content.collapsed {
  max-height: 0;
}

/* 暗色模式适配 */
[data-theme="dark"] .sponsor-section {
  background-color: #2d3748;
}

[data-theme="dark"] .sponsor-header h3 {
  color: #e2e8f0;
}

[data-theme="dark"] .toggle-btn {
  color: #a0aec0;
}

[data-theme="dark"] .toggle-btn:hover {
  background-color: #4a5568;
  color: #e2e8f0;
}

.sponsor-logos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 0 auto;
  max-width: 100%;
}

.sponsor-logo {
  background-color: var(--tip-box-bg);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 139px;
  width: 278px;
  margin: 0 auto;
}

.sponsor-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ad-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 16px auto 0;
  max-width: 100%;
}

.ad {
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  transition: all 0.3s ease;
  box-sizing: border-box;
  font-size: 14px;
  text-align: center;
  height: 40px;
  width: 288px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.ad:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.ad a {
  text-decoration: none;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 响应式适配 */
@media (max-width: 992px) {
  .sponsor-logos {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .ad-container {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .sponsor-logo {
    width: 278px;
    height: 139px;
  }
  
  .ad {
    width: 288px;
    height: 40px;
  }
}

@media (max-width: 768px) {
  .sponsor-logos {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .ad-container {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .sponsor-logo {
    height: 139px;
    width: 278px;
    margin: 0 auto;
  }
  
  .ad {
    height: 40px;
    width: 288px;
    margin: 0 auto;
  }
  
  .donor-item {
    width: calc(50% - 10px);
  }
}

@media (max-width: 576px) {
  .sponsor-logos {
    grid-template-columns: 1fr;
  }
  
  .ad-container {
    grid-template-columns: 1fr;
  }
  
  .sponsor-logo {
    height: 139px;
    width: 278px;
    margin: 0 auto;
  }
  
  .ad {
    height: 40px;
    width: 288px;
    margin: 0 auto;
  }
}

/* 新的API卡片样式 */
.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.api-item {
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="dark"] .api-item {
  background-color: #2d3748;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.api-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.api-item a {
  display: block;
  text-decoration: none;
}

.api-header {
  padding: 20px 20px 0;
}

.api-content {
  padding: 0 20px 20px;
}

.api-id {
  color: #718096;
  font-size: 14px;
  margin-bottom: 5px;
}

[data-theme="dark"] .api-id {
  color: #a0aec0;
}

.api-title {
  color: #c53030;
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 15px;
}

[data-theme="dark"] .api-title {
  color: #fc8181;
}

.api-content {
  position: relative;
}

.api-content:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background-color: #edf2f7;
}

[data-theme="dark"] .api-content:before {
  background-color: #4a5568;
}

.api-desc {
  color: #4a5568;
  font-size: 15px;
  line-height: 1.6;
  padding-top: 15px;
}

[data-theme="dark"] .api-desc {
  color: #e2e8f0;
}

.api-status-tag {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  background-color: #f7fafc;
}

[data-theme="dark"] .api-status-tag {
  background-color: #2d3748;
}

.api-status-normal {
  color: #2ecc71;
}

.api-status-maintenance {
  color: #e74c3c;
}

.donor-card {
  background-color: var(--card-bg);
  border-radius: 10px;
  padding: 15px;
  margin: 10px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
  flex: 0 0 calc(20% - 20px); /* 每行5个，减去margin */
}

.donor-card:hover {
  transform: translateY(-5px);
}

.donor-card img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 10px;
}

.donor-card h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-color);
}

.donor-card p {
  margin: 5px 0 0;
  font-size: 14px;
  color: var(--primary);
}

.donors-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.donors-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

.donor-item {
  width: calc(20% - 10px);
  text-align: center;
  background-color: var(--card-bg);
  border-radius: 10px;
  padding: 15px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
}

.donor-item:hover {
  transform: translateY(-5px);
}

.donor-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 10px;
}

.donor-info h4 {
  margin: 0;
  font-size: 16px;
  color: var(--text-color);
}

.donor-info p {
  margin: 5px 0 0;
  font-size: 14px;
  color: var(--primary);
}

.donate-section {
  margin: 30px 0;
  padding: 20px;
  background-color: var(--card-bg);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.donate-title {
  text-align: center;
  margin-bottom: 15px;
  color: var(--text-color);
}

.donate-desc {
  text-align: center;
  margin-bottom: 15px;
  color: var(--gray);
}

.donate-notice {
  text-align: center;
  margin-bottom: 20px;
  padding: 8px;
  background-color: rgba(229, 62, 62, 0.1);
  border-radius: 5px;
  color: var(--primary);
  font-size: 14px;
}

.donate-notice a {
  color: var(--primary);
  font-weight: bold;
  text-decoration: none;
}

.donate-notice a:hover {
  text-decoration: underline;
}

@media (max-width: 1200px) {
  .donor-item {
    width: calc(25% - 10px); /* 小屏幕每行4个 */
  }
}

@media (max-width: 992px) {
  .donor-item {
    width: calc(33.333% - 10px); /* 更小屏幕每行3个 */
  }
}

@media (max-width: 768px) {
  .sponsor-logo, .ad {
    flex: 0 0 calc(100% - 16px);
  }
  
  .sponsor-logo {
    height: 139px;
    width: 100%;
    max-width: 278px;
    margin: 8px auto;
  }
  
  .ad {
    height: 40px;
    width: 100%;
    max-width: 288px;
    margin: 8px auto;
  }
  
  .donor-item {
    width: calc(50% - 10px);
  }
}

@media (max-width: 480px) {
  .donor-item {
    width: calc(100% - 10px); /* 超小屏幕每行1个 */
    margin-bottom: 10px;
  }
}