﻿/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:   #FF6B35;
  --primary-d: #E05520;
  --secondary: #FFF3EE;
  --text:      #333333;
  --text-s:    #888888;
  --border:    #EEEEEE;
  --white:     #FFFFFF;
  --bg:        #F8F8F8;
  --success:   #52C41A;
  --warning:   #FAAD14;
  --danger:    #FF4D4F;
  --radius:    12px;
  --shadow:    0 2px 12px rgba(0,0,0,.08);
  --font:      'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  width: 100%;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; outline: none; font-family: var(--font); }
input, textarea, select { font-family: var(--font); outline: none; }
table { border-collapse: collapse; width: 100%; }

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}
.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
.page-content { flex: 1; padding: 16px 0 80px; }

/* ===== Top Nav ===== */
.top-nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: 52px; display: flex; align-items: center;
  padding: 0 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  overflow: hidden;
}
.top-nav .nav-back { font-size: 20px; margin-right: 12px; color: var(--text); white-space: nowrap; }
.top-nav .nav-title { font-size: 17px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-nav .nav-action { font-size: 14px; color: var(--primary); white-space: nowrap; }

/* ===== Bottom Tab Bar ===== */
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex; height: 60px;
  max-width: none;
  box-shadow: 0 -1px 8px rgba(0,0,0,.06);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; color: var(--text-s);
  transition: color .2s;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.tab-item.active { color: var(--primary); }
.tab-item .tab-icon { font-size: 22px; line-height: 1; }
.tab-item span:not(.tab-icon) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 24px; border-radius: 22px;
  font-size: 15px; font-weight: 500; transition: .2s;
  white-space: nowrap; overflow: hidden;
  box-sizing: border-box;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:active { background: var(--primary-d); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-block { width: 100%; border-radius: var(--radius); }
.btn-lg { height: 50px; font-size: 16px; border-radius: 25px; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; border-radius: 16px; }

/* ===== Cards ===== */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card + .card { margin-top: 12px; }
.card-body { padding: 16px; overflow: hidden; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; }

/* ===== Form ===== */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; color: var(--text-s); margin-bottom: 6px; display: block; }
.form-input {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 15px; background: var(--white);
  transition: border-color .2s;
  box-sizing: border-box;
  max-width: 100%;
}
.form-input:focus { border-color: var(--primary); }
.form-textarea { height: auto; padding: 12px 14px; resize: vertical; min-height: 80px; }

/* ===== Upload Zone ===== */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--secondary); padding: 36px 20px;
  text-align: center; cursor: pointer; transition: .2s;
  overflow: hidden;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: #fff3ee; }
