/* Eden Fresh Produce — storefront styles. Fresh, modern, produce-market feel. */
:root {
  --green: #2e7d32;
  --green-dark: #1b5e20;
  --green-light: #e8f5e9;
  --green-mid: #43a047;
  --cream: #faf8f3;
  --ink: #1c2b1e;
  --muted: #6b7a6e;
  --line: #e6e2d9;
  --card: #ffffff;
  --amber: #f57c00;
  --amber-light: #fff3e0;
  --red: #c62828;
  --red-light: #ffebee;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(28, 43, 30, .08);
  --shadow-lg: 0 10px 30px rgba(28, 43, 30, .14);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
}
a { color: var(--green); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-mid); box-shadow: 0 0 0 3px var(--green-light); }
img { display: block; max-width: 100%; }

/* Header */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
/* Row 1: brand + nav + cart + login/register. Row 2 (.topbar-sub) holds
   the region picker and the search, so the bar is two roomy rows
   instead of one crowded one. */
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar-sub { border-top: 1px solid var(--line); }
.topbar-sub-in { max-width: 1180px; margin: 0 auto; padding: 8px 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--green-dark); letter-spacing: -.3px; white-space: nowrap; }
.brand .logo { width: 38px; height: 38px; border-radius: 12px; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; }
.brand .logo svg { width: 22px; height: 22px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav button { background: none; border: none; padding: 8px 12px; border-radius: 10px; font-size: 15px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.nav button:hover, .nav button.active { background: var(--green-light); color: var(--green-dark); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-right #auth-area { display: inline-flex; gap: 8px; white-space: nowrap; }
.search-box { display: flex; align-items: center; gap: 6px; background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 14px; flex: 1; min-width: 220px; }
.search-box input { border: none; padding: 6px 0; flex: 1; width: auto; min-width: 0; box-shadow: none; }
.search-box input:focus { box-shadow: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 999px; padding: 10px 18px; font-size: 15px; font-weight: 700; background: var(--green); color: #fff; transition: background .15s; }
.btn:hover { background: var(--green-dark); }
.btn.ghost { background: #fff; color: var(--green-dark); border: 1.5px solid var(--green); }
.btn.ghost:hover { background: var(--green-light); }
.btn.soft { background: var(--green-light); color: var(--green-dark); }
.btn.soft:hover { background: #d6ecd8; }
.btn.amber { background: var(--amber); }
.btn.amber:hover { background: #e65100; }
.btn.danger { background: var(--red); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sm { padding: 7px 12px; font-size: 14px; }

/* Region switcher (guests) and region badge (logged-in customers). */
.region-switch { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.region-switch button { border: none; background: transparent; padding: 7px 14px; font-size: 14px; font-weight: 700; color: var(--muted); }
.region-switch button.active { background: var(--green); color: #fff; }
.region-badge { display: inline-flex; align-items: center; background: var(--green-light); color: var(--green-dark); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 700; white-space: nowrap; }

/* Company choice on the registration form: two radio cards. */
.company-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.company-card { display: flex; flex-direction: column; gap: 2px; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; background: #fff; }
.company-card:has(input:checked) { border-color: var(--green); background: var(--green-light); }
.company-card input { width: auto; margin: 0 0 4px; accent-color: var(--green); }
.company-card .cc-name { font-weight: 700; font-size: 15px; }
.company-card .cc-sub { font-size: 13px; color: var(--muted); }
.cart-btn { position: relative; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
.cart-btn .count { background: var(--amber); color: #fff; border-radius: 999px; min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; padding: 0 5px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.user-chip .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--green-light); color: var(--green-dark); display: flex; align-items: center; justify-content: center; font-weight: 800; }

/* Layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px 60px; }
.notice { border-radius: 12px; padding: 12px 16px; margin: 16px 0; font-size: 14.5px; }
.notice.amber { background: var(--amber-light); border: 1px solid #ffe0b2; color: #7a3e00; }
.notice.green { background: var(--green-light); border: 1px solid #c8e6c9; color: var(--green-dark); }
.notice.red { background: var(--red-light); border: 1px solid #ffcdd2; color: var(--red); }

/* Hero */
.hero { margin-top: 20px; border-radius: 24px; overflow: hidden; position: relative; min-height: 340px; display: flex; align-items: flex-end; box-shadow: var(--shadow-lg); }
.hero img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero .overlay { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(20,40,20,.72) 0%, rgba(20,40,20,.45) 55%, rgba(20,40,20,.05) 100%); }
.hero .content { position: relative; padding: 36px; max-width: 620px; color: #fff; }
.hero h1 { margin: 0 0 10px; font-size: 38px; line-height: 1.15; letter-spacing: -.5px; }
.hero p { margin: 0 0 20px; font-size: 17px; opacity: .95; }
.hero .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
/* One-click reorder （一键复购）: the prominent button in the hero, with
   the last order's number and item count underneath so the customer can
   see at a glance which order it will copy. */
.reorder-box { margin-top: 14px; }
.reorder-box .btn { font-size: 17px; padding: 12px 26px; }
.reorder-sub { margin-top: 8px; font-size: 13.5px; color: rgba(255,255,255,.85); }
.chip { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; backdrop-filter: blur(4px); }

/* Steps */
.section { margin-top: 36px; }
.section h2 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.3px; }
.section .sub { color: var(--muted); margin: 0 0 18px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.step .num { width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.step h3 { margin: 0 0 6px; font-size: 17px; }
.step p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* Payment rule card */
.payrule { background: #fff; border: 1.5px solid #c8e6c9; border-radius: var(--radius); padding: 20px 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; box-shadow: var(--shadow); }
.payrule h3 { margin: 0 0 8px; font-size: 18px; color: var(--green-dark); }
.payrule .rule { background: var(--green-light); border-radius: 12px; padding: 14px 16px; }
.payrule .rule.over { background: var(--amber-light); }
.payrule .rule .amount { font-size: 22px; font-weight: 800; }
.payrule .rule p { margin: 6px 0 0; font-size: 14.5px; }

/* Category pills */
.cat-pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0; }
.cat-pills button { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 16px; font-size: 14.5px; font-weight: 600; }
.cat-pills button.active { background: var(--green); border-color: var(--green); color: #fff; }

/* Product grid */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card .thumb { position: relative; aspect-ratio: 4/3; overflow: hidden; background: #eef3ee; cursor: pointer; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,.94); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 700; color: var(--green-dark); }
.badge.low { color: #b26a00; }
.badge.out { color: var(--red); }
.card .body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 16.5px; line-height: 1.3; cursor: pointer; }
.card .meta { color: var(--muted); font-size: 13.5px; }
.card .price-row { display: flex; align-items: baseline; gap: 6px; margin-top: auto; }
.card .price { font-size: 20px; font-weight: 800; color: var(--green-dark); }
.card .unit { color: var(--muted); font-size: 13.5px; }
.qty-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.qty-ctl { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; }
.qty-ctl button { width: 32px; height: 32px; border: none; background: #fff; font-size: 17px; font-weight: 700; }
.qty-ctl button:hover { background: var(--green-light); }
.qty-ctl span { min-width: 34px; text-align: center; font-weight: 700; }

/* Drawer (cart) */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(20,30,20,.45); z-index: 80; display: none; }
.drawer-backdrop.open { display: block; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 94vw); background: #fff; z-index: 90; box-shadow: -8px 0 30px rgba(0,0,0,.18); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s; }
.drawer.open { transform: none; }
.drawer header { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.drawer header h2 { margin: 0; font-size: 19px; }
.drawer .items { flex: 1; overflow-y: auto; padding: 12px 20px; }
.cart-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; }
.cart-item .info { flex: 1; }
.cart-item .info h4 { margin: 0 0 2px; font-size: 15px; }
.cart-item .info .meta { color: var(--muted); font-size: 13px; }
.cart-item .line-total { font-weight: 800; white-space: nowrap; }
.drawer footer { border-top: 1px solid var(--line); padding: 16px 20px 20px; }
.totals { display: grid; gap: 6px; margin-bottom: 14px; font-size: 15px; }
.totals .row { display: flex; justify-content: space-between; }
.totals .row.grand { font-weight: 800; font-size: 18px; border-top: 1px solid var(--line); padding-top: 8px; }
.totals .free { color: var(--green); font-weight: 700; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,30,20,.45); z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 20px; width: min(560px, 96vw); padding: 26px; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(760px, 96vw); }
.modal h2 { margin: 0 0 6px; font-size: 22px; }
.modal .sub { color: var(--muted); margin: 0 0 18px; font-size: 14.5px; }
.modal .field { margin-bottom: 14px; }
.modal .field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.modal .field .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.modal .actions { display: flex; gap: 10px; margin-top: 20px; }
.modal .actions .btn { flex: 1; }
.form-error { color: var(--red); font-size: 14px; margin: 8px 0 0; min-height: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Product detail */
.pd { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.pd img { border-radius: 14px; width: 100%; aspect-ratio: 1; object-fit: cover; }
.pd h2 { margin: 0 0 4px; }
.pd .price { font-size: 26px; font-weight: 800; color: var(--green-dark); margin: 10px 0; }
.pd dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14.5px; margin: 12px 0; }
.pd dt { color: var(--muted); }
.pd dd { margin: 0; }

/* Checkout */
.checkout-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.panel { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.panel h3 { margin: 0 0 14px; font-size: 17px; }
.bank-box { background: var(--green-light); border-radius: 12px; padding: 14px 16px; font-size: 14.5px; }
.bank-box .row { display: flex; justify-content: space-between; padding: 3px 0; }
.bank-box .row b { font-weight: 700; }
.summary-line { display: flex; justify-content: space-between; padding: 5px 0; font-size: 15px; }
.summary-line.grand { font-weight: 800; font-size: 18px; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }

/* Orders */
.order-card { background: #fff; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 14px; }
.order-card .head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.order-card .head b { font-size: 16.5px; }
.pill { display: inline-block; border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 700; }
.pill.green { background: var(--green-light); color: var(--green-dark); }
.pill.amber { background: var(--amber-light); color: #8a4b00; }
.pill.grey { background: #f0ede6; color: #5f6b60; }
.pill.red { background: var(--red-light); color: var(--red); }
.order-card .meta { color: var(--muted); font-size: 14px; margin-top: 6px; }
.order-items { margin: 12px 0 0; border-top: 1px solid var(--line); }
.order-items .oi { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14.5px; border-bottom: 1px solid #f2efe8; }
.timeline { list-style: none; margin: 10px 0 0; padding: 0; }
.timeline li { padding: 6px 0 6px 18px; border-left: 2px solid var(--green-mid); margin-left: 6px; font-size: 14.5px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.timeline .t { color: var(--muted); font-size: 13px; }

/* Footer */
footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 26px 20px; color: var(--muted); font-size: 14px; }
footer .wrap { padding: 0; display: flex; flex-wrap: wrap; gap: 8px 30px; justify-content: space-between; }

/* Dual-language text: every label shows both languages. .tx-p is the
   primary language (Chinese on the storefront), .tx-s the secondary —
   smaller and muted. The two lines stack by default; compact elements
   keep them on one line. */
.tx-p { display: block; }
.tx-s { display: block; font-size: .82em; line-height: 1.35; color: var(--muted); font-weight: 400; }
h1 .tx-s, h2 .tx-s { font-size: .6em; }
.hero .tx-s { color: rgba(255,255,255,.72); }
/* Compact elements keep both languages on one line. */
.topbar .tx-p, .topbar .tx-s,
.pill .tx-p, .pill .tx-s,
.chip .tx-p, .chip .tx-s,
.badge .tx-p, .badge .tx-s,
.card .meta .tx-p, .card .meta .tx-s,
.order-card .meta .tx-p, .order-card .meta .tx-s,
.bank-box .tx-p, .bank-box .tx-s,
.summary-line .tx-p, .summary-line .tx-s,
.totals .row .tx-p, .totals .row .tx-s,
.btn.sm .tx-p, .btn.sm .tx-s,
.cat-pills .tx-p, .cat-pills .tx-s,
.region-switch .tx-p, .region-switch .tx-s,
.region-badge .tx-p, .region-badge .tx-s { display: inline; }
.topbar .tx-s, .pill .tx-s, .chip .tx-s, .badge .tx-s,
.card .meta .tx-s, .order-card .meta .tx-s,
.bank-box .tx-s, .summary-line .tx-s, .totals .row .tx-s,
.btn.sm .tx-s, .cat-pills .tx-s,
.region-switch .tx-s, .region-badge .tx-s { margin-left: .45em; font-size: .85em; }
/* Secondary text on coloured backgrounds inherits the element colour. */
.btn .tx-s, .pill .tx-s, .chip .tx-s, .badge .tx-s,
.region-switch button.active .tx-s { color: inherit; opacity: .75; }
/* Regular buttons stack the two languages; small buttons stay one line. */
.btn { flex-direction: column; }
.btn.sm { flex-direction: row; }
/* Alerts built from two plain-text lines keep their line break. */
.notice, .form-error { white-space: pre-line; }

.hidden { display: none !important; }

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .payrule { grid-template-columns: 1fr; }
  .checkout-grid { grid-template-columns: 1fr; }
  .pd { grid-template-columns: 1fr; }
  .hero h1 { font-size: 28px; }
  /* Two-row topbar on narrow screens: brand + cart + login on row 1,
     region + search on row 2 (the search takes its own line when the
     region picker does not leave it room). */
  .topbar-in { padding: 10px 14px; gap: 8px 10px; }
  .topbar-sub-in { padding: 8px 14px; gap: 8px; }
  .brand { font-size: 18px; }
  .brand .logo { width: 34px; height: 34px; }
  .nav { display: none; }
  .two-col { grid-template-columns: 1fr; }
}
