/* ============================================
   PAGES - 页面级样式
   ============================================ */

/* ---------- 顶部工具栏 ---------- */
.top-bar {
  background-color: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
  padding: var(--space-2) 0;
}

/* ---------- 头部 ---------- */
.header {
  background-color: white;
  border-bottom: 1px solid var(--gray-200);
  padding: var(--space-4) 0;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  text-decoration: none;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--primary-700);
  line-height: 1.2;
}

.logo-subtitle {
  font-size: var(--text-xs);
  color: var(--gray-500);
  letter-spacing: 0.05em;
}

.search-box {
  flex: 1;
  max-width: 560px;
}

.search-box .input-group {
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--primary-500);
}

.search-box .input {
  border: none;
  padding: 10px 16px;
  font-size: var(--text-sm);
  height: 40px;
  box-sizing: border-box;
}

.search-box .btn {
  padding: 10px 24px;
  border-radius: 0;
  height: 40px;
  box-sizing: border-box;
  font-size: var(--text-sm);
  white-space: nowrap;
}

.search-hot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ---------- 主导航 ---------- */
.main-nav {
  background-color: var(--primary-700);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-item {
  display: block;
  padding: var(--space-4) var(--space-6);
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  border-radius: var(--radius-md);
}

.nav-item:hover,
.nav-item.active {
  color: white;
  background-color: rgba(255, 255, 255, 0.15);
}

/* 建设中导航项 */
.nav-item.nav-building {
  position: relative;
  padding-right: var(--space-10);
}
.nav-item.nav-building .nav-badge {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-block;
  padding: 1px 6px;
  background: #f59e0b;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 9999px;
  line-height: 1.4;
}
.nav-item.nav-building:hover .nav-badge {
  background: #fbbf24;
}

/* 导航 Hot 标记 */
.nav-item .nav-hot {
  display: inline-block;
  padding: 1px 6px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9999px;
  line-height: 1.4;
  margin-left: 4px;
  vertical-align: middle;
  animation: nav-hot-pulse 1.5s ease-in-out infinite;
}
@keyframes nav-hot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ---------- 分类区域 ---------- */
.category-section {
  padding: var(--space-6) 0;
  background-color: white;
}

/* 分类面板 - 左侧列表 + 右侧弹出 */
.cat-panel {
  display: flex;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  background: white;
  min-height: 420px;
}

/* 左侧一级分类 */
.cat-panel-left {
  width: 220px;
  flex-shrink: 0;
  background: var(--primary-700);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  display: flex;
  flex-direction: column;
}

.cat-panel-title {
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  color: white;
}

.cat-panel-list {
  flex: 1;
  overflow-y: auto;
}

.cat-panel-list::-webkit-scrollbar {
  width: 3px;
}

.cat-panel-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
}

.cat-panel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.cat-panel-item:hover,
.cat-panel-item.active {
  background: rgba(255,255,255,0.15);
  color: white;
  border-left-color: white;
}

.cat-panel-other {
  margin-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 12px;
}

.cat-panel-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.cat-panel-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-panel-arrow {
  color: rgba(255,255,255,0.5);
  font-size: 16px;
  flex-shrink: 0;
}

/* 右侧弹出面板 */
.cat-panel-right {
  flex: 1;
  min-height: 420px;
  overflow: hidden;
}

.cat-sub-panel {
  display: none;
  flex-direction: column;
  height: 100%;
}

.cat-sub-panel.active {
  display: flex;
}

.cat-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--gray-100);
}

.cat-sub-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
}

.cat-sub-more {
  font-size: 13px;
  color: var(--primary-600);
  text-decoration: none;
}

.cat-sub-more:hover {
  color: var(--primary-800);
  text-decoration: underline;
}

/* 面板主体 - 双列行布局 */
.cat-sub-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
  max-height: 420px;
}

.cat-sub-body::-webkit-scrollbar {
  width: 4px;
}

.cat-sub-body::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 2px;
}

/* 每行：左列标题 + 右列标签 */
.cat-sub-row {
  display: flex;
  align-items: flex-start;
  padding: 8px 20px;
  border-bottom: 1px solid var(--gray-50);
  line-height: 1.6;
}

.cat-sub-row:last-child {
  border-bottom: none;
}

