/* 三栏固定布局：页眉/页脚留白（与 styles.css 中 fixed footer 一致） */
:root {
  --tech-header-offset: 70px;
  --tech-chrome-bottom: 108px;
}

@media (max-height: 720px) {
  :root {
    --tech-header-offset: 64px;
    --tech-chrome-bottom: 116px;
  }
}

/* 主页工具卡片样式修复 - 长方形布局，左边图标，右边标题和描述 */
.card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 12px; /* 减少内边距 */
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  height: 70px; /* 减少高度 */
  display: flex;
  flex-direction: row; /* 横向布局 */
  align-items: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  border-color: #7c3aed;
}

.card img {
  width: 40px; /* 减少图标大小 */
  height: 40px;
  border-radius: 8px;
  margin-right: 12px; /* 减少右边距 */
  object-fit: cover;
  flex-shrink: 0; /* 图标不缩放 */
}

.card .meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left; /* 左对齐 */
}

.card .card-title {
  font-weight: 600;
  font-size: 13px; /* 减少字体大小 */
  color: #333;
  margin: 0 0 2px 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card .card-desc {
  color: #666;
  font-size: 11px; /* 减少字体大小 */
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card .meta strong {
  color: #333;
  font-size: 16px;
  line-height: 1.4;
}

.card .meta div {
  margin-bottom: 8px;
}

.card .badge.rating {
  background: #ff9500;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
}

.card .tag {
  background: #f0f0f0;
  color: #666;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  margin-right: 4px;
  margin-bottom: 4px;
  display: inline-block;
}

.card .btn {
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 12px;
  margin-right: 8px;
}

.card .btn.primary {
  background: #007bff;
  color: white;
}

.card .btn {
  background: #f8f9fa;
  color: #333;
  border: 1px solid #dee2e6;
}

.card .btn:hover {
  background: #e9ecef;
}

/* 工具滚动容器 - 固定边界，内部可滚动 */
#tools-scroll-container {
  position: fixed !important;
  top: 250px !important; /* 广告位下方，增加间距 */
  left: 280px !important; /* 增加左边距，避免压住左侧分类 */
  right: 250px !important; /* 增加右边距，保持对称 */
  bottom: var(--tech-chrome-bottom) !important;
  overflow-y: auto; /* 允许垂直滚动 */
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  background: #fafafa;
  padding: 20px 16px 16px 16px; /* 增加上边距，让卡片区域往下一点 */
  z-index: 80 !important;
}

/* 工具容器网格布局 - 长方形卡片布局 */
#tools-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0;
}

/* 分类区域样式 */
.category-section {
  margin-bottom: 24px;
}

/* 分类标题样式 */
.category-title {
  color: #007bff;
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #007bff;
}

/* 分类卡片容器 */
.category-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* 一行5个卡片 */
  gap: 12px;
}

/* 分类网格布局 */
#tools-container .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

/* 左侧分类：外框固定；标题固定，仅列表区滚动 */
#left-nav {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: fixed !important;
  top: var(--tech-header-offset) !important;
  bottom: var(--tech-chrome-bottom) !important;
  left: 50px !important;
  width: 200px !important;
  z-index: 50 !important;
  height: auto !important;
  max-height: none !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-sizing: border-box;
}

#left-nav .left-nav-heading {
  flex-shrink: 0;
  margin: 0 0 8px;
  padding-bottom: 8px;
  text-align: center;
  font-weight: 600;
  color: #6b7280;
  background: #f8f9fa;
  border-bottom: 1px solid #e6ebf5;
}

#left-nav .left-nav-list {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  gap: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

#left-nav .left-nav-list::-webkit-scrollbar {
  width: 6px;
}

#left-nav .left-nav-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.55);
  border-radius: 999px;
}

#left-nav .btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 8px;
  text-align: left;
  border: none;
  background: transparent;
  color: #333;
  border-radius: 6px;
  transition: all 0.2s;
  cursor: pointer;
}

#left-nav .btn:hover {
  background: #e9ecef;
  transform: translateX(4px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#left-nav .btn.active {
  background: #007bff;
  color: white;
  box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

/* 右侧 AI 门户推荐：与左侧对称，视口内独立滚动，避免被 fixed footer 遮挡 */
#right-rail {
  position: fixed !important;
  top: var(--tech-header-offset) !important;
  bottom: var(--tech-chrome-bottom) !important;
  right: 20px !important;
  width: 200px !important;
  z-index: 50 !important;
  height: auto !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  padding-bottom: 12px;
}

#right-rail::-webkit-scrollbar {
  width: 6px;
}

#right-rail::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.55);
  border-radius: 999px;
}

/* 搜索栏样式 - 参考360AI导航风格 */
.search {
  position: fixed !important;
  top: 50px !important; /* 与左侧分类上边缘齐平 */
  left: 280px !important; /* 增加左边距，避免压住左侧分类 */
  right: 250px !important; /* 增加右边距，保持对称 */
  z-index: 100 !important;
  background: transparent !important; /* 移除大白底 */
  padding: 16px 0;
  margin-bottom: 0; /* 移除下边距，因为现在是固定定位 */
  height: 80px; /* 固定高度 */
}

.search input {
  width: 100%;
  height: 48px;
  border: 2px solid #e0e0e0;
  border-radius: 24px;
  background: #f8f9fa;
  color: #333;
  padding: 0 20px;
  font-size: 16px;
  transition: all 0.3s ease;
}

.search input:focus {
  outline: none;
  border-color: #7c3aed;
  background: white;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* 中间内容区域样式 - 绝对定位 */
.ad-card {
  position: fixed !important;
  top: 130px !important; /* 搜索栏下方 */
  left: 280px !important; /* 左侧分类右边 */
  right: 250px !important; /* 右侧推荐左边 */
  z-index: 90 !important;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  margin: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  text-align: center;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 分类标题样式 */
.section-title {
  color: #007bff;
  font-size: 18px;
  font-weight: 600;
  margin: 24px 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #007bff;
}

/* 加载指示器 */
#loading-indicator {
  text-align: center;
  padding: 20px;
  color: #666;
}

/* 空状态样式 */
.empty-state {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 14px;
}
