/* ═══ 训练营 H5 — 全局样式 ═══ */
:root {
  --primary: #07c160;
  --primary-dark: #06ad56;
  --danger: #fa5151;
  --warn: #ffc300;
  --text: #333;
  --text-secondary: #888;
  --bg: #f5f5f5;
  --card-bg: #fff;
  --border: #eaeaea;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ═══ 顶部导航 ═══ */
.h5-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.h5-header h1 {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}
.h5-header .back-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  color: var(--text);
  background: none;
  border: none;
}

/* ═══ 底部 Tab 栏 ═══ */
.h5-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #fff;
  display: flex;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.h5-tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  color: var(--text-secondary);
  font-size: 11px;
  text-decoration: none;
}
.h5-tabbar a.active { color: var(--primary); }
.h5-tabbar .tab-icon { font-size: 22px; margin-bottom: 2px; }

/* ═══ 训练营卡片 ═══ */
.camp-list { padding: 12px 16px 80px; }

.camp-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.camp-card:active { opacity: .85; }

.camp-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #eee;
}

.camp-card-body {
  padding: 14px 16px;
}
.camp-card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.camp-card-summary {
  font-size: 13px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}
.camp-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.camp-price {
  color: var(--danger);
  font-size: 20px;
  font-weight: 700;
}
.camp-price .unit { font-size: 13px; font-weight: 400; }
.camp-price-from { font-size: 12px; color: var(--text-secondary); }
.camp-card-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
}

/* ═══ 详情页 ═══ */
.detail-cover {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  background: #eee;
}
.detail-info {
  background: #fff;
  padding: 16px;
  margin-bottom: 10px;
}
.detail-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
}
.detail-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.detail-price-box {
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  border-radius: 8px;
  padding: 12px 16px;
  color: #fff;
  margin-bottom: 12px;
}
.detail-price {
  font-size: 28px;
  font-weight: 700;
}
.detail-price .unit { font-size: 15px; font-weight: 400; }
.detail-price-original {
  text-decoration: line-through;
  opacity: .7;
  font-size: 14px;
  margin-left: 8px;
}

/* 价格档位选择 */
.tier-options {
  display: flex;
  gap: 10px;
  padding: 0 16px 16px;
  background: #fff;
}
.tier-option {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all .2s;
  background: #fff;
}
.tier-option.selected {
  border-color: var(--primary);
  background: #f0faf4;
}
.tier-option .tier-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.tier-option .tier-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--danger);
}
.tier-option .tier-original {
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: line-through;
}
.tier-tag {
  position: absolute;
  top: -10px;
  right: -6px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 8px;
}

/* 详情内容 */
.detail-content {
  background: #fff;
  padding: 16px;
  margin-bottom: 80px;
}
.detail-content h2 { font-size: 18px; margin: 16px 0 10px; }
.detail-content p { margin-bottom: 12px; line-height: 1.8; }
.detail-content img { border-radius: 8px; margin: 10px 0; }
.detail-content video { width: 100%; border-radius: 8px; margin: 10px 0; }

/* 底部购买栏 */
.detail-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #fff;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--border);
}
.detail-bottom .buy-btn {
  flex: 1;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 14px 0;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.detail-bottom .buy-btn:active { background: var(--primary-dark); }
.detail-bottom .buy-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* ═══ 订单列表 ═══ */
.order-list { padding: 12px 16px 80px; }

.order-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  padding: 16px;
}
.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}
.order-status {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
}
.order-status.paid { background: #e6f7ee; color: var(--primary); }
.order-status.pending { background: #fff8e1; color: #f5a623; }
.order-status.refunded { background: #f5f5f5; color: #999; }

.order-card-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.order-camp-title {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  margin-right: 12px;
}
.order-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--danger);
  white-space: nowrap;
}
.order-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ═══ 空状态 ═══ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ═══ 加载状态 ═══ */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}
.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ Toast 提示 ═══ */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,.75);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
}
.toast.show { opacity: 1; }
