/* ==================== 基础样式 ==================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #07c160;
  --primary-dark: #06ad56;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border: #e8e8e8;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==================== 头部 ==================== */

.header {
  text-align: center;
  padding: 32px 16px 24px;
}

.header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

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

/* ==================== 搜索和筛选 ==================== */

.filter-bar {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  position: sticky;
  top: 16px;
  z-index: 10;
}

.search-box {
  position: relative;
  margin-bottom: 12px;
}

.search-box input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 16px;
  border: 2px solid var(--border);
  border-radius: 22px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s;
}

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

.search-box input::placeholder {
  color: var(--text-muted);
}

.clear-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.clear-btn:hover {
  background: var(--border);
}

.clear-btn.visible {
  display: flex;
}

.select-group {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.select-group select {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  border: 2px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.select-group select:focus {
  border-color: var(--primary);
}

.result-count {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.result-count span {
  font-weight: 700;
  color: var(--primary);
}

/* ==================== 加载状态 ==================== */

.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==================== 错误状态 ==================== */

.error {
  text-align: center;
  padding: 40px 20px;
  color: #e74c3c;
  background: #fff5f5;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.error-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

.error-hint code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

/* ==================== 文章列表 ==================== */

.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

/* ==================== 文章卡片 ==================== */

.article-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s;
}

.article-card:hover {
  box-shadow: var(--shadow);
}

.article-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.article-card .publish-date {
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.article-card .region-tags {
  display: flex;
  gap: 6px;
}

.article-card .tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

.tag-province {
  background: #e8f5e9;
  color: #2e7d32;
}

.tag-city {
  background: #e3f2fd;
  color: #1565c0;
}

.tag-empty {
  background: #f5f5f5;
  color: #999;
}

.article-card .card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card .card-footer {
  display: flex;
  justify-content: flex-end;
}

.article-card .view-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s;
}

.article-card .view-btn:hover {
  background: var(--primary-dark);
}

.article-card .view-btn:active {
  transform: scale(0.97);
}

/* ==================== 空状态 ==================== */

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-hint {
  font-size: 13px;
  margin-top: 8px;
}

/* ==================== 页脚 ==================== */

.footer {
  text-align: center;
  padding: 32px 16px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
}

/* ==================== 响应式 ==================== */

@media (max-width: 480px) {
  .header h1 {
    font-size: 20px;
  }

  .article-card .card-title {
    font-size: 15px;
  }

  .select-group {
    flex-direction: column;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 24px;
  }

  .filter-bar {
    padding: 20px;
  }

  .article-card {
    padding: 20px;
  }
}
