/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #2e7d32;
  --primary-light: #4caf50;
  --primary-dark: #1b5e20;
  --gold: #f59e0b;
  --gold-light: #fbbf24;
  --bg: #f0faf0;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666;
  --border: #e0e0e0;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

html, body {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶部品牌区（海报图） ===== */
.hero {
  position: relative;
  height: 420px;
  padding: 0 24px 24px;
  overflow: hidden;
  color: white;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  z-index: 0;
}

/* 暗色遮罩，保证文字可读 */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.45) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  padding-bottom: 4px;
}

.hero h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 3px;
  margin-bottom: 4px;
}

.hero .tagline {
  font-size: 12px;
  opacity: 0.95;
  letter-spacing: 2px;
}

/* ===== 名额展示 ===== */
.stock-bar {
  background: white;
  margin: 0 16px;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
  margin-top: -16px;
}

.stock-numbers {
  display: flex;
  justify-content: space-around;
  margin-bottom: 16px;
}

.stock-item {
  text-align: center;
}

.stock-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.stock-num.gold { color: var(--gold); }
.stock-num.gray { color: #999; font-size: 22px; }

.stock-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.progress-wrap {
  background: #e8f5e9;
  border-radius: 10px;
  height: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary-light));
  border-radius: 10px;
  transition: width 0.6s ease;
}

/* ===== 价格档位 ===== */
.section {
  margin: 20px 16px;
}

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

