/* ============================================================
   保利和悦福利商城 — WeChat Mini Program Style System
   ============================================================ */

/* 1. CSS Reset + Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #333;
  background: #F6F6F6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* 2. Page Container */
.wx-page {
  min-height: 100vh;
  width: 100%;
  background: #F6F6F6;
  position: relative;
  padding-bottom: 60px;
  overflow-x: hidden;
}

/* 3. Status Bar */
.wx-statusbar {
  height: 44px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 12px;
  color: #333;
}
.wx-statusbar .status-time { font-weight: 600; }
.wx-statusbar .status-icons { display: flex; gap: 4px; align-items: center; }

/* 4. Navigation Bar */
.wx-navbar {
  height: 44px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 600;
  position: relative;
  border-bottom: 1px solid #f0f0f0;
}
.wx-navbar .back {
  position: absolute;
  left: 16px;
  font-size: 20px;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.wx-navbar .back::before { content: "‹"; }

/* 5. Tab Bar */
.wx-tabbar {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  left: 0;
  height: 56px;
  background: white;
  display: flex;
  border-top: 1px solid #e5e5e5;
  z-index: 100;
}
.wx-tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #999;
  cursor: pointer;
}
.wx-tabbar-item.active { color: #07C160; }
.wx-tabbar-item .tab-icon {
  font-size: 22px;
  margin-bottom: 2px;
  line-height: 1;
}

/* 6. Card */
.wx-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* 7. Buttons */
.wx-btn-primary {
  background: #07C160;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 16px;
  width: 100%;
  text-align: center;
  cursor: pointer;
  display: block;
  font-family: inherit;
}
.wx-btn-primary:active { opacity: 0.8; }

.wx-btn-secondary {
  background: white;
  color: #07C160;
  border: 1px solid #07C160;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 16px;
  width: 100%;
  text-align: center;
  cursor: pointer;
  display: block;
  font-family: inherit;
}
.wx-btn-secondary:active { opacity: 0.8; }

.wx-btn-disabled {
  background: #ccc;
  color: #999;
  cursor: not-allowed;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 16px;
  width: 100%;
  text-align: center;
  display: block;
  font-family: inherit;
}

/* 8. Price */
.wx-price {
  color: #FA5151;
  font-weight: 700;
}
.wx-price-original {
  color: #999;
  text-decoration: line-through;
  font-size: 12px;
}
.wx-price .symbol { font-size: 14px; }
.wx-price .amount { font-size: 24px; }

/* 9. Tags */
.wx-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}
.wx-tag-employee  { background: #E8F5E9; color: #07C160; }
.wx-tag-homeowner { background: #FFF3E0; color: #FF9800; }
.wx-tag-enterprise{ background: #E3F2FD; color: #1976D2; }
.wx-tag-locked    { background: #FBE9E7; color: #E64A19; }

/* 10. Cell */
.wx-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: white;
  border-bottom: 1px solid #f0f0f0;
}
.wx-cell .cell-label { color: #333; }
.wx-cell .cell-value { color: #999; }
.wx-cell .cell-arrow::after { content: ">"; color: #ccc; }

/* 11. Modal */
.wx-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.wx-modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  width: 280px;
  text-align: center;
}

/* 12. Toast */
.wx-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  z-index: 300;
  font-size: 14px;
  white-space: nowrap;
}

/* 13. Role Switcher */
.role-switcher {
  position: fixed;
  right: 16px;
  bottom: 80px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #07C160;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  z-index: 150;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  text-align: center;
  line-height: 1.2;
}

/* 14. Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
}
.product-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.product-card .product-img {
  width: 100%;
  aspect-ratio: 1;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 32px;
}
.product-card .product-info { padding: 8px; }
.product-card .product-title {
  font-size: 13px;
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.product-card .product-price {
  color: #FA5151;
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
}

/* 15. Balance Card */
.balance-card {
  background: linear-gradient(135deg, #07C160, #05A14E);
  color: white;
  border-radius: 12px;
  padding: 20px;
  margin: 12px;
}
.balance-card .balance-label {
  font-size: 13px;
  opacity: 0.8;
}
.balance-card .balance-amount {
  font-size: 32px;
  font-weight: 700;
  margin: 8px 0;
}
.balance-card .balance-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.5);
  color: white;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  display: inline-block;
}

/* 16. Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: white;
  border-radius: 12px;
  margin: 12px;
  padding: 16px 0;
}
.quick-action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.quick-action-item .action-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.quick-action-item .action-label {
  font-size: 12px;
  color: #333;
}

/* 17. Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 12px 8px;
}
.section-header .section-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}
.section-header .section-more {
  font-size: 13px;
  color: #999;
  cursor: pointer;
}

/* 18. Timeline */
.timeline { padding: 16px; }
.timeline-item {
  display: flex;
  padding-bottom: 20px;
  position: relative;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 16px;
  bottom: 0;
  width: 1px;
  background: #e5e5e5;
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #07C160;
  margin-right: 12px;
  flex-shrink: 0;
  margin-top: 3px;
}
.timeline-dot.inactive { background: #ddd; }
.timeline-content .timeline-title {
  font-size: 14px;
  color: #333;
}
.timeline-content .timeline-time {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

/* 19. Order Card */
.order-card {
  background: white;
  border-radius: 12px;
  margin: 8px 12px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.order-card .order-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  color: #999;
}
.order-card .order-status { color: #07C160; }
.order-card .order-product {
  display: flex;
  gap: 12px;
}
.order-card .order-product-img {
  width: 80px;
  height: 80px;
  background: #f0f0f0;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 28px;
}
.order-card .order-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.order-card .order-btn {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
  font-family: inherit;
}
.order-card .order-btn-primary {
  border-color: #07C160;
  color: #07C160;
}

/* 20. Coupon Card */
.coupon-card {
  display: flex;
  background: white;
  border-radius: 12px;
  margin: 8px 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.coupon-card .coupon-left {
  width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FA5151, #FF7043);
  color: white;
  padding: 12px;
}
.coupon-card .coupon-amount {
  font-size: 28px;
  font-weight: 700;
}
.coupon-card .coupon-unit { font-size: 13px; }
.coupon-card .coupon-right {
  flex: 1;
  padding: 12px;
}
.coupon-card .coupon-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}
.coupon-card .coupon-condition {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}
.coupon-card .coupon-date {
  font-size: 11px;
  color: #bbb;
  margin-top: 8px;
}

/* 21. Form */
.form-group { margin-bottom: 16px; }
.form-label {
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
  display: block;
}
.form-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
  font-family: inherit;
  outline: none;
  color: #333;
}
.form-input:focus { border-color: #07C160; }
.form-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  font-size: 14px;
  min-height: 100px;
  box-sizing: border-box;
  resize: none;
  font-family: inherit;
  outline: none;
  color: #333;
}
.form-textarea:focus { border-color: #07C160; }
.form-select {
  width: 100%;
  padding: 12px;
  padding-right: 36px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
  font-family: inherit;
  outline: none;
  color: #333;
  appearance: none;
  -webkit-appearance: none;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
}

/* 22. Upload Area */
.upload-area {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.upload-item {
  aspect-ratio: 1;
  background: #f5f5f5;
  border: 1px dashed #ddd;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 24px;
  cursor: pointer;
}
.upload-item .upload-text {
  font-size: 11px;
  margin-top: 4px;
  color: #bbb;
}

/* 23. Progress Steps */
.progress-steps {
  display: flex;
  justify-content: space-between;
  padding: 16px;
  position: relative;
}
.progress-steps::before {
  content: "";
  position: absolute;
  top: 28px;
  left: 40px;
  right: 40px;
  height: 1px;
  background: #e5e5e5;
  z-index: 0;
}
.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  z-index: 1;
}
.progress-step .step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  margin-bottom: 8px;
}
.progress-step.active .step-dot  { background: #07C160; }
.progress-step.completed .step-dot { background: #07C160; }
.progress-step .step-label {
  font-size: 11px;
  color: #999;
  text-align: center;
}
.progress-step.active .step-label { color: #07C160; }

/* 24. Deduction Waterfall */
.deduction-waterfall { padding: 16px; }
.deduction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed #eee;
}
.deduction-item .deduction-label {
  font-size: 14px;
  color: #333;
}
.deduction-item .deduction-amount { font-size: 14px; color: #333; }
.deduction-item .deduction-amount.minus { color: #07C160; }
.deduction-item.total {
  border-bottom: none;
  padding-top: 16px;
}
.deduction-item.total .deduction-label { font-weight: 700; }
.deduction-item.total .deduction-amount {
  font-size: 20px;
  color: #FA5151;
  font-weight: 700;
}

/* 25. Address Card */
.address-card {
  display: flex;
  align-items: flex-start;
  padding: 16px;
  background: white;
  border-bottom: 1px solid #f0f0f0;
}
.address-card .address-info { flex: 1; }
.address-card .address-name {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}
.address-card .address-phone {
  font-size: 14px;
  color: #666;
  margin-left: 12px;
}
.address-card .address-detail {
  font-size: 13px;
  color: #999;
  margin-top: 4px;
  line-height: 1.5;
}
.address-card .address-tag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid #07C160;
  color: #07C160;
  font-size: 11px;
  border-radius: 3px;
  margin-left: 8px;
}

/* 26. Utility Classes */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mx-12 { margin: 0 12px; }
.px-12 { padding: 0 12px; }
.flex  { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.hidden       { display: none !important; }
.text-muted   { color: #999; }
.text-sm      { font-size: 12px; }
.text-lg      { font-size: 18px; }
.font-bold    { font-weight: 700; }

/* 27. Animations */
@keyframes fadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes slideUp {
  0%   { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0);    opacity: 1; }
}

@keyframes checkmark {
  0%   { transform: scale(0); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.animate-fadeIn  { animation: fadeIn  0.3s ease; }
.animate-slideUp { animation: slideUp 0.3s ease; }

/* 28. Product Placeholder Images (replaces emoji) */
.ph-img {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.ph-img .ph-brand {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.7;
  text-transform: uppercase;
}
.ph-img .ph-name {
  font-size: 15px;
  font-weight: 700;
  margin-top: 2px;
}
/* color variants */
.ph-img.ph-warm   { background: #f3ebe4; color: #8c6d52; }
.ph-img.ph-cool   { background: #e4edf3; color: #4a6d8c; }
.ph-img.ph-mint   { background: #e2f0e9; color: #3d7a56; }
.ph-img.ph-rose   { background: #f3e4ea; color: #8c4a6d; }
.ph-img.ph-slate  { background: #eaeced; color: #555d65; }
.ph-img.ph-sand   { background: #f0ede4; color: #7a7252; }
.ph-img.ph-sky    { background: #e4ecf8; color: #4a6a9c; }
.ph-img.ph-peach  { background: #f8ece4; color: #9c6a4a; }

/* 29. Icon Circle (replaces emoji icons) */
.ic {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.ic-green  { background: #e8f5e9; color: #2e7d32; }
.ic-orange { background: #fff3e0; color: #e65100; }
.ic-blue   { background: #e3f2fd; color: #1565c0; }
.ic-red    { background: #fce4ec; color: #c62828; }
.ic-purple { background: #f3e5f5; color: #6a1b9a; }
.ic-teal   { background: #e0f2f1; color: #00695c; }
