/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { min-height: 100%; background: #f5f5f5; }
html::before {
  content: ''; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background-image: url('/images/background.png'); background-size: cover;
  background-position: center; background-attachment: fixed;
  opacity: 0.5; z-index: -1;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; color: #333; font-size: 14px; line-height: 1.5; background: transparent; }
view { display: block; }
image { max-width: 100%; display: inline-block; }
button { background: none; border: none; outline: none; cursor: pointer; font-family: inherit; font-size: inherit; }
input, textarea, select { font-family: inherit; outline: none; border: none; }
a { text-decoration: none; color: inherit; }

/* ===== rpx to px ===== */
rpx { display: none; }

/* ===== TabBar ===== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 50px;
  background: #fff; border-top: 1px solid #eee;
  display: flex; align-items: center; justify-content: space-around;
  z-index: 1000;
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; height: 100%; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.tab-item .tab-icon-active { display: none; }
.tab-item.active .tab-icon { display: none; }
.tab-item.active .tab-icon-active { display: inline-block; }
.tab-icon, .tab-icon-active { width: 24px; height: 24px; margin-bottom: 2px; }
.tab-label { font-size: 11px; color: #999; }
.tab-item.active .tab-label { color: #B6E595; }

/* ===== Page Container ===== */
.page-container { padding-bottom: 60px; min-height: 100vh; }

/* ===== Toast ===== */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75); color: #fff; padding: 14px 28px;
  border-radius: 10px; font-size: 15px; z-index: 2000; text-align: center;
  max-width: 70%; pointer-events: none;
}

/* ===== Loading ===== */
.loading-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.7); z-index: 1500;
  display: flex; align-items: center; justify-content: center;
}
.loading-spinner {
  width: 32px; height: 32px; border: 3px solid #ddd; border-top-color: #B6E595;
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Modal ===== */
.modal-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 100;
}
.modal-content {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 520px; max-width: 90vw; background: #fff;
  border-radius: 16px; padding: 30px 24px; z-index: 101; text-align: center;
}
.modal-close {
  position: absolute; top: 10px; right: 14px; font-size: 24px;
  color: #999; cursor: pointer; width: 30px; height: 30px; line-height: 28px; text-align: center;
}

