/* ============================================================
   冒小冒 · 如东红芒虾饼 · 小程序全局设计系统 V2
   日系极简克制风格 · %Arabica 方向
   ============================================================ */

/* --------------------------------
   1. CSS Custom Properties
   -------------------------------- */
:root {
  /* Brand colors */
  --bg:         #FAFAF7;
  --card:       #FFFFFF;
  --btn:        #B8977E;
  --btn-hover:  #A6846B;
  --accent:     #E8B86D;
  --accent-bg:  #FDF6ED;

  /* Text */
  --text:       #1A1A1A;
  --text-sub:   #6B6B6B;
  --text-muted: #AAAAAA;

  /* Functional colors (muted) */
  --tag-pending:   #C8963E;
  --tag-shipping:  #7BA78D;
  --tag-delivered: #6B9E7B;
  --tag-refunded:  #B0907A;
  --tag-pending-bg:   #FDF6ED;
  --tag-shipping-bg:  #F4FAF6;
  --tag-delivered-bg: #F3F8F4;
  --tag-refunded-bg:  #F9F5F2;

  /* Borders */
  --divider:    #F0EDE8;
  --border:     #E8E3DA;

  /* Shadows */
  --shadow-card: 0 2px 12px rgba(0,0,0,0.04);

  /* Radii */
  --radius:     16px;
  --radius-btn: 48px;
  --radius-sm:  8px;
  --radius-xs:  6px;

  /* Spacing */
  --sp-4:  4px;
  --sp-8:  8px;
  --sp-12: 12px;
  --sp-16: 16px;
  --sp-20: 20px;
  --sp-24: 24px;
  --sp-32: 32px;
  --sp-40: 40px;
  --sp-48: 48px;
  --sp-64: 64px;

  /* Layout */
  --page-max: 414px;
  --safe:     16px;
  --nav-h:    48px;

  /* Transitions */
  --ease: 0.2s ease;
}

/* --------------------------------
   2. Reset & Base
   -------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* --------------------------------
   3. Phone Frame
   -------------------------------- */
.phone-frame {
  max-width: var(--page-max);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}
@media (max-width: 420px) {
  .phone-frame { max-width: 100%; }
}

/* --------------------------------
   4. Navbar
   -------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--safe);
}
.navbar-back {
  position: absolute;
  left: var(--safe);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--text);
}
.navbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
}

/* --------------------------------
   5. Primary Button
   -------------------------------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--btn);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 1px;
  border: none;
  border-radius: var(--radius-btn);
  padding: 12px 32px;
  cursor: pointer;
  transition: background var(--ease);
}
.btn-primary:active { background: var(--btn-hover); }
.btn-primary:disabled {
  background: #D4D4D4;
  color: var(--text-muted);
  cursor: not-allowed;
}
.btn-primary.loading {
  pointer-events: none;
  color: transparent;
  position: relative;
}
.btn-primary.loading::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  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;
}

/* --------------------------------
   6. Outline Button
   -------------------------------- */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
  background: transparent;
  color: var(--btn);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--btn);
  border-radius: var(--radius-btn);
  padding: 10px 24px;
  cursor: pointer;
  transition: background var(--ease);
}
.btn-outline:active { background: var(--accent-bg); }

/* --------------------------------
   7. Status Badge
   -------------------------------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.status-badge.pending   { background: var(--tag-pending-bg);   color: var(--tag-pending);   }
.status-badge.shipping  { background: var(--tag-shipping-bg);  color: var(--tag-shipping);  }
.status-badge.delivered { background: var(--tag-delivered-bg); color: var(--tag-delivered); }
.status-badge.refunded  { background: var(--tag-refunded-bg);  color: var(--tag-refunded);  }
.status-badge.paid      { background: var(--accent-bg);        color: var(--accent);        }

/* --------------------------------
   8. Order Card
   -------------------------------- */
.order-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: var(--sp-20);
  margin: 0 var(--safe) var(--sp-12);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: box-shadow var(--ease);
}
.order-card:active { box-shadow: none; }

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-12);
}
.order-card-no {
  font-size: 13px;
  color: var(--text-muted);
}
.order-card-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-8);
}
.order-card-product {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.order-card-price {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.order-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.order-card-time {
  font-size: 12px;
  color: var(--text-muted);
}

/* --------------------------------
   9. Empty State
   -------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-64) var(--sp-32);
  text-align: center;
}
.empty-state .icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--divider);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-24);
}
.empty-state .icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--text-muted);
}
.empty-state .text {
  font-size: 15px;
  color: var(--text-sub);
  margin-bottom: var(--sp-24);
  line-height: 1.8;
}

/* --------------------------------
   10. Shipping Timeline
   -------------------------------- */
.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 1.5px;
  background: var(--divider);
}
.timeline-item {
  position: relative;
  padding-bottom: var(--sp-24);
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--text-muted);
  border: 3px solid var(--card);
  z-index: 1;
}
.timeline-item.active .timeline-dot { background: var(--btn); }
.timeline-content {
  font-size: 14px;
  color: var(--text-sub);
}
.timeline-item.active .timeline-content {
  color: var(--text);
  font-weight: 500;
}
.timeline-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --------------------------------
   11. Toast
   -------------------------------- */
.toast {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: var(--text);
  color: #fff;
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 13px;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: all var(--ease);
  letter-spacing: 0.5px;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { background: #7BA78D; }

/* --------------------------------
   12. Section Divider
   -------------------------------- */
.section-divider {
  width: 100%;
  height: 1px;
  background: var(--divider);
  border: none;
}

/* --------------------------------
   13. Price
   -------------------------------- */
.price-tag {
  font-weight: 600;
  color: var(--accent);
}
.price-tag .unit { font-size: 14px; font-weight: 400; }
.price-tag .amount { font-size: 22px; }

/* --------------------------------
   14. Info Card
   -------------------------------- */
.info-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: var(--sp-24);
  margin: 0 var(--safe) var(--sp-16);
  box-shadow: var(--shadow-card);
}
.info-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--sp-16);
  display: flex;
  align-items: center;
  gap: var(--sp-8);
}

/* --------------------------------
   15. Animations
   -------------------------------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in {
  animation: fadeIn 0.3s var(--ease) both;
}

/* --------------------------------
   16. Utility
   -------------------------------- */
.text-center  { text-align: center; }
.text-sub     { color: var(--text-sub); }
.text-muted   { color: var(--text-muted); }
.mt-8  { margin-top: var(--sp-8);  }
.mt-16 { margin-top: var(--sp-16); }
.mt-24 { margin-top: var(--sp-24); }
.mt-32 { margin-top: var(--sp-32); }
.mb-16 { margin-bottom: var(--sp-16); }
.mb-24 { margin-bottom: var(--sp-24); }
.px-safe { padding-left: var(--safe); padding-right: var(--safe); }