.price-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.price-card {
  background: white;
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.price-card:active {
  transform: scale(0.98);
}

.price-card.premium {
  border-color: var(--gold-light);
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
}

.price-card.main {
  border-color: #a7f3d0;
}

.price-card.trial {
  border-color: #d1fae5;
}

.price-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.price-card.premium .price-icon { background: var(--gold); }
.price-card.main .price-icon { background: var(--primary-light); color: white; }
.price-card.trial .price-icon { background: #86efac; }

.price-info { flex: 1; }

.price-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.price-spec {
  font-size: 12px;
  color: var(--text-secondary);
}

.price-amount {
  text-align: right;
}

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

.price-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}

.price-card.premium .price-num { color: #d97706; }

/* ===== 我的报备状态 ===== */
.status-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin: 0 16px;
}

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

.status-header h3 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.status-badge.pending { background: #fff3e0; color: #e65100; }
.status-badge.approved { background: #e8f5e9; color: var(--success); }
.status-badge.used { background: #e3f2fd; color: #1565c0; }
.status-badge.none { background: #f5f5f5; color: #999; }

.status-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.status-row .label { color: var(--text-secondary); }
.status-row .value { font-weight: 600; }

.status-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}

/* ===== 按钮 ===== */
button { cursor: pointer; font-family: inherit; border: none; border-radius: 12px; transition: all 0.2s; }

.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(46,125,50,0.35);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(46,125,50,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: white;
  color: var(--primary);
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  border: 2px solid var(--primary);
  flex: 1;
}

.btn-outline:hover { background: #e8f5e9; }

/* ===== 底部操作区 ===== */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
  display: flex;
  gap: 10px;
}

/* ===== 表单页面 ===== */
.form-page { padding-bottom: 80px; }

.form-section {
  margin: 16px;
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.form-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

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

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* 水果选择 */
.fruit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.fruit-option {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.fruit-option.selected {
  border-color: var(--primary);
  background: #e8f5e9;
}

.fruit-option:active { transform: scale(0.96); }

.fruit-option .fruit-emoji { font-size: 28px; display: block; margin-bottom: 4px; }
.fruit-option .fruit-name { font-size: 13px; font-weight: 600; }
.fruit-option .fruit-price { font-size: 11px; color: var(--text-secondary); }

/* 用途选择 */
.purpose-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.purpose-option {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  font-size: 14px;
  font-weight: 600;
}

.purpose-option.selected {
  border-color: var(--primary);
  background: #e8f5e9;
  color: var(--primary);
}

.purpose-option:active { transform: scale(0.96); }

/* 数量步进器 */
.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  width: fit-content;
}

.qty-btn {
  width: 44px;
  height: 44px;
  background: #f5f5f5;
  color: var(--primary);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
}

.qty-btn:hover { background: #e8e8e8; }

.qty-value {
  width: 60px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-left: 2px solid var(--border);
  border-right: 2px solid var(--border);
  outline: none;
}

.qty-unit {
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: 10px;
  align-self: center;
}

/* 数量 + 预估金额 一行布局 */
.qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.qty-row .amount-display {
  margin-top: 0;
  flex: 0 1 auto;
  min-width: 110px;
  max-width: 180px;
  padding: 10px 14px;
  text-align: right;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: 12px;
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.qty-row .amount-display .amount-label {
  font-size: 11px;
  opacity: 0.85;
  margin-bottom: 2px;
}

.qty-row .amount-display .amount-value {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
}

/* 预估金额展示 */
.amount-display {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin-top: 16px;
}

.amount-label { font-size: 13px; opacity: 0.85; margin-bottom: 4px; }
.amount-value { font-size: 32px; font-weight: 800; }

/* ===== 记录页面 ===== */
.record-card {
  background: white;
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin: 12px 16px;
}

.record-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.record-code {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-family: monospace;
}

.record-time {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.record-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.record-tag {
  background: #f5f5f5;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
}

.record-note {
  font-size: 12px;
  color: var(--text-secondary);
  background: #fafafa;
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--primary-light);
  margin-bottom: 12px;
}

.record-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state i { font-size: 56px; opacity: 0.25; display: block; margin-bottom: 16px; }
.empty-state p { font-size: 15px; }
.empty-state .empty-sub { font-size: 13px; margin-top: 6px; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 15px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s;
  text-align: center;
  pointer-events: none;
}

.toast.show { opacity: 1; }

/* ===== 卡片高亮闪烁（拦截报备时提示用户） ===== */
@keyframes flash-highlight {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); }
  50%      { box-shadow: 0 0 0 6px rgba(255, 152, 0, 0.35); }
}
.status-card.flash-highlight {
  animation: flash-highlight 0.5s ease-in-out 3;
  border-radius: 12px;
}

/* ===== 未领取提示条 ===== */
.not-taken-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff3cd;
  color: #856404;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 1500;
  animation: hint-slide-in 0.3s ease-out;
}
@keyframes hint-slide-in {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ===== 手机号登录弹窗 ===== */
.phone-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  justify-content: center;
  align-items: center;
}
.phone-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.phone-modal-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  width: 90%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.phone-modal-icon { font-size: 48px; margin-bottom: 8px; }
.phone-modal-header h3 { font-size: 20px; margin: 8px 0 4px; }
.phone-modal-header p { color: #999; font-size: 13px; }
.phone-modal-body { margin-top: 20px; }
.phone-modal-body input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 18px;
  letter-spacing: 2px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
.phone-modal-body input:focus { border-color: var(--primary); }
.phone-modal-body .btn-primary {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  font-size: 16px;
}
.phone-modal-error {
  color: #dc2626;
  font-size: 13px;
  margin-top: 10px;
  min-height: 20px;
}

/* ===== 加载 ===== */
.loading-row {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ===== 顶部导航（表单/记录页） ===== */
.topnav {
  height: 56px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  display: flex;
  align-items: center;
  padding: 0 8px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.topnav-back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  color: white;
  text-decoration: none;
  font-size: 18px;
  flex-shrink: 0;
}

.topnav-back:hover { background: rgba(255,255,255,0.25); }

.topnav-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  margin-right: 40px;
}

/* ===== 安全区适配 ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-bar {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* ===== 响应式 ===== */
@media (min-width: 480px) {
  .stock-num { font-size: 34px; }
  .price-num { font-size: 26px; }
}

/* 夜间模式 */
@media (prefers-color-scheme: dark) {
  body { background: #1a1a1a; color: #e0e0e0; }
  .stock-bar, .status-card, .form-section, .price-card, .record-card {
    background: #2a2a2a;
  }
  .form-group input, .form-group textarea, .form-group select {
    background: #333;
    border-color: #444;
    color: #e0e0e0;
  }
  .topnav { background: linear-gradient(135deg, #1b3d1b, #2e7d32); }
  .bottom-bar { background: #2a2a2a; }
  .qty-btn { background: #333; }
  .qty-value { border-color: #444; }
  .progress-wrap { background: #333; }
}