.cat-sub-row:hover {
  background: var(--gray-25, #fafafa);
}

/* 左列：二级分类标题 */
.cat-sub-label {
  width: 100px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  padding-top: 2px;
}

.cat-sub-label a {
  color: var(--gray-800);
  text-decoration: none;
}

.cat-sub-label a:hover {
  color: var(--primary-600);
}

/* 右列：检测项目标签 */
.cat-sub-tags {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.cat-sub-tags a {
  font-size: 13px;
  color: var(--gray-600);
  text-decoration: none;
  white-space: nowrap;
  padding: 2px 0;
  transition: color 0.15s;
}

.cat-sub-tags a:hover {
  color: var(--primary-600);
}

/* 默认隐藏超出的标签 */
.cat-tag-extra {
  display: none;
}

/* 展开某行后换行显示 */
.cat-sub-row.expanded .cat-sub-tags {
  /* 在"更多"按钮处断行，额外项从新行开始 */
}

.cat-sub-row.expanded .cat-tag-extra {
  display: inline;
}

.cat-sub-row.expanded .cat-tag-more {
  flex-basis: 100%;
  margin-bottom: 4px;
}

/* "更多"按钮 */
.cat-tag-more {
  font-size: 12px;
  color: var(--primary-600);
  cursor: pointer;
  padding: 2px 6px;
  border: 1px solid var(--primary-200);
  border-radius: 3px;
  user-select: none;
  white-space: nowrap;
  background: var(--primary-50);
}

.cat-tag-more:hover {
  background: var(--primary-100);
  color: var(--primary-800);
}

/* 其他分类 - 三列布局 */
.cat-other-panel {
  padding: 0;
}

.cat-other-three {
  display: flex;
  height: 100%;
  min-height: 420px;
}

.cat-other-col {
  flex: 1;
  min-width: 0;
  border-right: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
}

.cat-other-col:last-child {
  border-right: none;
}

.cat-other-col-title {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
}

.cat-other-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.cat-other-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.cat-other-item:hover {
  background: var(--primary-50);
  color: var(--primary-700);
}

.cat-other-item.active {
  background: var(--primary-50);
  color: var(--primary-700);
  border-left-color: var(--primary-500);
  font-weight: 500;
}

.cat-other-item.cat-other-link {
  text-decoration: none;
  cursor: pointer;
  display: block;
  padding: 8px 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-other-arrow {
  color: var(--gray-400);
  font-size: 14px;
}

.cat-other-item:hover .cat-other-arrow,
.cat-other-item.active .cat-other-arrow {
  color: var(--primary-500);
}

/* 右侧主内容 */
.category-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Banner */
.banner-slider {
  border-radius: var(--radius-xl);
  overflow: hidden;
  height: 280px;
  position: relative;
}

.banner-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: var(--space-10);
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.banner-slide.active {
  opacity: 1;
}

.banner-content {
  position: relative;
  z-index: 1;
  color: white;
  max-width: 400px;
}

.banner-content h2 {
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.banner-content p {
  font-size: var(--text-lg);
  opacity: 0.9;
  margin-bottom: var(--space-6);
}

.banner-bg {
  position: absolute;
  inset: 0;
}

/* 快捷入口 */
.quick-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.quick-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6);
  background-color: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}

.quick-link-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary-300);
}

.quick-link-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-link-title {
  font-weight: 600;
  color: var(--gray-800);
}

.quick-link-desc {
  font-size: var(--text-xs);
  color: var(--gray-500);
}

/* ---------- 通用区块 ---------- */
.section {
  padding: var(--space-16) 0;
}

.section-alt {
  background-color: white;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
}

.section-header.text-center {
  flex-direction: column;
  text-align: center;
  gap: var(--space-2);
}

.section-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--gray-800);
}

.section-subtitle {
  font-size: var(--text-base);
  color: var(--gray-500);
}

.section-more {
  font-size: var(--text-sm);
  color: var(--primary-600);
  font-weight: 500;
}

.section-more:hover {
  color: var(--primary-700);
}

/* ---------- 服务卡片 ---------- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}

.service-card {
  background-color: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.service-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.service-card-image {
  height: 160px;
  background-color: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
}

.service-card-placeholder {
  font-size: 48px;
}

.service-card-body {
  padding: var(--space-5);
}

.service-card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: var(--space-2);
}

.service-card-desc {
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin-bottom: var(--space-4);
}

.service-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.service-card-price {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--error);
}

/* ---------- 机构卡片 ---------- */
.institution-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.institution-card {
  background-color: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-normal);
}

