/* ===========================================================
   navigations-main.css — AI 资源中心热门资源页面样式
   深色极简风格，与主站设计系统统一
   优化版本 v2：增加呼吸感、层级感、首项高亮
   =========================================================== */

/* ===========================================================
   热门资源板块
   =========================================================== */
.nav-hot-section {
  padding: 48px 0 64px;
  border-top: 1px solid var(--color-border, #334155);
}

/* --- 板块标题 --- */
.nav-hot-title {
  text-align: center;
  margin-bottom: 32px;
}

.nav-hot-title h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text-primary, #f8fafc);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.nav-hot-title p {
  font-size: 14px;
  color: var(--color-text-secondary, #94a3b8);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ===========================================================
   顶部控制区：搜索框 + 分段控制器
   =========================================================== */
.nav-hot-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

/* --- 左侧搜索框 --- */
.nav-hot-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
}

.nav-hot-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  flex-shrink: 0;
}

.nav-hot-search-input {
  width: 100%;
  height: 42px;
  padding: 0 16px 0 40px;
  background: var(--bg-card-alt);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text-primary, #f8fafc);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  box-sizing: border-box;
}

.nav-hot-search-input::placeholder {
  color: var(--color-text-tertiary, #64748b);
  font-size: 13px;
}

.nav-hot-search-input:focus {
  border-color: var(--color-accent, #3b82f6);
  background: var(--bg-card-hover);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 0 20px rgba(59, 130, 246, 0.06);
}

/* --- 右侧分段控制器（胶囊按钮 + 滑动指示器） --- */
.nav-hot-segment {
  display: flex;
  position: relative;
  background: var(--bg-card-alt3);
  border-radius: 100px;
  padding: 4px;
  flex-shrink: 0;
  isolation: isolate;
  overflow: hidden;
}

.nav-hot-segment-slider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 100px;
  background: var(--accent, #3b82f6);
  box-shadow: var(--shadow-nav-seg, 0 2px 8px rgba(59,130,246,0.35));
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
  pointer-events: none;
}

.nav-hot-tab {
  position: relative;
  z-index: 1;
  padding: 8px 24px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.3s ease;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--color-text-secondary, #94a3b8);
  user-select: none;
  line-height: 1.4;
  white-space: nowrap;
}

.nav-hot-tab:hover {
  color: var(--color-text-primary, #f8fafc);
}

.nav-hot-tab.active {
  background: transparent;
  color: var(--text-on-accent);
  box-shadow: none;
}

/* ===========================================================
   分类筛选栏（横向滚动，隐藏滚动条）
   =========================================================== */
.nav-hot-categories {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  overflow-x: auto;
  padding: 4px 0 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-hot-categories::-webkit-scrollbar {
  display: none;
}

.nav-hot-category {
  flex-shrink: 0;
  padding: 7px 20px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  background: var(--bg-card-alt);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  white-space: nowrap;
  user-select: none;
  line-height: 1.4;
}

.nav-hot-category:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-card-hover);
  color: var(--text-primary);
}

.nav-hot-category.active {
  background: var(--gradient-nav-category);
  border-color: transparent;
  color: var(--text-on-accent);
  font-weight: 600;
  box-shadow: var(--shadow-nav-seg);
}

/* ===========================================================
   内容网格区
   大屏 4 列 → 中屏 3 列 → 平板 2 列 → 手机 1 列
   =========================================================== */
.nav-hot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  min-height: 200px;
}

/* --- 首项卡片（恢复为正常单列宽度） --- */
.nav-hot-grid > .nav-hot-card:first-child {
  grid-column: span 1;
  background: linear-gradient(135deg, var(--bg-card-alt2) 0%, var(--bg-card-alt2) 100%);
  border-color: var(--accent-border);
  position: relative;
  overflow: hidden;
}

.nav-hot-grid > .nav-hot-card:first-child::before {
  content: '🌟 推荐';
  position: absolute;
  top: 12px;
  left: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-accent-hover, #60a5fa);
  background: var(--accent-bg-light);
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid var(--accent-border);
  z-index: 2;
}

.nav-hot-grid > .nav-hot-card:first-child:hover {
  border-color: var(--color-accent, #3b82f6);
  background: linear-gradient(135deg, var(--bg-card-hover) 0%, var(--bg-card-alt2) 100%);
}

/* 首项徽标容器调整 */
.nav-hot-grid > .nav-hot-card:first-child .nav-hot-card-badges {
  top: 10px;
  right: 10px;
}

/* 首项卡片内容区域 */
.nav-hot-grid > .nav-hot-card:first-child .nav-hot-card-body {
  padding-top: 0;
}

.nav-hot-grid > .nav-hot-card:first-child .nav-hot-card-title {
  font-size: 15px;
}

.nav-hot-grid > .nav-hot-card:first-child .nav-hot-card-desc {
  -webkit-line-clamp: 2;
}

/* --- 单个卡片 --- */
.nav-hot-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  background: var(--bg-card-alt2);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.28s ease;
  position: relative;
  min-width: 0;
  /* 作为 <a> 标签时去掉默认链接样式 */
  text-decoration: none;
  color: inherit;
}

.nav-hot-card:hover {
  border-color: var(--color-accent, #3b82f6);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.5), 0 4px 12px -4px rgba(0, 0, 0, 0.3);
}

.nav-hot-card-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  /* ========== 赛博磨砂玻璃 ========== */
  background: rgba(20, 20, 25, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  overflow: hidden;
  /* 内发光 + 外溢色投影 */
  box-shadow:
    inset 0 0 20px var(--theme-alpha, rgba(59, 130, 246, 0.3)),
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 0 15px var(--theme-alpha-low, rgba(59, 130, 246, 0.15));
}

.nav-hot-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

/* 无图片时用首字母作为 icon（霓虹灯管效果） */
.nav-hot-card-logo-icon {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-white);
  line-height: 1;
  letter-spacing: 1px;
  text-shadow: 0 0 10px var(--theme-color, #60a5fa);
}

/* --- 卡片内容 --- */
.nav-hot-card-body {
  flex: 1;
  min-width: 0;
}

.nav-hot-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-primary, #f8fafc);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.nav-hot-card:hover .nav-hot-card-title {
  color: var(--color-accent, #3b82f6);
}

.nav-hot-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- 徽章容器（右上角，可容纳多个徽章） --- */
.nav-hot-card-badges {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: row-reverse;
  gap: 4px;
  z-index: 1;
}

/* --- 单个徽章 --- */
.nav-hot-card-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  color: var(--color-accent-hover, #60a5fa);
  background: var(--accent-badge-bg);
  border: 1px solid var(--accent-border);
  line-height: 1.5;
  white-space: nowrap;
}

/* 高热度徽章使用橙色 */
.nav-hot-card-badge.hot {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

/* 极热徽章使用红色 */
.nav-hot-card-badge.trending {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

/* 外链徽章使用绿色 */
.nav-hot-card-badge.ext {
  color: var(--info);
  background: var(--info-bg);
  border-color: var(--info-border);
}

/* --- 卡片隐藏（筛选时渐隐） --- */
.nav-hot-card.hidden {
  display: none;
}

/* --- 空状态 --- */
.nav-hot-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-secondary, #94a3b8);
  font-size: 14px;
}

.nav-hot-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.nav-hot-empty-text {
  font-size: 15px;
  color: var(--color-text-secondary, #94a3b8);
  margin-bottom: 4px;
}

.nav-hot-empty-hint {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ===========================================================
   统计信息行
   =========================================================== */
.nav-hot-stats {
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--color-text-secondary, #94a3b8);
}
.nav-hot-stats-count strong {
  color: var(--color-text-primary, #f8fafc);
  font-weight: 600;
}

/* ===========================================================
   初始加载中
   =========================================================== */
.nav-hot-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
  color: var(--color-text-secondary, #94a3b8);
  font-size: 14px;
  gap: 12px;
}
.nav-hot-loading-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-light);
  border-top-color: var(--color-accent, #3b82f6);
  border-radius: 50%;
  animation: nav-spin 0.8s linear infinite;
}
@keyframes nav-spin {
  to { transform: rotate(360deg); }
}

/* ===========================================================
   加载错误
   =========================================================== */
.nav-hot-error {
  display: none;
  text-align: center;
  padding: 48px 20px;
  color: var(--color-text-secondary, #94a3b8);
  font-size: 14px;
}
.nav-hot-error-message {
  margin: 8px 0 16px;
  font-size: 15px;
  color: var(--color-text-primary, #f8fafc);
}
.nav-hot-error-retry {
  padding: 8px 24px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-card-alt2);
  color: var(--color-accent, #3b82f6);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.nav-hot-error-retry:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-accent, #3b82f6);
}

/* ===========================================================
   骨架屏卡片
   =========================================================== */
.nav-skeleton-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  background: var(--bg-card-alt2);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  min-width: 0;
}
.nav-skeleton-shimmer {
  background: var(--gradient-shimmer);
  background-size: 200% 100%;
  animation: nav-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes nav-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 首项骨架屏恢复正常单列 */
.nav-skeleton-card:first-child {
  grid-column: span 1;
}

/* ===========================================================
   加载更多：三点跳动动画
   =========================================================== */
.nav-hot-bouncing-dots {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 24px 0;
}
.nav-hot-bouncing-dots .nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent, #3b82f6);
  animation: nav-bounce 1.4s ease-in-out infinite;
}
.nav-hot-bouncing-dots .nav-dot:nth-child(1) { animation-delay: 0s; }
.nav-hot-bouncing-dots .nav-dot:nth-child(2) { animation-delay: 0.2s; }
.nav-hot-bouncing-dots .nav-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes nav-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===========================================================
   已全部加载完毕
   =========================================================== */
.nav-hot-end {
  display: none;
  text-align: center;
  padding: 20px 0 40px;
  color: var(--color-text-tertiary, #64748b);
  font-size: 13px;
}
.nav-hot-end span {
  display: inline-block;
  padding: 0 16px;
  position: relative;
}
.nav-hot-end span::before,
.nav-hot-end span::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40px;
  height: 1px;
  background: var(--border-light);
}
.nav-hot-end span::before { right: 100%; }
.nav-hot-end span::after { left: 100%; }

/* ===========================================================
   哨兵元素（不可见，仅供 IntersectionObserver 触发）
   =========================================================== */
#nav-hot-sentinel {
  height: 1px;
  pointer-events: none;
}

/* ===========================================================
   响应式适配
   =========================================================== */

/* 1200px — 桌面紧凑 */
@media (max-width: 1200px) {
  .nav-hot-grid {
    gap: 14px;
  }
}

/* 1024px — 平板横屏 */
@media (max-width: 1024px) {
  .nav-hot-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  /* 首项恢复正常单列 */
  .nav-hot-grid > .nav-hot-card:first-child {
    grid-column: span 1;
  }

  .nav-hot-section {
    padding: 40px 0 48px;
  }
}

/* 768px — 平板竖屏 */
@media (max-width: 768px) {
  .nav-hot-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* 首项恢复正常单列 */
  .nav-hot-grid > .nav-hot-card:first-child,
  .nav-skeleton-card:first-child {
    grid-column: span 1;
  }

  .nav-hot-controls {
    flex-direction: column;
    gap: 12px;
  }

  .nav-hot-search-wrapper {
    width: 100%;
  }

  .nav-hot-segment {
    width: 100%;
    justify-content: stretch;
  }

  .nav-hot-tab {
    flex: 1;
    text-align: center;
    padding: 8px 16px;
    font-size: 13px;
  }

  .nav-hot-category {
    padding: 6px 16px;
    font-size: 12px;
  }

  .nav-hot-categories {
    gap: 10px;
    margin-bottom: 22px;
  }

  .nav-hot-title h2 {
    font-size: 22px;
  }

  .nav-hot-title p {
    font-size: 13px;
  }

  .nav-hot-card {
    padding: 16px;
  }

  .nav-hot-card-title {
    font-size: 14px;
  }

  .nav-hot-card-desc {
    font-size: 11px;
  }

  .nav-hot-card-logo {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .nav-hot-section {
    padding: 32px 0 40px;
  }

  /* 首项平板适配 */
  .nav-hot-grid > .nav-hot-card:first-child .nav-hot-card-title {
    font-size: 15px;
  }

  .nav-hot-grid > .nav-hot-card:first-child .nav-hot-card-desc {
    -webkit-line-clamp: 2;
  }

  .nav-hot-grid > .nav-hot-card:first-child .nav-hot-card-body {
    padding-top: 0;
  }

  .nav-hot-grid > .nav-hot-card:first-child::before {
    top: 8px;
    left: 12px;
    font-size: 10px;
    padding: 2px 8px;
  }
}

/* 480px — 手机 */
@media (max-width: 480px) {
  .nav-hot-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* 手机端首项恢复正常单列 */
  .nav-hot-grid > .nav-hot-card:first-child,
  .nav-skeleton-card:first-child {
    grid-column: 1;
  }

  .nav-hot-controls {
    flex-direction: column;
    gap: 10px;
  }

  .nav-hot-search-wrapper {
    width: 100%;
  }

  .nav-hot-segment {
    width: 100%;
    justify-content: stretch;
  }

  .nav-hot-tab {
    flex: 1;
    text-align: center;
    padding: 7px 14px;
    font-size: 12px;
  }

  .nav-hot-category {
    padding: 5px 14px;
    font-size: 11px;
  }

  .nav-hot-categories {
    gap: 8px;
  }

  .nav-hot-card {
    padding: 14px;
    gap: 12px;
  }

  .nav-hot-card-logo {
    width: 38px;
    height: 38px;
    font-size: 17px;
  }

  .nav-hot-card-title {
    font-size: 13px;
  }

  .nav-hot-card-desc {
    font-size: 11px;
  }

  .nav-hot-title h2 {
    font-size: 20px;
  }

  .nav-hot-section {
    padding: 28px 0 36px;
  }

  /* 首项手机端恢复正常 */
  .nav-hot-grid > .nav-hot-card:first-child {
    background: var(--bg-card-alt2);
    border-color: var(--border-light);
  }

  .nav-hot-grid > .nav-hot-card:first-child::before {
    display: none;
  }
}