/* ===== Common ===== */
.page { min-height: 100vh; }
.card-white { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 16px; box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 32px; background: #B6E595; color: #fff;
  font-size: 15px; font-weight: 600; border-radius: 10px; cursor: pointer;
  transition: opacity 0.2s; border: none; width: 100%;
}
.btn-primary:active { opacity: 0.8; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-default {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 32px; background: #f5f5f5; color: #666;
  font-size: 15px; border-radius: 10px; cursor: pointer; width: 100%;
}
.btn-small { height: 34px; padding: 0 16px; font-size: 13px; border-radius: 6px; }
.btn-danger { background: #ff4d4f; color: #fff; }
/* ===== Header ===== */
.page-header {
  background: transparent; padding: 36px 24px 24px; text-align: center; position: relative;
}
.page-header .header-tag {
  display: block; font-size: 12px; color: #B6E595; letter-spacing: 3px; margin-bottom: 10px;
}
.page-header .header-title {
  display: block; font-size: 22px; font-weight: 600; color: #1a1a1a; letter-spacing: 2px; margin-bottom: 6px;
}
.page-header .header-sub {
  display: block; font-size: 13px; color: #888; letter-spacing: 1px;
}
.page-header .header-line {
  width: 30px; height: 2px; background: #B6E595; margin: 16px auto 0; border-radius: 1px;
}

/* ===== Schemes Page Header ===== */
.header {
  background: transparent; padding: 30px 20px 20px; text-align: center;
}
.header .header-content { text-align: center; }
.header .header-tag {
  display: block; font-size: 12px; color: #B6E595; letter-spacing: 3px; margin-bottom: 10px;
}
.header .header-title {
  display: block; font-size: 20px; font-weight: 600; color: #1a1a1a; letter-spacing: 2px; margin-bottom: 6px;
}
.header .header-sub {
  display: block; font-size: 13px; color: #888; letter-spacing: 1px;
}
.header .header-line {
  width: 30px; height: 2px; background: #B6E595; margin: 16px auto 0; border-radius: 1px;
}

/* ===== Form ===== */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 600; color: #333; margin-bottom: 8px; }
.form-input {
  width: 100%; height: 44px; padding: 0 14px; border: 1px solid #e5e5e5;
  border-radius: 8px; font-size: 15px; color: #333; background: #f9f9f9;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: #B6E595; background: #fff; }
.form-textarea {
  width: 100%; min-height: 120px; padding: 12px 14px; border: 1px solid #e5e5e5;
  border-radius: 8px; font-size: 15px; color: #333; background: #f9f9f9;
  resize: vertical; line-height: 1.6;
}
.form-textarea:focus { border-color: #B6E595; background: #fff; }
.form-hint { font-size: 12px; color: #999; margin-top: 6px; }

/* ===== Search Bar ===== */
.search-bar {
  display: flex; gap: 10px; margin-bottom: 16px;
}
.search-bar input {
  flex: 1; height: 40px; padding: 0 14px; border: 1px solid #e5e5e5;
  border-radius: 8px; font-size: 14px; background: #fff;
}
.search-bar input:focus { border-color: #B6E595; }
.search-bar .search-btn {
  height: 40px; padding: 0 16px; background: #B6E595; color: #fff;
  border-radius: 8px; font-size: 14px; cursor: pointer; white-space: nowrap;
}

/* ===== Filter Tags ===== */
.filter-tags {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.filter-tag {
  padding: 6px 16px; border-radius: 16px; font-size: 13px; color: #666;
  background: #f5f5f5; cursor: pointer; border: 1px solid #eee;
  transition: all 0.2s;
}
.filter-tag.active {
  background: #B6E595; color: #fff; border-color: #B6E595;
}

/* ===== Status Badge ===== */
.status-badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 12px; font-weight: 600;
}
.status-badge.pending { background: #fff7e6; color: #fa8c16; }
.status-badge.shipped { background: #e6f7ff; color: #1890ff; }
.status-badge.completed { background: #f6ffed; color: #52c41a; }
.status-badge.cancelled { background: #fff2f0; color: #ff4d4f; }

/* ===== Stats ===== */
.stats-row {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
}
.stat-card {
  flex: 1; min-width: 100px; background: #fff; border-radius: 12px;
  padding: 20px 14px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.stat-number { font-size: 28px; font-weight: 700; color: #333; }
.stat-label { font-size: 12px; color: #999; margin-top: 4px; }

/* ===== Menu Section ===== */
.menu-section { margin-bottom: 16px; }
.menu-section-title {
  font-size: 14px; font-weight: 600; color: #999; padding: 0 16px; margin-bottom: 8px;
}
.menu-list { background: #fff; border-radius: 12px; overflow: hidden; }
.menu-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid #f5f5f5; cursor: pointer;
}
.menu-item:last-child { border-bottom: none; }
.menu-item-left { display: flex; align-items: center; gap: 12px; }
.menu-item-icon { width: 22px; height: 22px; }
.menu-item-text { font-size: 15px; color: #333; }
.menu-arrow { width: 14px; height: 14px; opacity: 0.3; }

/* ===== Redeem Page ===== */
.header {
  padding: 36px 24px 20px; text-align: center;
}
.header .logo {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12); margin-bottom: 10px;
}
.header .subtitle {
  font-size: 14px; color: #555; letter-spacing: 2px;
}
.card {
  background: rgba(255,255,255,0.50); border-radius: 16px;
  padding: 24px 20px; margin: 0 16px 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.card-title {
  font-size: 17px; font-weight: 700; color: #1a1a1a; margin-bottom: 16px; text-align: center;
}
.input-wrap {
  position: relative; margin-bottom: 14px;
}
.code-input {
  width: 100%; height: 48px; padding: 0 44px 0 16px;
  border: 1.5px solid #e0e0e0; border-radius: 10px;
  font-size: 16px; color: #333; background: #fafafa;
  transition: border-color 0.2s;
}
.code-input:focus { border-color: #B6E595; background: #fff; }
.clear-btn {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 20px; color: #bbb; cursor: pointer; line-height: 1;
  width: 24px; height: 24px; text-align: center;
}
.clear-btn:hover { color: #999; }
.tip {
  font-size: 12px; color: #aaa; text-align: center; margin-top: 10px;
}
.redeem-notice {
  font-size: 11px; color: #999; text-align: center; margin-top: 12px;
  line-height: 1.6; padding: 8px 12px;
  background: rgba(255,255,255,0.6); border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.06);
}

/* Scheme selection grid */
.result-title {
  font-size: 18px; font-weight: 700; color: #333; text-align: center; margin-bottom: 6px;
}
.result-title.fail { color: #ff4d4f; }
.result-icon {
  width: 72px; height: 72px; object-fit: contain; margin: 0 auto 16px; display: block;
}
.scheme-select-title {
  font-size: 14px; color: #666; text-align: center; margin-bottom: 16px;
}
.scheme-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 12px;
}
.scheme-btn {
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; border-radius: 10px; overflow: hidden;
  background: #f8f8f8; border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
}
.scheme-btn:hover { border-color: #B6E595; transform: scale(1.03); }
.scheme-btn:active { transform: scale(0.97); }
.scheme-btn-img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block;
}
.scheme-btn-text {
  font-size: 12px; color: #333; padding: 5px 0; font-weight: 600;
}
.scheme-tip {
  font-size: 11px; color: #bbb; text-align: center; margin-top: 4px;
}

/* Confirm modal */
.confirm-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 300px; max-width: 90vw; background: #fff;
  border-radius: 16px; padding: 24px 20px; z-index: 101; text-align: center;
}
.confirm-title {
  font-size: 17px; font-weight: 700; color: #1a1a1a; margin-bottom: 14px;
}
.confirm-img {
  width: 100px; height: 100px; object-fit: cover; border-radius: 10px; margin-bottom: 10px;
}
.confirm-name {
  display: block; font-size: 15px; font-weight: 600; color: #333; margin-bottom: 8px;
}
.confirm-warn {
  display: block; font-size: 13px; color: #888; margin-bottom: 18px;
}
.confirm-btns {
  display: flex; gap: 12px;
}
.confirm-btn {
  flex: 1; height: 42px; border-radius: 10px; font-size: 15px;
  font-weight: 600; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: opacity 0.2s;
}
.confirm-btn.cancel { background: #f5f5f5; color: #666; }
.confirm-btn.ok { background: #B6E595; color: #fff; }
.confirm-btn.loading { opacity: 0.6; cursor: not-allowed; }

/* ===== Scheme Cards ===== */
/* schemes page wrapper - white bg to match mini-program */
.schemes-page { min-height: 100vh; background: transparent; }
.content { padding: 0 15px 20px; }
.scheme-list { display: flex; flex-direction: column; gap: 10px; }
.scheme-card {
  display: flex; align-items: center; background: transparent; border-radius: 8px;
  padding: 12px; gap: 12px; cursor: pointer; box-shadow: 0 1px 6px rgba(0,0,0,0.04);
  transition: transform 0.2s;
}
.scheme-card:active { transform: scale(0.98); }
/* mini-program class names (used by JS) */
.card-image-box {
  width: 80px; height: 80px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: #f5f5f5;
}
.card-image { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-info { flex: 1; min-width: 0; }
.card-num { display: block; font-size: 11px; color: #B6E595; letter-spacing: 1px; margin-bottom: 4px; }
.card-name { display: block; font-size: 15px; font-weight: 600; color: #1a1a1a; margin-bottom: 5px; }
.card-desc { display: block; font-size: 12px; color: #1a1a1a; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* footer */
.footer { text-align: center; padding: 20px 0; }
.footer-text { font-size: 12px; color: #bbb; letter-spacing: 1px; }
/* legacy class names kept for compatibility */
.scheme-card-img {
  width: 80px; height: 80px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: #f5f5f5;
}
.scheme-card-img img { width: 100%; height: 100%; object-fit: cover; }
.scheme-card-info { flex: 1; min-width: 0; }
.scheme-card-name { font-size: 15px; font-weight: 600; color: #1a1a1a; margin-bottom: 4px; }
.scheme-card-desc { font-size: 12px; color: #1a1a1a; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Responsive ===== */
@media (min-width: 768px) {
  .tabbar { max-width: 480px; left: 50%; transform: translateX(-50%); }
  body { max-width: 480px; margin: 0 auto; }
}

/* ===== Admin Mode: 隐藏背景图 ===== */
html.admin-mode::before { opacity: 0; }
html.admin-mode { background: #F5F5F5; }

/* ===== Admin Global Back Button ===== */
.admin-global-back-btn {
  position: fixed; top: 14px; left: 14px; z-index: 900;
  display: inline-flex; align-items: center;
  background: #fff; border: 1.5px solid #B6E595;
  font-size: 13px; color: #3d7a20; font-weight: 700;
  cursor: pointer; padding: 6px 14px 6px 10px; border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: background 0.15s, box-shadow 0.15s;
}
.admin-global-back-btn:hover { background: #f0fae8; box-shadow: 0 3px 12px rgba(0,0,0,0.16); }

/* ===== Scheme Detail Page ===== */
.detail-page { min-height: 100vh; background: transparent; padding-bottom: 30px; }
.detail-nav {
  background: transparent; padding: 10px 16px; height: 0; overflow: visible;
}
.back-btn {
  position: fixed; top: 16px; left: 16px; z-index: 500;
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.9); border: 1.5px solid #B6E595;
  font-size: 14px; color: #3d7a20; font-weight: 700;
  cursor: pointer; padding: 6px 14px 6px 10px; border-radius: 20px;
  letter-spacing: 0.5px; box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  transition: background 0.2s, box-shadow 0.2s;
}
.back-btn:hover { background: #fff; box-shadow: 0 3px 14px rgba(0,0,0,0.2); }
.detail-header {
  background: transparent; padding: 24px 20px 20px; text-align: center;
}
.detail-header .header-name {
  display: block; font-size: 20px; font-weight: 600; color: #1a1a1a;
  letter-spacing: 2px; margin-bottom: 6px;
}
.detail-header .header-tag {
  display: block; font-size: 12px; color: #888; letter-spacing: 1px;
}
.cover {
  background: #fff; padding: 0 15px 12px;
}
.cover-image {
  width: 100%; max-height: 260px; border-radius: 8px; display: block;
  object-fit: cover;
}
.info-section {
  background: #fff; margin: 10px 12px 0; border-radius: 8px;
  padding: 20px 14px; text-align: center;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}
.info-line {
  width: 30px; height: 2px; background: #B6E595; margin: 0 auto 10px; border-radius: 1px;
}
.info-desc {
  font-size: 12px; color: #aaa; letter-spacing: 2px;
}
.category-list {
  padding: 10px 12px; display: flex; flex-direction: column; gap: 10px;
}
.category-card {
  background: #fff; border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}
.category-card .category-image {
  width: 100%; display: block; background: #fff;
}
.category-header {
  padding: 0 14px; margin: 14px 0 10px;
  display: flex; align-items: center; gap: 0;
}
.category-header .category-line {
  flex: 1; height: 1px; background: #eee;
}
.category-header .category-title {
  font-size: 13px; font-weight: 600; color: #B6E595; padding: 0 10px; white-space: nowrap;
}
.item-list {
  display: flex; flex-direction: column; gap: 5px; padding: 0 14px 14px;
}
.item-row {
  display: flex; align-items: flex-start; gap: 7px; padding: 3px 0;
}
.item-dot {
  width: 5px; height: 5px; border-radius: 50%; background: #B6E595;
  margin-top: 7px; flex-shrink: 0;
}
.item-name {
  font-size: 13px; color: #555; line-height: 1.6; flex: 1;
}
.redeem-tip {
  margin: 10px 12px 0; background: #fff; border-radius: 8px;
  padding: 20px 14px; text-align: center; box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}
.tip-text {
  display: block; font-size: 13px; color: #888; margin-bottom: 14px;
}
.btn-redeem {
  height: 42px; padding: 0 36px; background: #B6E595; color: #fff;
  border-radius: 21px; font-size: 15px; font-weight: 600; border: none;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}

/* 方案详情 — 兑换弹窗 */
.scheme-redeem-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 200;
}
.scheme-redeem-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 340px; max-width: 90vw; background: #fff; border-radius: 16px;
  padding: 28px 24px 20px; z-index: 201; box-sizing: border-box; text-align: center;
}
.sr-title {
  font-size: 17px; font-weight: 700; color: #333; margin-bottom: 6px;
}
.sr-subtitle {
  font-size: 13px; color: #999; margin-bottom: 20px;
}
.sr-input-wrap {
  position: relative; margin-bottom: 8px;
}
.sr-input {
  width: 100%; height: 48px; background: #F5F5F5; border: 1px solid transparent;
  border-radius: 10px; padding: 0 44px 0 16px; font-size: 16px; letter-spacing: 2px;
  text-align: center; box-sizing: border-box; outline: none;
}
.sr-input:focus { border-color: #B6E595; background: #FAFFFA; }
.sr-clear {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 50%; background: #ccc; color: #fff;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.sr-error {
  font-size: 13px; color: #ff4d4f; margin-bottom: 8px; text-align: center;
}
.sr-btn {
  width: 100%; height: 46px; background: #B6E595; color: #fff;
  border: none; border-radius: 10px; font-size: 16px; font-weight: 600;
  cursor: pointer; margin-top: 6px;
}
.sr-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.sr-cancel {
  font-size: 14px; color: #999; margin-top: 14px; cursor: pointer; user-select: none;
}
.sr-tip {
  font-size: 11px; color: #ccc; margin-top: 8px;
}
