/* 星逸API - 应用专用样式 */
/* 基于Material Design 3的应用级样式定义 */

/* 主布局样式 */
.main-content {
  margin-left: 0;
  min-height: 100vh;
  transition: margin-left 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.main-content.nav-open {
  margin-left: 280px;
}

/* 顶部栏样式 */
.top-bar {
  display: flex;
  align-items: center;
  padding: 16px;
  background: var(--md-sys-color-surface);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.menu-btn {
  min-width: 40px;
  height: 40px;
  padding: 0;
}

.site-title {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

/* 导航栏样式增强 */
.nav-header {
  padding: 24px 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.nav-logo {
  width: 48px;
  height: 48px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-radius: var(--md-sys-shape-corner-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.nav-items {
  flex: 1;
  padding: 16px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  margin: 4px 8px;
  border-radius: var(--md-sys-shape-corner-medium);
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  position: relative;
  gap: 12px;
}

.nav-item:hover {
  background: var(--md-sys-color-surface-variant);
}

.nav-item.active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.nav-item .material-symbols-outlined {
  font-size: 24px;
}

.nav-label {
  font-size: 14px;
  font-weight: 500;
}

.nav-footer {
  padding: 16px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* 主题选择器 */
.theme-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
  background: transparent;
  padding: 4px;
}

.theme-btn:hover {
  transform: scale(1.1);
}

.theme-btn.active {
  box-shadow: 0 0 0 2px var(--md-sys-color-primary);
}

.theme-color {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--md-sys-color-outline-variant);
}

/* 首页横幅样式 */
.hero-section {
  padding: 48px 0;
  background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-secondary-container));
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255, 255, 255, 0.02) 10px,
    rgba(255, 255, 255, 0.02) 20px
  );
  pointer-events: none;
}

.hero-content {
  text-align: center;
  position: relative;
  z-index: 1;
}

.hero-title {
  margin-bottom: 16px;
  color: var(--md-sys-color-on-primary-container);
}

.hero-subtitle {
  font-size: 18px;
  color: var(--md-sys-color-on-primary-container);
  margin-bottom: 32px;
  opacity: 0.8;
}

/* 搜索容器样式 */
.search-container {
  margin: 32px 0;
  position: relative;
}

.search-container .md-search-field {
  max-width: 600px;
  margin: 0 auto;
}

/* 统计数据样式 */
.stats-section {
  margin-top: 32px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: var(--md-sys-elevation-level2);
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-radius: var(--md-sys-shape-corner-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-content {
  flex: 1;
}

.stat-number {
  font-size: 24px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
}

/* 章节样式 */
.apis-section, .friendship-section {
  padding: 48px 0;
}

.section-header {
  text-align: center;
  margin-bottom: 32px;
}

.section-title {
  margin-bottom: 8px;
  color: var(--md-sys-color-on-background);
}

.section-subtitle {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 16px;
}

/* API网格样式 */
.api-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

/* API卡片样式 */
.api-card {
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  border: 1px solid var(--md-sys-color-outline-variant);
  position: relative;
  overflow: hidden;
}

.api-card:hover {
  box-shadow: var(--md-sys-elevation-level3);
  transform: translateY(-2px);
}

.api-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.api-title {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.api-status {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--md-sys-shape-corner-small);
  font-weight: 500;
  white-space: nowrap;
}

.api-status.active {
  background: rgba(76, 175, 80, 0.1);
  color: #4CAF50;
}

.api-status.maintenance {
  background: rgba(255, 152, 0, 0.1);
  color: #FF9800;
}

.api-status.inactive {
  background: rgba(158, 158, 158, 0.1);
  color: #9E9E9E;
}

.api-description {
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 16px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.api-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.api-meta .md-chip {
  font-size: 12px;
  padding: 4px 8px;
}

.api-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.api-calls {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}

.api-calls .material-symbols-outlined {
  font-size: 16px;
}

.api-actions {
  display: flex;
  gap: 8px;
}

.api-actions .md-button-text,
.api-actions .md-button-filled {
  padding: 8px 12px;
  min-height: 32px;
  font-size: 12px;
  gap: 4px;
}

.api-actions .material-symbols-outlined {
  font-size: 16px;
}

/* 空状态样式 */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  background: var(--md-sys-color-surface-variant);
}

.empty-icon {
  font-size: 48px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 16px;
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--md-sys-color-on-surface);
}

.empty-state p {
  color: var(--md-sys-color-on-surface-variant);
}

/* 友情链接样式 */
.friendship-grid {
  max-width: 800px;
  margin: 0 auto;
}

.friendship-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.friendship-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  position: relative;
}

.friendship-card:hover {
  box-shadow: var(--md-sys-elevation-level2);
  transform: translateY(-1px);
}

.friendship-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--md-sys-shape-corner-small);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--md-sys-color-surface-variant);
}

