/* ===== 测试列表页 — 文档风格侧边栏布局 ===== */

/* 页面容器 — 为侧边栏留空间 */
.page-wrapper {
  display: flex;
  min-height: calc(100vh - var(--nav-height) - 100px);
  margin-top: var(--nav-height);
}

/* ===== 侧边栏（深色半透明） ===== */
.sidebar {
  width: 260px;
  min-width: 260px;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  height: calc(100vh - var(--nav-height));
  background: var(--bg-card-hover);
  backdrop-filter: blur(8px);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 24px 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

/* 侧边栏搜索框 */
.sidebar-search {
  padding: 0 20px;
  margin-bottom: 20px;
}

.sidebar-search input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: var(--bg-container);
  color: var(--text-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.sidebar-search input:focus {
  border-color: rgba(42, 88, 143, 0.6);
}

.sidebar-search input::placeholder {
  color:var(--text-dim);
}

.sidebar-search .search-icon-wrap {
  position: relative;
}

.sidebar-search .search-icon-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  pointer-events: none;
}

/* 侧边栏导航列表 */
.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
}

.sidebar-nav li {
  margin: 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.95rem;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-white);
}

.sidebar-nav a.active {
  background: rgba(71, 135, 213, 0.15);
  color: var(--color-link);
  border-left-color: var(--color-accent);
  font-weight: 600;
}

.sidebar-nav a .badge {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-light);
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}

/* 侧边栏分隔线 */
.sidebar-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 12px 20px;
}

/* 侧边栏底部返回链接 */
.sidebar-footer {
  padding: 16px 24px 0;
  margin-top: auto;
}

.sidebar-footer a {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.sidebar-footer a:hover {
  color: rgba(255, 255, 255, 0.85);
}

/* ===== 主内容区 ===== */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 30px 40px 60px;
  width: 100%;
}

/* 移动端搜索栏 — 默认隐藏，移动端显示 */
.mobile-search {
  display: none;
  position: relative;
  margin-bottom: 24px;
}

.mobile-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.95rem;
  pointer-events: none;
}

.mobile-search input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: var(--bg-container);
  color: var(--text-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.mobile-search input:focus {
  border-color: rgba(42, 88, 143, 0.6);
}

.mobile-search input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* 分类区块 */
.category-section {
  margin-bottom: 50px;
}

.category-section:last-child {
  margin-bottom: 30px;
}

.category-title {
  font-size: 1.6rem;
  color: var(--color-accent);
  margin-bottom: 6px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(42, 88, 143, 0.25);
}

.category-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

/* 卡片网格 */
.tests-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

/* 测试卡片 */
.test-card {
  display: block;
  background: var(--bg-card-hover);
  border-radius: 12px;
  padding: 20px 22px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.test-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.test-card:hover::after {
  content: "点击进入 →";
  position: absolute;
  bottom: 16px;
  right: 20px;
  color: var(--color-accent);
  font-size: 0.85rem;
  opacity: 0.9;
}

.test-title {
  font-size: 1.15rem;
  color: var(--text-light);
  margin: 0 0 8px;
  font-weight: 600;
}

.test-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag {
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 0.75rem;
  background: var(--color-tag-default-bg);
  color: var(--color-tag-default-text);
}

.tag.neuro    { background: var(--tag-neuro-bg); color: var(--tag-neuro-text); }
.tag.autism   { background: var(--tag-autism-bg); color: var(--tag-autism-text); }
.tag.fun      { background: var(--tag-fun-bg); color: var(--tag-fun-text); }
.tag.child    { background: var(--tag-child-bg); color: var(--tag-child-text); }
.tag.internet { background: var(--tag-internet-bg); color: var(--tag-internet-text); }
.tag.new      { background: var(--tag-new-bg); color: var(--tag-new-text); }

.test-desc {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0;
}

/* 资源卡片 — 列表式 */
.resource-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.resource-card {
  background: var(--bg-card-light);
  border-radius: 10px;
  padding: 18px 20px;
  transition: all 0.25s ease;
}

.resource-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.resource-card h3 {
  color: var(--color-link);
  font-size: 1.05rem;
  margin: 0 0 8px;
}

.resource-card p {
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0 0 12px;
}

.resource-card .res-link {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

.resource-card .res-link:hover {
  text-decoration: underline;
}

/* 无结果提示 */
.no-results {
  display: none;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-subtle);
  font-size: 1.1rem;
}

.no-results.visible {
  display: block;
}

/* 移动端侧边栏切换按钮 */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: calc(var(--nav-height) + 10px);
  left: 10px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(13, 20, 38, 0.9);
  color: var(--color-accent);
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* 移动端遮罩 */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--nav-height);
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 280px;
    min-width: 280px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px 40px;
  }

  .mobile-search {
    display: block;
  }

  .tests-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .resource-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .category-title {
    font-size: 1.3rem;
  }

  .tests-grid {
    grid-template-columns: 1fr;
  }

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

  .test-card {
    padding: 14px 16px;
  }

  .test-title {
    font-size: 1rem;
  }

  .test-desc {
    display: none;
  }

  .test-card:hover::after {
    content: none;
  }
}