.upload-zone .upload-icon { font-size: 48px; margin-bottom: 10px; }
.upload-zone .upload-text { font-size: 15px; color: var(--text-s); }
.upload-zone .upload-hint { font-size: 12px; color: #bbb; margin-top: 6px; }

/* ===== Preview ===== */
.preview-wrap { background: #f0f0f0; border-radius: var(--radius); overflow: hidden; position: relative; min-height: 200px; display: flex; align-items: center; justify-content: center; }
.preview-wrap canvas { max-width: 100%; display: block; }
.preview-placeholder { color: var(--text-s); font-size: 14px; text-align: center; padding: 40px 20px; }

/* ===== Crop Controls ===== */
.crop-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.crop-btn { flex: 1; min-width: 70px; height: 36px; border-radius: 8px; font-size: 13px; background: var(--white); border: 1.5px solid var(--border); color: var(--text); transition: .2s; }
.crop-btn:active, .crop-btn.active { background: var(--secondary); border-color: var(--primary); color: var(--primary); }

/* ===== Product Size Chips ===== */
.size-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.size-chip { padding: 6px 14px; border-radius: 20px; font-size: 13px; border: 1.5px solid var(--border); background: var(--white); cursor: pointer; transition: .2s; white-space: nowrap; }
.size-chip.active { border-color: var(--primary); background: var(--secondary); color: var(--primary); font-weight: 500; }

/* ===== Order Status Badge ===== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.badge-pending  { background: #FFF7E6; color: var(--warning); }
.badge-making   { background: #E6F7FF; color: #1890FF; }
.badge-shipped  { background: #F6FFED; color: var(--success); }
.badge-done     { background: #F0F0F0; color: var(--text-s); }

/* ===== QR Code Block ===== */
.qr-block { text-align: center; padding: 20px; }
.qr-block img { width: 160px; height: 160px; margin: 0 auto 10px; border-radius: 8px; border: 1px solid var(--border); }
.qr-label { font-size: 13px; color: var(--text-s); }

/* ===== Login Page ===== */
.login-logo { text-align: center; padding: 48px 20px 32px; }
.login-logo .logo-icon { font-size: 64px; }
.login-logo .logo-name { font-size: 22px; font-weight: 700; margin-top: 10px; color: var(--primary); }
.login-logo .logo-slogan { font-size: 13px; color: var(--text-s); margin-top: 6px; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-s); font-size: 13px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.wechat-login-btn { width: 100%; height: 50px; border-radius: 25px; background: #07C160; color: var(--white); font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* ===== Admin Layout (PC) ===== */
.admin-layout { display: flex; min-height: 100vh; overflow-x: hidden; }
.admin-sidebar {
  width: 220px;
  background: #1a1a2e;
  color: var(--white);
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .3s;
}
.admin-sidebar.open { transform: translateX(0); }
.admin-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
}
.admin-overlay.show { display: block; }
.admin-sidebar .sidebar-logo { padding: 24px 20px; font-size: 16px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.1); white-space: nowrap; }
.admin-sidebar .sidebar-menu { padding: 12px 0; }
.admin-sidebar .menu-item { padding: 12px 20px; font-size: 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; transition: .2s; white-space: nowrap; }
.admin-sidebar .menu-item:hover, .admin-sidebar .menu-item.active { background: rgba(255,107,53,.2); color: var(--primary); }
.admin-main { flex: 1; background: var(--bg); min-width: 0; }
.admin-topbar { background: var(--white); height: 60px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); overflow: hidden; }
.admin-topbar .hamburger { font-size: 22px; cursor: pointer; padding: 8px; margin-right: 12px; display: block; }
.admin-content { padding: 20px; overflow-x: hidden; }
.admin-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); overflow: hidden; }
.stat-num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-s); margin-top: 4px; }

/* Admin table responsive */
.admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -20px; padding: 0 20px; }
.admin-table { min-width: 600px; }

