/* ─── 金融研究实验室 · H5 咨询入口 ─── */
/* 移动端优先，微信内置浏览器友好 */

:root {
  --primary: #1a237e;
  --primary-light: #3949ab;
  --primary-bg: #e8eaf6;
  --accent: #1565c0;
  --success: #2e7d32;
  --warning: #e65100;
  --danger: #c62828;
  --text: #333;
  --text-light: #666;
  --text-lighter: #999;
  --bg: #f5f5f5;
  --card-bg: #fff;
  --border: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 480px;
  --header-height: 56px;
  --tab-height: 48px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* ─── 顶部导航 ─── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.header-subtitle {
  font-size: 11px;
  opacity: 0.8;
  margin-left: 6px;
}

/* ─── Tab 切换 ─── */
.tab-bar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  z-index: 99;
  height: var(--tab-height);
  background: var(--card-bg);
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
  user-select: none;
  -webkit-user-select: none;
}

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

.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
}

.tab-item .icon {
  margin-right: 4px;
  font-size: 16px;
}

/* ─── 主内容区 ─── */
.main-content {
  margin-top: calc(var(--header-height) + var(--tab-height));
  padding: 16px;
  padding-bottom: calc(80px + var(--safe-bottom));
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

/* ─── 页面容器 ─── */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

/* ─── 卡片 ─── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-title .badge {
  font-size: 11px;
  background: var(--primary-bg);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  margin-left: auto;
}

/* ─── 表单 ─── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--card-bg);
  transition: border-color 0.2s;
  outline: none;
  -webkit-appearance: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.form-textarea::placeholder,
.form-input::placeholder {
  color: var(--text-lighter);
}

/* ─── 类型选择 ─── */
.type-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.type-btn {
  flex: 1;
  min-width: 80px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.type-btn:active {
  transform: scale(0.97);
}

.type-btn.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

.type-btn .type-icon {
  display: block;
  font-size: 20px;
  margin-bottom: 4px;
}

/* ─── 提交按钮 ─── */
.btn-submit {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.btn-submit:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-submit .loading-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 0 auto;
}

.btn-submit.loading .btn-text {
  display: none;
}

.btn-submit.loading .loading-spinner {
  display: block;
}

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

/* ─── 提示消息 ─── */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  background: rgba(0,0,0,0.78);
  color: #fff;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
  max-width: 280px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.toast.show {
  opacity: 1;
}

/* ─── 研报库 ─── */
.report-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 16px;
  transition: transform 0.15s;
}

.report-card:active {
  transform: scale(0.99);
}

.report-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.report-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

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

.report-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.report-summary {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

.report-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-lighter);
}

.report-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.report-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary-bg);
  color: var(--primary);
}

.report-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.btn-download {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-download:active {
  transform: scale(0.97);
}

.btn-download.primary {
  background: var(--primary);
  color: #fff;
}

.btn-download.outline {
  background: var(--card-bg);
  color: var(--primary);
  border: 1px solid var(--primary);
}

/* ─── 空状态 ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-text {
  font-size: 15px;
  color: var(--text-light);
  margin-bottom: 6px;
}

.empty-subtext {
  font-size: 13px;
  color: var(--text-lighter);
}

/* ─── 加载更多 ─── */
.load-more {
  text-align: center;
  padding: 16px;
}

.btn-load-more {
  padding: 8px 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
}

.btn-load-more:active {
  background: var(--bg);
}

/* ─── 搜索框 ─── */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-input {
  flex: 1;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  background: var(--card-bg);
}

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

/* ─── 底部提示 ─── */
.footer-note {
  text-align: center;
  padding: 20px 16px 32px;
  font-size: 12px;
  color: var(--text-lighter);
  line-height: 1.6;
}

/* ─── 免责声明 ─── */
.disclaimer {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-left: 4px solid #ff9800;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 12px;
}

.disclaimer-title {
  font-size: 13px;
  font-weight: 600;
  color: #e65100;
  margin-bottom: 8px;
}

.disclaimer-body {
  font-size: 12px;
  color: #795548;
  line-height: 1.6;
}

.disclaimer-body strong {
  color: #bf360c;
}

/* ─── 响应式适配 ─── */
@media (min-width: 640px) {
  .main-content {
    padding: 20px;
  }
  .report-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

/* ─── 微信内禁止页面滚动卡顿 ─── */
.scroll-container {
  -webkit-overflow-scrolling: touch;
}
