/* ============================================================
   江湖百晓生 - 前台样式
   移动端优先，响应式
   ============================================================ */

:root {
  --primary: #0F6E56;
  --primary-light: #E1F5EE;
  --primary-dark: #085041;
  --accent: #D85A30;
  --accent-light: #FAECE7;
  --bg: #f5f5f5;
  --white: #ffffff;
  --text: #2C2C2A;
  --text-secondary: #5F5E5A;
  --text-tertiary: #888780;
  --border: #E8E8E4;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- 头部 ---- */
.header {
  background: var(--white);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 0.5px solid var(--border);
}
.header-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-dark);
  text-align: center;
}

/* ---- 搜索栏 ---- */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--text);
}
.search-bar input::placeholder { color: var(--text-tertiary); }
.search-bar .search-icon {
  color: var(--text-tertiary);
  font-size: 16px;
  margin-right: 8px;
}

/* ---- 筛选栏 ---- */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 8px;
  -webkit-overflow-scrolling: touch;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-btn {
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 20px;
  border: 0.5px solid var(--border);
  background: var(--white);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.filter-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

/* ---- 项目卡片 ---- */
.project-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.project-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
}
.project-card:active { transform: scale(0.98); }

.project-card .card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--bg);
  display: block;
}
.project-card .card-body {
  padding: 12px 14px 14px;
}
.project-card .card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.project-card .card-company {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.project-card .card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.project-card .card-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
}
.project-card .card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-tertiary);
}
.project-card .card-stats span { margin-right: 12px; }
.project-card .card-ad {
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 1px 6px;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: 4px;
}

/* ---- 广告占位 ---- */
.ad-card .card-img { height: 100px; opacity: 0.85; }

/* ---- 空状态 ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .empty-text { font-size: 14px; }

/* ---- 加载更多 ---- */
.load-more {
  text-align: center;
  padding: 20px;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* ---- 页面容器 ---- */
.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
}

/* ---- 底部导航 ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  display: flex;
  border-top: 0.5px solid var(--border);
  padding-bottom: var(--safe-bottom);
  z-index: 200;
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 8px 0 4px;
  font-size: 11px;
  color: var(--text-tertiary);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a .nav-icon { font-size: 22px; }

/* ---- 详情页 ---- */
.detail-page { padding-bottom: 80px; }
.detail-image {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: block;
  background: var(--bg);
}
.detail-section {
  background: var(--white);
  margin: 8px 0;
  padding: 16px;
}
.detail-section:first-of-type { margin-top: 0; }
.detail-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}
.detail-company {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
}
.detail-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  margin-top: 14px;
}
.detail-label:first-child { margin-top: 0; }
.detail-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  white-space: pre-wrap;
}
.detail-text img { max-width: 100%; height: auto; }

/* ---- 联系条 ---- */
.contact-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  border-top: 0.5px solid var(--border);
  display: flex;
  gap: 10px;
  z-index: 200;
}
.contact-bar .btn-wechat {
  flex: 1;
  background: #07C160;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.contact-bar .btn-fav {
  width: 48px;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.contact-bar .btn-fav.active { color: #E24B4A; border-color: #E24B4A; }

/* ---- 微信弹窗 ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  width: 280px;
  text-align: center;
}
.modal-content .modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}
.modal-content .modal-qr {
  width: 160px;
  height: 160px;
  background: var(--bg);
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.modal-content .modal-wechat {
  font-size: 15px;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 8px;
}
.modal-content .modal-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}
.modal-content .modal-close {
  background: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 10px 40px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

/* ---- 表单 ---- */
.form-page { padding: 16px; }
.form-group { margin-bottom: 16px; }
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  display: block;
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: var(--white);
  color: var(--text);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
}
.form-textarea {
  min-height: 100px;
  resize: vertical;
}
.form-btn {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}
.form-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- 收藏列表 ---- */
.fav-item {
  display: flex;
  padding: 12px 16px;
  background: var(--white);
  border-bottom: 0.5px solid var(--border);
  gap: 12px;
  cursor: pointer;
}
.fav-item:active { background: var(--bg); }
.fav-item .fav-img {
  width: 80px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
}
.fav-item .fav-info { flex: 1; min-width: 0; }
.fav-item .fav-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fav-item .fav-company { font-size: 12px; color: var(--text-tertiary); }
.fav-item .fav-del {
  font-size: 18px;
  color: var(--text-tertiary);
  padding: 0 4px;
  cursor: pointer;
  align-self: center;
}

/* ---- Toast 提示 ---- */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 999;
  pointer-events: none;
  animation: fadeOut 1.5s forwards;
}
@keyframes fadeOut {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---- 响应式调整 ---- */
@media (min-width: 480px) {
  .page { border-left: 0.5px solid var(--border); border-right: 0.5px solid var(--border); }
}