/* Admin panel section */
.admin-section { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.admin-section-header { padding: 14px 16px; font-size: 15px; font-weight: 600; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.admin-section-body { padding: 16px; }

/* ===== 协议弹窗（全响应式） ===== */
.legal-popup-overlay { position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:99998; display:flex; align-items:center; justify-content:center; padding:16px; box-sizing: border-box; }
.legal-popup-box { background:#fff; border-radius:12px; width:100%; max-width:680px; max-height:88vh; max-height: 88dvh; display:flex; flex-direction:column; box-shadow:0 24px 60px rgba(0,0,0,.35); overflow:hidden; }
.legal-popup-header { display:flex; justify-content:space-between; align-items:center; padding:14px 20px; border-bottom:1px solid #eee; flex-shrink:0; }
.legal-popup-header h3 { margin:0; font-size:1rem; font-weight:700; color:var(--text); white-space: nowrap; overflow:hidden; text-overflow:ellipsis; }
.legal-popup-close { cursor:pointer; font-size:1.5rem; color:#999; line-height:1; padding:0 4px; }
.legal-popup-close:hover { color:#333; }
.legal-popup-body { flex:1; overflow-y:auto; padding:20px; line-height:1.8; -webkit-overflow-scrolling: touch; }
.legal-popup-body h1 { font-size:1.1rem; margin:0 0 16px; }
.legal-popup-body h2 { font-size:.95rem; font-weight:700; margin:16px 0 6px; }
.legal-popup-body p { font-size:.85rem; color:var(--text); margin:0 0 8px; word-break: break-all; }
.legal-popup-body .last-updated { font-size:.75rem; color:var(--text-s); text-align:center; margin-bottom:16px; }
.legal-popup-body strong { font-weight:700; }
.legal-popup-body em { font-style:italic; }
.legal-popup-body u { text-decoration:underline; }
.legal-popup-body ul,.legal-popup-body ol { margin:4px 0; padding-left:22px; font-size:.85rem; }
.legal-popup-body li { margin-bottom:3px; font-size:.85rem; word-break: break-all; }
.legal-popup-body .loading { text-align:center; color:#888; padding:40px 0; font-size:.85rem; }

/* ===== 统一页脚 ===== */
.site-footer { background: #fff; border-top: 1px solid var(--border); padding: 16px 0 20px; margin-top: auto; text-align: center; overflow: hidden; }
.site-footer .footer-links { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.site-footer .footer-links a { font-size: 13px; color: var(--primary); text-decoration: none; white-space: nowrap; }
.site-footer .footer-links a:hover { text-decoration: underline; }
.site-footer .footer-links .sep { color: var(--text-s); font-size: 13px; }
.site-footer .footer-icp { font-size: 11px; color: var(--text-s); line-height: 1.5; }
.site-footer .footer-icp a { color: var(--text-s); text-decoration: none; }
.site-footer .footer-icp a:hover { color: var(--text); text-decoration: underline; }

/* ===== 协议勾选 ===== */
.agreement-row { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0 12px; flex-wrap: wrap; }
.agreement-row input[type="checkbox"] { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; cursor: pointer; }
.agreement-row label { font-size: 12px; color: var(--text-s); line-height: 1.6; cursor: pointer; flex: 1; min-width: 0; word-break: break-all; }
.agreement-row label a { color: var(--primary); text-decoration: none; }
.agreement-row label a:hover { text-decoration: underline; }

/* ===== 法律页面通用 ===== */
.legal-page { padding: 0 16px 40px; max-width: 480px; margin: 0 auto; box-sizing: border-box; }
.legal-page h1 { font-size: 20px; font-weight: 700; text-align: center; padding: 32px 0 20px; }
.legal-page h2 { font-size: 16px; font-weight: 600; margin: 24px 0 10px; }
.legal-page h3 { font-size: 14px; font-weight: 600; margin: 16px 0 8px; }
.legal-page p { font-size: 14px; color: var(--text); line-height: 1.8; margin-bottom: 10px; word-break: break-all; }
.legal-page ul { padding-left: 20px; margin-bottom: 10px; }
.legal-page li { font-size: 14px; color: var(--text); line-height: 1.8; word-break: break-all; }
.legal-page .last-updated { font-size: 12px; color: var(--text-s); text-align: center; margin-bottom: 24px; }

/* ===== 订单筛选标签 ===== */
.order-tabs { display: flex; gap: 0; background: var(--white); border-radius: var(--radius); padding: 4px; margin-bottom: 14px; box-shadow: var(--shadow); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.order-tabs::-webkit-scrollbar { display: none; }
.order-tab { flex: 1; min-width: 56px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--text-s); border-radius: 8px; cursor: pointer; transition: all .2s; white-space: nowrap; user-select: none; }
.order-tab.active { background: var(--primary); color: var(--white); font-weight: 600; box-shadow: 0 2px 8px rgba(255,107,53,.35); }

/* ===== 订单卡片（新设计） ===== */
.order-list { display: flex; flex-direction: column; gap: 12px; }
.order-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: transform .18s, box-shadow .18s; display: block; }
.order-card:active { transform: scale(.985); box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.order-card-header { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); overflow: hidden; gap: 8px; }
.order-no { font-size: 12px; color: var(--text-s); letter-spacing: .5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-status { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 12px; flex-shrink: 0; white-space: nowrap; }
.status-pending    { background: #FFF7E6; color: #FA8C16; }
.status-processing { background: #E6F7FF; color: #1890FF; }
.status-shipped    { background: #F6FFED; color: #52C41A; }
.status-completed  { background: #F0F0F0; color: #8C8C8C; }
.status-cancelled  { background: #FFF1F0; color: #FF4D4F; }
.order-card-body { padding: 12px 14px; display: flex; gap: 12px; align-items: center; overflow: hidden; }
.order-thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--bg); flex-shrink: 0; border: 1px solid var(--border); }
.order-info { flex: 1; min-width: 0; overflow: hidden; }
.order-title { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-size { font-size: 12px; color: var(--text-s); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-time { font-size: 12px; color: #bbb; margin-top: 4px; white-space: nowrap; }
.order-arrow { color: var(--text-s); font-size: 18px; flex-shrink: 0; }

/* ===== 个人中心 ===== */
.user-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.user-card-body { padding: 20px 16px; display: flex; align-items: center; gap: 14px; }
.user-avatar { width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(135deg, #FF6B35, #FF9A5C); display: flex; align-items: center; justify-content: center; font-size: 28px; flex-shrink: 0; box-shadow: 0 4px 12px rgba(255,107,53,.35); overflow: hidden; }
.user-info { flex: 1; min-width: 0; overflow: hidden; }
.user-name { font-size: 18px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 13px; color: var(--text-s); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--secondary); color: var(--primary); font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 10px; margin-top: 6px; white-space: nowrap; }

/* ===== 快捷菜单宫格 ===== */
.menu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; padding: 4px 0; }
.menu-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; cursor: pointer; transition: background .15s; border-radius: 8px; margin: 4px; text-decoration: none; box-sizing: border-box; }
.menu-item:active { background: var(--bg); }
.menu-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; overflow: hidden; }
.menu-text { font-size: 11px; color: var(--text); font-weight: 500; text-align: center; word-break: break-word; line-height: 1.3; }

/* ===== 功能列表 ===== */
.list-group { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 12px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); text-decoration: none; transition: background .15s; cursor: pointer; overflow: hidden; }
.list-item:last-child { border-bottom: none; }
.list-item:active { background: var(--bg); }
.list-icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; overflow: hidden; }
.list-text { flex: 1; font-size: 15px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-arrow { font-size: 18px; color: #ccc; transition: transform .15s; flex-shrink: 0; }
.list-item:active .list-arrow { transform: translateX(3px); }
.list-item.danger .list-text { color: var(--danger); }
.list-item.danger .list-icon { background: #FFF1F0; }

/* ===== 通用页脚 ===== */
.page-footer { text-align: center; padding: 20px 16px 10px; font-size: 12px; color: var(--text-s); overflow: hidden; }
.page-footer a { color: var(--primary); text-decoration: none; }
.page-footer a:hover { text-decoration: underline; }
.page-footer .footer-sep { margin: 0 6px; color: #ccc; }
.page-footer p { margin: 0; line-height: 1.8; }

/* ===== 加载状态 ===== */
.loading-state { text-align: center; padding: 60px 20px; color: var(--text-s); font-size: 14px; }
.loading-spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 48px 20px 60px; }
.empty-state .empty-icon { font-size: 56px; margin-bottom: 14px; opacity: .5; }
.empty-state .empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state .empty-desc { font-size: 13px; color: var(--text-s); margin-bottom: 20px; }
.empty-state .btn { display: inline-flex; }

/* ===== Utilities ===== */
.divider { height: 8px; background: var(--bg); margin: 0 -16px; }
.section-title { font-size: 13px; color: var(--text-s); padding: 14px 0 8px; }
.empty-tip { text-align: center; padding: 60px 20px; color: var(--text-s); font-size: 14px; }
.empty-tip .empty-icon { font-size: 48px; margin-bottom: 12px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.flex { display: flex; } .flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.text-primary { color: var(--primary); } .text-s { color: var(--text-s); } .text-sm { font-size: 13px; }
.fw-600 { font-weight: 600; }
.word-break { word-break: break-all; }
.overflow-hidden { overflow: hidden; }

/* ===== Responsive Breakpoints ===== */

/* Tablet: 481px - 768px */
@media (min-width: 481px) {
  .container { padding: 0 24px; }
  .page-content { padding: 20px 0 90px; }
  .login-logo { padding: 60px 40px 36px; }
  .admin-content { padding: 28px; }
  .admin-stat-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .stat-num { font-size: 28px; }
  .divider { margin: 0 -24px; }
}

/* PC: > 768px — mobile pages centered */
@media (min-width: 769px) {
  /* Admin: sidebar always visible, main content constrained */
  .admin-sidebar {
    transform: translateX(0) !important;
    position: static;
    width: 220px;
    flex-shrink: 0;
  }
  .admin-overlay { display: none !important; }
  .admin-content { padding: 32px; max-width: 1100px; }

  /* Mobile pages: center on PC, max-width 480px */
  .page { align-items: center; }
  .page-content { padding: 24px 0 100px; width: 100%; max-width: 480px; }
  .tab-bar { max-width: 480px; left: 50%; transform: translateX(-50%); }

  /* Top nav on centered pages */
  .top-nav { max-width: 480px; left: 50%; transform: translateX(-50%); width: 100%; }
}

/* Very small screens < 360px */
@media (max-width: 360px) {
  .top-nav { padding: 0 12px; }
  .top-nav .nav-title { font-size: 15px; }
  .menu-icon { width: 36px; height: 36px; font-size: 18px; }
  .order-thumb { width: 60px; height: 60px; }
  .user-avatar { width: 52px; height: 52px; font-size: 24px; }
  .admin-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-num { font-size: 20px; }
}
