/**
 * layout.css - 页面布局样式
 * 说明：包含首页搜索区域、热门应用、新闻、数据统计、吸顶搜索框等布局样式
 * 适用：index.html（首页）
 * 依赖：base.css
 */

/* ========== 搜索区域 ========== */
.search-section {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.92) 0%, rgba(30, 64, 175, 0.95) 100%);
  padding: 80px 20px 60px;
  color: white;
  position: relative;
}

.search-container {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.main-title {
  font-size: 36px;
  font-weight: 600;
  margin-bottom: 12px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sub-title {
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 40px;
}

.search-box {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

.search-type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  justify-content: center;
}

.type-btn {
  padding: 6px 16px;
  border: 1px solid var(--border-color);
  background: white;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.type-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.type-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.search-input-wrapper {
  display: flex;
  gap: 12px;
}

.search-input {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 16px;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.search-btn {
  padding: 14px 32px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.search-btn:hover {
  background: var(--primary-hover);
}

.hot-search {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.hot-label {
  font-size: 14px;
  opacity: 0.8;
}

.hot-tag {
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  text-decoration: none;
  border-radius: 14px;
  font-size: 13px;
  transition: background 0.2s;
}

.hot-tag:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ========== 搜索区域内的热门搜索 ========== */
.hot-search-wrapper {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.hot-search-tag {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
}

.hot-search-wrapper .hot-search-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hot-search-wrapper .search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.hot-search-wrapper .search-item {
  color: white;
  text-decoration: none;
  font-size: 14px;
  transition: opacity 0.2s;
  cursor: pointer;
}

.hot-search-wrapper .search-item:hover {
  opacity: 0.8;
}

.hot-search-wrapper .advanced-search-btn {
  flex-shrink: 0;
  background: white;
  color: var(--primary-color);
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  transition: all 0.2s;
}

.hot-search-wrapper .advanced-search-btn:hover {
  background: #f0f7ff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ========== 热门应用区域 ========== */
.hot-apps-section {
  background: white;
  padding: 32px 40px;
}

.hot-apps-container {
  max-width: 1200px;
  margin: 0 auto;
}

.hot-apps-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.hot-apps-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.all-apps-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.all-apps-link:hover {
  color: var(--primary-color);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.app-card {
  position: relative;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.app-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

/* 禁用状态的卡片 */
.app-card.disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.app-card.disabled:hover {
  border-color: var(--border-color);
  box-shadow: none;
  transform: none;
}

/* 未开发功能卡片 */
.app-card.developing {
  cursor: pointer;
}

.app-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #f0f4ff 0%, #e0e8ff 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #5b6bc0;
}

/* 为不同的应用设置不同的图标颜色 */
.app-card:nth-child(1) .app-icon { background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%); color: #4f46e5; }
.app-card:nth-child(2) .app-icon { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); color: var(--accent-hover); }
.app-card:nth-child(3) .app-icon { background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%); color: #7c3aed; }
.app-card:nth-child(4) .app-icon { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%); color: #dc2626; }
.app-card:nth-child(5) .app-icon { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); color: var(--primary-color); }
.app-card:nth-child(6) .app-icon { background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%); color: #059669; }
.app-card:nth-child(7) .app-icon { background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%); color: #db2777; }
.app-card:nth-child(8) .app-icon { background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%); color: #ea580c; }
.app-card:nth-child(9) .app-icon { background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%); color: #4f46e5; }
.app-card:nth-child(10) .app-icon { background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%); color: #0891b2; }

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

.app-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.app-info p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.new-badge {
  display: inline-block;
  background: #ef4444;
  color: white;
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 2px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ========== 快捷功能 ========== */
.quick-functions {
  padding: 60px 20px;
  background: var(--bg-secondary);
}

.section-container {
  max-width: 1200px;
  margin: 0 auto;
}

.function-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.function-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  border: 1px solid var(--border-color);
}

.function-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.function-card.primary {
  background: linear-gradient(135deg, #3b82f6, var(--primary-color));
  color: white;
  border: none;
}

.card-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.card-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-content p {
  font-size: 13px;
  color: var(--text-secondary);
}

.function-card.primary .card-content p {
  color: rgba(255, 255, 255, 0.8);
}

.card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  padding: 2px 6px;
  background: #ef4444;
  color: white;
  border-radius: 10px;
}

/* ========== 新闻区域 ========== */
.news-section {
  padding: 60px 20px;
  background: var(--bg-secondary);
}

/* ========== 数据统计区域 ========== */
.data-stats-section {
  padding: 40px 20px;
  background: #ffffff;
}

.stats-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stats-card {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

/* 企业数据卡片 - 蓝色渐变背景 */
.stats-card.enterprise-card {
  background: linear-gradient(180deg, #e0f2fe 0%, #f0f9ff 30%, #ffffff 100%);
}

/* 企业热榜卡片 - 粉色渐变背景 */
.stats-card.hot-card {
  background: linear-gradient(180deg, #fce7f3 0%, #fdf2f8 30%, #ffffff 100%);
}

/* 人物热榜卡片 - 黄色渐变背景 */
.stats-card.person-card {
  background: linear-gradient(180deg, #fef3c7 0%, #fefce8 30%, #ffffff 100%);
}

.stats-header {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stats-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-icon {
  font-size: 18px;
}

.stats-icon.fire {
  font-size: 16px;
}

.stats-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.stats-tag {
  font-size: 13px;
  color: var(--text-secondary);
}

.stats-content {
  padding: 16px;
}

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

.number-card {
  background: linear-gradient(135deg, #3b82f6 0%, var(--primary-color) 100%);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.number-card.orange {
  background: #fff;
  border: 1px solid #fee2e2;
}

.number {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.number-card.orange .number {
  color: #ef4444;
}

.number-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
}

.number-card.orange .number-label {
  color: var(--text-secondary);
}

.stats-list {
  margin-bottom: 16px;
}

.stats-list:last-child {
  margin-bottom: 0;
}

.stats-list-title {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.progress-label {
  font-size: 13px;
  color: var(--text-primary);
  min-width: 70px;
  flex-shrink: 0;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #f3f4f6;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.progress-fill.blue {
  background: linear-gradient(90deg, #3b82f6 0%, var(--primary-color) 100%);
}

.progress-fill.orange {
  background: linear-gradient(90deg, #f97316 0%, #ea580c 100%);
}

.progress-value {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 50px;
  text-align: right;
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  text-decoration: none;
  color: inherit;
}

.rank-item:hover {
  opacity: 0.8;
}

.rank-number {
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* 第1名 - 橙色 */
.rank-item:nth-child(1) .rank-number {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

/* 第2名 - 蓝色 */
.rank-item:nth-child(2) .rank-number {
  background: linear-gradient(135deg, #3b82f6 0%, var(--primary-color) 100%);
}

/* 第3名 - 绿色 */
.rank-item:nth-child(3) .rank-number {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* 第4名 - 紫色 */
.rank-item:nth-child(4) .rank-number {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* 第5名 - 粉色 */
.rank-item:nth-child(5) .rank-number {
  background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

/* 第6名 - 青色 */
.rank-item:nth-child(6) .rank-number {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

/* 第7名 - 黄色 */
.rank-item:nth-child(7) .rank-number {
  background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
}

/* 第8名 - 红色 */
.rank-item:nth-child(8) .rank-number {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* 第9名 - 靛蓝 */
.rank-item:nth-child(9) .rank-number {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

/* 第10名 - 深绿 */
.rank-item:nth-child(10) .rank-number {
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
}

/* ========== Tab切换 ========== */
.tabs-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color);
}

.tab-item {
  padding: 12px 24px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.3s;
}

.tab-title .title-short { display: none; }
.tab-title .title-full { display: inline; }

.tab-item:hover .tab-title {
  color: var(--primary-color);
}

.tab-item.active .tab-title {
  color: var(--primary-color);
  font-weight: 600;
}

.tab-item.active {
  border-bottom-color: var(--primary-color);
}

.more-links {
  position: relative;
}

.more-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
  display: none;
}

.more-link.active {
  display: inline;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-title {
  font-size: 24px;
  font-weight: 600;
}

.news-list {
  display: grid;
  gap: 20px;
}

.news-card {
  display: flex;
  gap: 20px;
  padding: 20px;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.news-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.news-image {
  flex-shrink: 0;
  width: 200px;
  height: 130px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.news-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.news-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-light);
}

.news-meta .company-name {
  font-size: 13px;
  font-weight: normal;
  color: var(--primary-color);
}

/* ========== 商家中心 ========== */
.business-section {
  padding: 60px 20px;
  background: var(--bg-secondary);
}

.business-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.business-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
  cursor: pointer;
}

.business-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.business-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.business-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.business-card p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ========== 首页吸顶搜索框样式 ========== */
/**
 * 吸附参数说明：
 * - NAV_BAR_HEIGHT: 60px (导航栏高度，PC端和H5端均为60px)
 * - STICKY_TOP: 60px (吸顶搜索框固定位置，紧跟导航栏下方)
 * - Z_INDEX: 99 (确保在导航栏下方显示)
 * 
 * 吸附触发条件：search-section初始顶部 - NAV_BAR_HEIGHT
 * 吸附消失条件：滚动位置低于触发点
 */

/* ========== 响应式设计 ========== */
@media (max-width: 1024px) {
  .apps-grid { grid-template-columns: repeat(4, 1fr); }
  .hot-apps-section { padding: 24px 20px; }
  .stats-container { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .search-section { padding: clamp(20px, 8vw, 40px) 16px; }
  .main-title { font-size: clamp(18px, 7vw, 28px); white-space: nowrap; }
  .main-title .title-separator { display: none; }
  .main-title .title-sub { display: block; font-size: clamp(14px, 5.5vw, 28px); font-weight: 400; margin-top: 4px; white-space: nowrap; }
  .sub-title { font-size: clamp(10px, 3.1vw, 14px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .search-box { padding: 16px; }
  .search-input-wrapper { flex-direction: column; }
  .search-btn { width: 100%; justify-content: center; }
  .hot-search { flex-wrap: wrap; }
  .news-card { flex-direction: column; }
  .news-image { width: 100%; height: 180px; }
  
  /* H5隐藏热门搜索区域 */
  .hot-search-wrapper { display: none; }

  /* H5端Tab标签紧凑显示 */
  .tabs-wrapper { flex-direction: row; align-items: center; gap: 12px; }
  .tabs { width: auto; display: flex; }
  .tab-item { text-align: center; padding: 10px 12px; }
  .tab-title { font-size: 14px; }
  .more-links { margin-left: auto; white-space: nowrap; }
  
  /* H5端显示短文本，隐藏完整文本 */
  .tab-title .title-full { display: none; }
  .tab-title .title-short { display: inline; }

  .apps-grid { grid-template-columns: repeat(2, 1fr); }
  .hot-apps-section { padding: 20px 16px; }
}
