/* ===== yijimall 主样式表 ===== */
/* 设计原则：轻量级、无外部依赖、响应式 */

* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #4a6cf7; --primary-dark: #3a5ce5;
  --success: #28a745; --warning: #ffc107; --danger: #dc3545;
  --info: #17a2b8; --secondary: #6c757d;
  --bg: #f5f7fa; --card: #fff; --border: #e2e8f0;
  --text: #2d3748; --text-light: #718096;
  --radius: 8px; --shadow: 0 2px 8px rgba(0,0,0,0.08);
}
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--card); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; height: 60px; gap: 24px; }
.logo { font-size: 22px; font-weight: 700; color: var(--primary); text-decoration: none; }
.main-nav { display: flex; gap: 20px; }
.main-nav a { color: var(--text); font-size: 14px; }
.main-nav a.active, .main-nav a:hover { color: var(--primary); text-decoration: none; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.header-actions a { color: var(--text); font-size: 14px; }
.header-actions a.active { color: var(--primary); }
.cart-link { position: relative; }
.badge { background: var(--danger); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 10px; position: absolute; top: -8px; right: -16px; }
.admin-link { color: var(--primary) !important; font-weight: 500; }
.main-content { min-height: calc(100vh - 120px); padding: 24px 16px; }

/* Footer */
.site-footer { background: var(--card); border-top: 1px solid var(--border); padding: 20px 0; text-align: center; color: var(--text-light); font-size: 13px; }

/* Buttons */
.btn { display: inline-block; padding: 8px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); color: var(--text); font-size: 14px; cursor: pointer; transition: all .2s; text-decoration: none; }
.btn:hover { text-decoration: none; opacity: .85; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-warning { background: var(--warning); color: #333; border-color: var(--warning); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; text-align: center; margin-bottom: 8px; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 14px; padding: 0; }

/* Alert */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-success { background: #d4edda; color: #155724; }
.alert-error { background: #f8d7da; color: #721c24; }

/* Toast 提示 */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #d4edda; color: #155724; padding: 10px 24px; border-radius: var(--radius); font-size: 14px; z-index: 9999; box-shadow: 0 2px 8px rgba(0,0,0,.15); opacity: 0; transition: opacity .3s; pointer-events: none; }
.toast.show { opacity: 1; }

/* Home */
.home-hero { text-align: center; padding: 60px 20px; background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border-radius: var(--radius); margin-bottom: 32px; }
.home-hero h1 { font-size: 36px; margin-bottom: 12px; }
.home-hero p { font-size: 16px; opacity: .9; margin-bottom: 24px; }
.home-hero .btn { background: #fff; color: #667eea; border: none; }
.home-section { margin-bottom: 40px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-header h2 { font-size: 22px; }
.more-link { font-size: 14px; }

/* Product Grid */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.product-card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .2s; text-decoration: none; color: var(--text); }
.product-card:hover { transform: translateY(-4px); text-decoration: none; }
.product-img { position: relative; width: 100%; height: 200px; overflow: hidden; background: #f0f0f0; }
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.img-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 48px; background: #f0f0f0; }
.img-placeholder.small { width: 48px; height: 48px; font-size: 24px; border-radius: 4px; flex-shrink: 0; }
.img-placeholder.large { width: 100%; height: 100%; font-size: 80px; }
.tag { position: absolute; top: 8px; right: 8px; padding: 3px 8px; border-radius: 4px; font-size: 11px; color: #fff; }
.tag-physical { background: var(--info); }
.tag-virtual { background: var(--primary); }
.product-info { padding: 12px; }
.product-name { font-size: 14px; font-weight: 500; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-price { color: var(--danger); font-size: 18px; font-weight: 600; }

/* Auth */
.auth-page { display: flex; justify-content: center; padding: 40px 0; }
.auth-card { background: var(--card); padding: 32px; border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 400px; }
.auth-card h1 { text-align: center; margin-bottom: 24px; }
.auth-form .form-group { margin-bottom: 16px; }
.auth-form label { display: block; margin-bottom: 6px; font-size: 14px; }
.auth-form input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px;
}
.form-group textarea { resize: vertical; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 12px; margin-top: 16px; }
.full-width { width: 100% !important; }
.checkbox-label { display: flex; align-items: center; gap: 8px; }
.checkbox-label input { width: auto; }

/* Product List */
.product-list-page { display: flex; gap: 24px; }
.sidebar { width: 200px; flex-shrink: 0; }
.filter-group { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.filter-group h3 { font-size: 14px; margin-bottom: 12px; }
.filter-list { list-style: none; }
.filter-list li { margin-bottom: 8px; }
.filter-list a { color: var(--text); font-size: 14px; }
.filter-list a.active { color: var(--primary); font-weight: 500; }
.product-list-main { flex: 1; }
.list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.search-box { display: flex; gap: 8px; }
.search-input { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); width: 200px; }

/* Product Detail */
.product-detail-page { max-width: 1000px; margin: 0 auto; }
.detail-main { display: flex; gap: 32px; background: var(--card); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 32px; }
.detail-image { width: 400px; flex-shrink: 0; position: relative; }
.detail-image img { width: 100%; border-radius: var(--radius); }
.detail-info { flex: 1; }
.detail-info h1 { font-size: 24px; margin-bottom: 12px; }
.detail-meta { display: flex; gap: 20px; margin-bottom: 16px; font-size: 13px; color: var(--text-light); }
.detail-price { margin-bottom: 24px; }
.detail-specs { margin-bottom: 24px; }
.detail-specs h3 { font-size: 15px; margin-bottom: 10px; }
.spec-options { display: flex; flex-wrap: wrap; gap: 8px; }
.spec-btn { padding: 6px 16px; border: 1px solid #ddd; border-radius: var(--radius); background: #fff; cursor: pointer; font-size: 14px; transition: all .2s; }
.spec-btn:hover { border-color: var(--primary); }
.spec-btn.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.price-current { font-size: 32px; color: var(--danger); font-weight: 700; }
.price-original { font-size: 16px; color: var(--text-light); text-decoration: line-through; margin-left: 12px; }
.detail-desc { margin-bottom: 24px; }
.detail-desc h3 { font-size: 16px; margin-bottom: 8px; }
.desc-content { color: var(--text-light); font-size: 14px; line-height: 1.8; }
.detail-actions { display: flex; align-items: center; gap: 12px; }
.quantity-selector { display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius); }
.quantity-selector button { width: 36px; height: 36px; border: none; background: none; cursor: pointer; font-size: 16px; }
.quantity-selector input { width: 48px; text-align: center; border: none; }
.related-products h2 { margin-bottom: 16px; }

/* Cart */
.cart-page h1 { margin-bottom: 24px; }
.cart-table { width: 100%; background: var(--card); border-radius: var(--radius); overflow: hidden; border-collapse: collapse; }
.cart-table th { background: #f8f9fa; padding: 12px; text-align: left; font-size: 13px; }
.cart-table td { padding: 12px; border-top: 1px solid var(--border); }
.cart-table tr.disabled { opacity: .5; }
.cart-product { display: flex; align-items: center; gap: 12px; }
.cart-product img { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control button { width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 4px; background: var(--card); cursor: pointer; }
.shipping-info { background: var(--card); padding: 16px; border-radius: var(--radius); margin: 16px 0; }
.shipping-info h3 { margin-bottom: 12px; }
.cart-footer { display: flex; justify-content: space-between; align-items: center; padding: 16px; background: var(--card); border-radius: var(--radius); margin-top: 16px; }
.total-price { font-size: 24px; color: var(--danger); font-weight: 700; }

/* Orders */
.order-list-page h1, .order-detail-page h1 { margin-bottom: 24px; }
.order-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.order-tabs a { padding: 6px 16px; border-radius: 20px; background: var(--card); font-size: 14px; color: var(--text); }
.order-tabs a.active { background: var(--primary); color: #fff; }
.order-list { display: flex; flex-direction: column; gap: 16px; }
.order-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.order-card-header { display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: #f8f9fa; font-size: 14px; }
.order-no { font-weight: 500; }
.order-date { margin-left: auto; color: var(--text-light); font-size: 12px; }
.order-card-body { padding: 12px 16px; }
.order-item { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.order-item img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }
.item-info { display: flex; flex-direction: column; }
.item-name { font-size: 14px; }
.item-qty { font-size: 12px; color: var(--text-light); }
.order-card-footer { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); }
.order-total { margin-right: auto; }
.order-status { padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.status-warning { background: #fff3cd; color: #856404; }
.status-info { background: #d1ecf1; color: #0c5460; }
.status-primary { background: #d7e4ff; color: #2b59ff; }
.status-success { background: #d4edda; color: #155724; }
.status-secondary { background: #e2e3e5; color: #383d41; }
.status-danger { background: #f8d7da; color: #721c24; }

/* Order Detail */
.order-detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.order-section { background: var(--card); padding: 16px; border-radius: var(--radius); margin-bottom: 16px; }
.order-section h3 { margin-bottom: 12px; font-size: 16px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.info-grid label { color: var(--text-light); font-size: 13px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f8f9fa; padding: 10px; text-align: left; font-size: 13px; }
.data-table td { padding: 10px; border-top: 1px solid var(--border); font-size: 14px; }
.data-table.compact th, .data-table.compact td { padding: 6px 8px; font-size: 12px; }
.data-table tfoot td { border-top: 2px solid var(--border); }
.order-actions { display: flex; gap: 12px; margin-top: 16px; }

/* Delivery */
.delivery-card { background: #f8f9fa; padding: 12px; border-radius: var(--radius); margin-bottom: 12px; }
.delivery-card h4 { margin-bottom: 8px; }
.activation-codes { display: flex; flex-direction: column; gap: 6px; }
.activation-code { background: #1e1e1e; color: #0f0; padding: 6px 12px; border-radius: 4px; font-family: monospace; font-size: 13px; word-break: break-all; }
.text-content { background: #f8f9fa; padding: 12px; border-radius: 4px; white-space: pre-wrap; font-size: 13px; }

/* Payment */
.payment-page { display: flex; justify-content: center; padding: 40px 0; }
.payment-card { background: var(--card); padding: 32px; border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 400px; text-align: center; }
.payment-notice { color: var(--warning); margin: 16px 0; }
.payment-order-info { text-align: left; margin: 24px 0; }
.payment-order-info div { display: flex; justify-content: space-between; margin-bottom: 8px; }
.payment-order-info .amount { font-size: 24px; color: var(--danger); font-weight: 700; }

/* Pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 24px; }
.page-btn { padding: 6px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.page-info { font-size: 14px; }

/* Empty / Error */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-state .btn { margin-top: 16px; }
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 28px; margin-bottom: 12px; }
.error-page p { color: var(--text-light); margin-bottom: 24px; }

/* Responsive */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 12px 0; }
  .main-nav { width: 100%; justify-content: center; }
  .product-list-page { flex-direction: column; }
  .sidebar { width: 100%; }
  .detail-main { flex-direction: column; }
  .detail-image { width: 100%; }
  .form-row { flex-direction: column; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