.institution-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-300);
}

.institution-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.institution-logo {
  width: 56px;
  height: 56px;
  background-color: var(--primary-600);
  color: white;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-lg);
}

.institution-name {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--gray-800);
}

.institution-rating {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.stars {
  color: var(--warning);
  font-size: var(--text-sm);
}

.rating-score {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-700);
}

.institution-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.institution-tags {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.institution-desc {
  font-size: var(--text-sm);
  color: var(--gray-500);
  line-height: 1.6;
}

.institution-stats {
  display: flex;
  gap: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--gray-200);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stat-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--primary-600);
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--gray-500);
}

/* ---------- 特色功能 ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-8);
}

.feature-card {
  text-align: center;
  padding: var(--space-8) var(--space-6);
}

.feature-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-6);
}

.feature-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: var(--space-3);
}

.feature-desc {
  font-size: var(--text-sm);
  color: var(--gray-500);
  line-height: 1.6;
}

/* ---------- 流程步骤 ---------- */
.process-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}

.process-step {
  text-align: center;
  padding: var(--space-8);
  background-color: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--gray-200);
  min-width: 200px;
  position: relative;
}

.process-number {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  background-color: var(--primary-600);
  color: white;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
}

.process-icon {
  font-size: 40px;
  margin-bottom: var(--space-4);
}

.process-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: var(--space-2);
}

.process-desc {
  font-size: var(--text-sm);
  color: var(--gray-500);
}

.process-arrow {
  font-size: var(--text-2xl);
  color: var(--primary-400);
  font-weight: 700;
}

/* ---------- 资讯卡片 ---------- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.news-card {
  background-color: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.news-card:hover {
  box-shadow: var(--shadow-md);
}

.news-image {
  height: 180px;
  background-color: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-placeholder {
  font-size: 48px;
}

.news-body {
  padding: var(--space-5);
}

.news-category {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background-color: var(--primary-100);
  color: var(--primary-700);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-3);
}

.news-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: var(--space-2);
  line-height: 1.4;
}

.news-desc {
  font-size: var(--text-sm);
  color: var(--gray-500);
  line-height: 1.6;
  margin-bottom: var(--space-4);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-date {
  font-size: var(--text-xs);
  color: var(--gray-400);
}

/* ---------- 页脚 ---------- */
.footer {
  background-color: var(--gray-800);
  color: var(--gray-300);
  padding-top: var(--space-16);
  margin-top: auto;
}

/* 确保页面最小高度 */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: var(--space-12);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid var(--gray-700);
}

.footer-logo {
  margin-bottom: var(--space-4);
}

.footer-logo-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: white;
}

.footer-logo-subtitle {
  font-size: var(--text-sm);
  color: var(--gray-400);
  margin-left: var(--space-2);
}

.footer-desc {
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--gray-400);
}

.footer-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: white;
  margin-bottom: var(--space-4);
}

.footer-links li {
  margin-bottom: var(--space-3);
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--gray-400);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: white;
}

.footer-contact li {
  font-size: var(--text-sm);
  color: var(--gray-400);
  margin-bottom: var(--space-3);
}

.footer-bottom {
  padding: var(--space-6) 0;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--gray-500);
}

/* ============================================
   响应式适配
   ============================================ */
@media (max-width: 1024px) {
  .service-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cat-panel {
    flex-direction: column;
    min-height: auto;
  }

  .cat-panel-left {
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .cat-panel-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
  }

  .cat-panel-item {
    padding: 8px 12px;
    font-size: 13px;
    border-left: none;
    border-bottom: 3px solid transparent;
  }

  .cat-panel-right {
    min-height: 300px;
  }
}

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: var(--space-4);
  }
  
  .search-box {
    max-width: 100%;
    width: 100%;
  }
  
  .nav-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0;
  }
  
  .nav-item {
    white-space: nowrap;
    padding: var(--space-3) var(--space-4);
  }
  
  .service-grid,
  .news-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .institution-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }
  
  .quick-links {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .process-steps {
    flex-direction: column;
  }
  
  .process-arrow {
    transform: rotate(90deg);
  }
  
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .service-grid,
  .news-grid {
    grid-template-columns: 1fr;
  }
  
  .quick-links {
    grid-template-columns: 1fr;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
  }
  
  .section {
    padding: var(--space-10) 0;
  }
}