.friendship-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friendship-info {
  flex: 1;
  min-width: 0;
}

.friendship-name {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friendship-desc {
  margin: 0;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friendship-link-icon {
  font-size: 16px;
  color: var(--md-sys-color-on-surface-variant);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.friendship-card:hover .friendship-link-icon {
  opacity: 1;
}

/* 运行时间样式 */
.runtime-section {
  padding: 14px 0;
  background: var(--md-sys-color-surface-variant);
  display: flex;
  align-items: center;
}

.runtime-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 10px;
  margin: 0 auto;
  max-width: 400px;
  background: var(--md-sys-color-surface);
  text-align: center;
}

.runtime-display .material-symbols-outlined {
  color: var(--md-sys-color-primary);
  font-size: 20px;
}

.run-time {
  font-size: 14px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  text-align: center;
}

/* 页脚样式 */
.site-footer {
  background: var(--md-sys-color-surface);
  border-top: 1px solid var(--md-sys-color-outline-variant);
  padding: 32px 0;
  margin-top: 48px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.footer-info {
  flex: 1;
}

.copyright {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--md-sys-color-on-surface);
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.icp-info, .security-info {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}

.footer-actions {
  display: flex;
  gap: 8px;
}

.back-to-top {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--md-sys-color-primary);
  font-size: 14px;
}

/* 搜索结果样式 */
.search-results {
  margin-bottom: 32px;
}

.search-header {
  margin-bottom: 16px;
  text-align: center;
}

.search-loading, .search-error, .no-results {
  text-align: center;
  padding: 32px;
  background: var(--md-sys-color-surface-variant);
  border-radius: var(--md-sys-shape-corner-medium);
}

.no-results-icon, .error-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .api-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
  }
}

@media (max-width: 768px) {
  .hero-section {
    padding: 32px 0;
  }
  
  .hero-title {
    font-size: 28px;
  }
  
  .hero-subtitle {
    font-size: 16px;
  }
  
  .apis-section, .friendship-section {
    padding: 32px 0;
  }
  
  .api-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .friendship-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .friendship-card {
    padding: 12px;
  }
  
  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  
  .footer-links {
    justify-content: center;
  }
  
  .api-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .api-card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .api-actions {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .search-container .md-search-field {
    max-width: 100%;
    /* margin: 0 16px; */
  }
  
  .stat-card {
    padding: 16px;
  }
  
  .stat-number {
    font-size: 20px;
  }
  
  .api-card {
    padding: 16px;
  }
  
  .section-header {
    margin-bottom: 24px;
  }
  
  .section-title {
    font-size: 24px;
  }
}

/* 加载动画 */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading-skeleton {
  animation: pulse 1.5s ease-in-out infinite;
}

/* 工具提示样式 */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  padding: 4px 8px;
  border-radius: var(--md-sys-shape-corner-small);
  font-size: 12px;
  white-space: nowrap;
  box-shadow: var(--md-sys-elevation-level2);
  z-index: 1000;
  margin-bottom: 4px;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--md-sys-color-surface-variant);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--md-sys-color-outline);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--md-sys-color-outline-variant);
}

/* 高对比度模式适配 */
@media (prefers-contrast: high) {
  .api-card, .friendship-card, .stat-card {
    border: 2px solid var(--md-sys-color-outline);
  }
  
  .md-button-filled {
    border: 2px solid var(--md-sys-color-on-primary);
  }
  
  .md-button-outlined {
    border-width: 2px;
  }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}