/* ===== Global Header ===== */
.global-header {
  position: fixed; top: 0; left: 0; right: 0; height: 64px; z-index: 1000;
  background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  display: flex; align-items: center;
}
.global-header .container { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.global-header .logo { font-size: 20px; font-weight: 700; color: var(--brand-primary); display: flex; align-items: center; gap: var(--space-sm); white-space: nowrap; }
.global-header .logo svg { width: 28px; height: 28px; }
.global-header .nav-list { display: flex; align-items: center; gap: var(--space-xl); }
.global-header .nav-item { font-size: var(--text-body); color: var(--gray-500); padding: 4px 0; border-bottom: 3px solid transparent; transition: color 0.2s, border-color 0.2s; }
.global-header .nav-item:hover { color: var(--trade-primary); }
.global-header .nav-item.active { color: var(--trade-primary); font-weight: 600; border-bottom-color: var(--trade-primary); }
.global-header .header-actions { display: flex; align-items: center; gap: var(--space-md); }
.global-header .btn-login { padding: 6px 20px; border: 1px solid var(--brand-primary); border-radius: var(--radius-md); color: var(--brand-primary); font-size: var(--text-body); background: #fff; transition: all 0.2s; }
.global-header .btn-login:hover { background: var(--brand-primary); color: #fff; }

/* ===== Sub Navigation ===== */
.sub-nav { position: fixed; top: 64px; left: 0; right: 0; height: 48px; z-index: 999; background: var(--trade-bg); border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; }
.sub-nav .container { display: flex; align-items: center; gap: 32px; }
.sub-nav a { font-size: var(--text-body); color: var(--gray-500); transition: color 0.2s; white-space: nowrap; }
.sub-nav a:hover { color: var(--trade-primary); }
.sub-nav a.active { color: var(--trade-primary); font-weight: 600; border-bottom: 3px solid var(--trade-primary); padding-bottom: 11px; margin-bottom: -12px; }
.sub-nav .freight-link { margin-left: auto; color: var(--trade-primary); font-size: var(--text-body-sm); }

/* ===== Search Bar ===== */
.search-bar { padding: var(--space-lg) 0; }
.search-bar-wrapper { position: relative; max-width: 1200px; margin: 0 auto; }
.search-bar-inner { display: flex; }
.search-bar .category-select { width: 140px; height: 48px; border: 1px solid var(--gray-200); border-right: none; border-radius: var(--radius-md) 0 0 var(--radius-md); padding: 0 12px; font-size: var(--text-body); color: var(--gray-700); background: #fff; outline: none; cursor: pointer; }
.search-bar .search-input { flex: 1; height: 48px; border: 1px solid var(--gray-200); border-left: none; border-right: none; padding: 0 16px; font-size: var(--text-body-lg); outline: none; }
.search-bar .search-input:focus { border-color: var(--trade-primary); }
.search-bar .search-btn { width: 100px; height: 48px; background: var(--trade-primary); color: #fff; border: none; border-radius: 0 var(--radius-md) var(--radius-md) 0; font-size: var(--text-body); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 4px; transition: background 0.2s; }
.search-bar .search-btn:hover { background: var(--trade-primary-hover); }

/* ===== Search Suggestions ===== */
.search-suggestions { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--gray-200); border-radius: 0 0 var(--radius-md) var(--radius-md); box-shadow: var(--shadow-md); z-index: 100; display: none; max-height: 320px; overflow-y: auto; margin-top: 2px; }
.search-suggestions.active { display: block; }
.search-suggestion-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; cursor: pointer; font-size: var(--text-body); color: var(--gray-700); transition: background 0.15s; }
.search-suggestion-item:hover, .search-suggestion-item.highlighted { background: var(--trade-primary-light); }
.search-suggestion-item .suggest-name { flex: 1; }
.search-suggestion-item .suggest-price { color: var(--trade-cta); font-weight: 600; font-size: var(--text-body-sm); }
.search-suggestion-item .suggest-cat { color: var(--gray-400); font-size: var(--text-caption); margin-left: 8px; }

/* ===== Category Tree ===== */
.category-tree { width: 240px; flex-shrink: 0; background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100); overflow: hidden; position: sticky; top: 112px; }
.cat-group-title { display: flex; align-items: center; gap: var(--space-sm); height: 40px; padding: 0 var(--space-md); font-size: var(--text-body); font-weight: 600; color: var(--gray-900); cursor: pointer; transition: background 0.2s; border-bottom: 1px solid var(--gray-100); }
.cat-group-title:hover { background: var(--trade-primary-light); color: var(--trade-primary); }
.cat-group-title.expanded { background: var(--trade-primary-light); color: var(--trade-primary); }
.cat-group-title .arrow { margin-left: auto; font-size: 12px; transition: transform 0.3s; }
.cat-group-title.expanded .arrow { transform: rotate(180deg); }
.cat-sub-list { overflow: hidden; transition: max-height 0.3s ease-out; }
.cat-sub-item { display: block; padding: 0 var(--space-md) 0 36px; height: 36px; line-height: 36px; font-size: var(--text-body-sm); color: var(--gray-700); transition: all 0.2s; border-left: 3px solid transparent; cursor: pointer; }
.cat-sub-item:hover, .cat-sub-item.active { color: var(--trade-primary); background: var(--trade-primary-light); border-left-color: var(--trade-primary); }
/* Category group hover expansion */
.cat-group:hover > .cat-sub-list { max-height: 999px !important; }
.cat-group:hover .cat-group-title .arrow { transform: rotate(180deg); }

/* ===== Cards ===== */
.card { background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); transition: all 0.3s ease-out; }
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* Product Card */
.product-card { background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); overflow: hidden; transition: all 0.3s; cursor: pointer; position: relative; }
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }
.product-card .product-img { width: 100%; aspect-ratio: 1; background: var(--gray-100); display: flex; align-items: center; justify-content: center; color: var(--gray-400); font-size: 48px; }
.product-card .product-body { padding: 12px 16px; padding-bottom: 44px; }
.product-card .product-name { font-size: var(--text-body); font-weight: 500; color: var(--gray-900); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 4px; }
.product-card .product-price { font-size: var(--price-md); font-weight: 700; color: var(--trade-cta); margin-bottom: 4px; }
.product-card .product-price .unit { font-size: var(--text-caption); font-weight: 400; color: var(--gray-500); }
.product-card .product-supplier { font-size: var(--text-caption); color: var(--gray-500); margin-bottom: 2px; }
.product-card .product-volume { font-size: var(--text-caption); color: var(--gray-400); }

/* Product Card Actions (add to cart) */
.product-card .product-actions { position: absolute; bottom: 0; left: 0; right: 0; padding: 8px 16px; background: linear-gradient(transparent, rgba(255,255,255,0.95) 30%, #fff); display: flex; gap: 8px; opacity: 0; transform: translateY(8px); transition: all 0.25s ease-out; }
.product-card:hover .product-actions { opacity: 1; transform: translateY(0); }
.product-card .btn-add-cart { flex: 1; height: 32px; border: 1px solid var(--trade-cta); background: var(--trade-cta); color: #fff; border-radius: var(--radius-sm); font-size: var(--text-caption); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px; transition: all 0.2s; }
.product-card .btn-add-cart:hover { background: var(--trade-cta-hover); }
.product-card .btn-add-cart.added { background: var(--color-success); border-color: var(--color-success); }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 20px; border-radius: var(--radius-md); font-size: var(--text-body); font-weight: 500; border: none; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--trade-primary); color: #fff; }
.btn-primary:hover { background: var(--trade-primary-hover); }
.btn-cta { background: var(--trade-cta); color: #fff; height: 44px; }
.btn-cta:hover { background: var(--trade-cta-hover); }
.btn-outline { background: #fff; color: var(--trade-primary); border: 1px solid var(--trade-primary); }
.btn-outline:hover { background: var(--trade-primary-light); }
.btn-sm { height: 32px; padding: 0 12px; font-size: var(--text-body-sm); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-ghost { background: transparent; color: var(--gray-500); }
.btn-ghost:hover { color: var(--trade-primary); background: var(--trade-primary-light); }

/* ===== Badges ===== */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: var(--text-caption); font-weight: 500; }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-info { background: var(--color-info-bg); color: var(--color-info); }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }

/* ===== Pagination ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: var(--space-sm); padding: var(--space-lg) 0; }
.pagination .page-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); font-size: var(--text-body); color: var(--gray-700); background: #fff; cursor: pointer; transition: all 0.2s; }
.pagination .page-btn:hover { border-color: var(--trade-primary); color: var(--trade-primary); }
.pagination .page-btn.active { background: var(--trade-primary); color: #fff; border-color: var(--trade-primary); }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--gray-200); margin-bottom: var(--space-lg); }
.tab-item { padding: 10px 20px; font-size: var(--text-body); color: var(--gray-500); cursor: pointer; border-bottom: 3px solid transparent; transition: all 0.2s; }
.tab-item:hover { color: var(--gray-700); }
.tab-item.active { color: var(--trade-primary); font-weight: 600; border-bottom-color: var(--trade-primary); }

/* ===== Tables ===== */
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.data-table th { background: var(--gray-50); height: 44px; padding: 0 var(--space-md); text-align: left; font-weight: 600; font-size: var(--text-body-sm); color: var(--gray-700); border-bottom: 1px solid var(--gray-200); }
.data-table td { height: 48px; padding: 0 var(--space-md); font-size: var(--text-body); border-bottom: 1px solid var(--gray-100); }
.data-table tr:hover td { background: var(--trade-primary-light); }

/* ===== Filter Bar ===== */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md); padding: var(--space-md) 0; }
.filter-tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; background: var(--trade-primary-light); color: var(--trade-primary); border-radius: 999px; font-size: var(--text-body-sm); cursor: pointer; }
.filter-tag .remove { cursor: pointer; font-weight: 700; margin-left: 2px; }

/* ===== Toast ===== */
.toast { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); z-index: 1300; padding: 12px 24px; background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); font-size: var(--text-body); display: flex; align-items: center; gap: var(--space-sm); animation: toastIn 0.3s ease-out; }
.toast-success { border-left: 4px solid var(--color-success); }
.toast-error { border-left: 4px solid var(--color-danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ===== Skeleton ===== */
.skeleton { background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== Breadcrumb ===== */
.breadcrumb { display: flex; align-items: center; gap: var(--space-sm); font-size: var(--text-body-sm); color: var(--gray-400); padding: var(--space-sm) 0; }
.breadcrumb a { color: var(--gray-500); }
.breadcrumb a:hover { color: var(--trade-primary); }
.breadcrumb .sep { color: var(--gray-300); }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1100; display: none; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 440px; max-width: 90vw; max-height: 80vh; overflow-y: auto; animation: modalIn 0.2s ease-out; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-header { padding: var(--space-lg); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--gray-200); }
.modal-header h3 { font-size: var(--text-h3); color: var(--gray-900); }
.modal-close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; font-size: 20px; color: var(--gray-400); cursor: pointer; border-radius: var(--radius-sm); }
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal-body { padding: var(--space-lg); }
.modal-footer { padding: var(--space-md) var(--space-lg); display: flex; justify-content: flex-end; gap: var(--space-sm); border-top: 1px solid var(--gray-100); }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.empty-state svg { width: 64px; height: 64px; margin-bottom: var(--space-md); }
.empty-state p { font-size: var(--text-body); color: var(--gray-500); margin-bottom: var(--space-md); }

/* ===== Global Footer ===== */
.global-footer { background: var(--brand-secondary); color: #93C5FD; margin-top: var(--space-3xl); padding: var(--space-2xl) 0 var(--space-lg); }
.global-footer .footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-xl); }
.global-footer h4 { color: #fff; font-size: var(--text-h4); margin-bottom: var(--space-md); }
.global-footer a { display: block; font-size: var(--text-body-sm); color: #93C5FD; padding: 3px 0; transition: color 0.2s; }
.global-footer a:hover { color: #fff; }
.global-footer .footer-bottom { text-align: center; padding-top: var(--space-xl); margin-top: var(--space-xl); border-top: 1px solid rgba(255,255,255,0.1); font-size: var(--text-caption); }

/* ===== Step Indicator ===== */
.step-indicator { display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: var(--space-lg); }
.step-dot { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: var(--text-body); font-weight: 600; background: var(--gray-200); color: var(--gray-500); transition: all 0.3s; }
.step-dot.completed { background: var(--color-success); color: #fff; }
.step-dot.active { background: var(--trade-primary); color: #fff; }
.step-line { width: 60px; height: 2px; background: var(--gray-200); }
.step-line.completed { background: var(--color-success); }
.step-line.active { background: var(--trade-primary); }

/* ===== Chart Bar ===== */
.chart-bar-container { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding: 0 8px; }
.chart-bar { flex: 1; background: var(--trade-primary); border-radius: 4px 4px 0 0; transition: height 0.6s ease-out; position: relative; min-height: 4px; }
.chart-bar:hover { background: var(--trade-primary-hover); }
.chart-bar-label { text-align: center; font-size: var(--text-caption); color: var(--gray-500); padding-top: 4px; }

/* ===== Tooltip ===== */
.tooltip-target { position: relative; cursor: help; }
.tooltip-target .tooltip-text { visibility: hidden; opacity: 0; position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--gray-900); color: #fff; padding: 6px 12px; border-radius: 4px; font-size: 12px; white-space: nowrap; z-index: 100; transition: opacity 0.2s; pointer-events: none; }
.tooltip-target:hover .tooltip-text { visibility: visible; opacity: 1; }

/* ===== Progress Bar ===== */
.progress-bar-track { width: 100%; height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; background: var(--trade-primary); transition: width 0.8s ease-out; }

/* ===== Logistics Timeline ===== */
.logistics-timeline { position: relative; padding-left: 24px; }
.logistics-timeline::before { content: ''; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--gray-200); }
.logistics-node { position: relative; padding-bottom: 20px; }
.logistics-node:last-child { padding-bottom: 0; }
.logistics-node::before { content: ''; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--gray-300); z-index: 1; }
.logistics-node.completed::before { background: var(--color-success); }
.logistics-node.active::before { background: var(--trade-primary); box-shadow: 0 0 0 4px var(--trade-primary-light); }
.logistics-node .node-time { font-size: var(--text-caption); color: var(--gray-400); }
.logistics-node .node-text { font-size: var(--text-body); color: var(--gray-700); }

/* ===== Image Lightbox ===== */
.lightbox-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 1200; display: none; align-items: center; justify-content: center; }
.lightbox-overlay.active { display: flex; }
.lightbox-overlay img { max-width: 90vw; max-height: 90vh; object-fit: contain; }
.lightbox-close { position: absolute; top: 20px; right: 30px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.15); border: none; color: #fff; font-size: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .global-header .nav-list { gap: var(--space-md); }
  .global-header .nav-item { font-size: 13px; }
  .sub-nav .container { gap: 20px; }
  .sub-nav a { font-size: 13px; }
  .category-tree { display: none; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
  .global-header .nav-list { display: none; }
  .global-header .logo { font-size: 16px; }
  .sub-nav { overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none; }
  .sub-nav::-webkit-scrollbar { display: none; }
  .sub-nav .container { gap: 20px; padding: 0 var(--space-md); width: max-content; }
  .sub-nav a.active { padding-bottom: 4px; margin-bottom: 0; border-bottom-width: 2px; }
  .sub-nav .freight-link { margin-left: 20px; }
  .search-bar-wrapper { max-width: 100%; }
  .search-bar-inner { flex-wrap: wrap; }
  .search-bar .category-select { display: none; }
  .search-bar .search-input { border-left: 1px solid var(--gray-200); border-radius: var(--radius-md) 0 0 var(--radius-md); }
  .page-wrapper { padding-top: 96px; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* === 移动端汉堡菜单 & 登录态 === */
.header-user { display: flex; align-items: center; gap: var(--space-sm); cursor: pointer; position: relative; padding: 4px 8px; border-radius: var(--radius-md); transition: background 0.2s; }
.header-user:hover { background: var(--gray-50); }
.header-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-primary-light); color: var(--brand-primary); display: flex; align-items: center; justify-content: center; }
.header-user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-body-sm); color: var(--gray-700); }
.header-user-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 160px; background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 6px; display: none; z-index: 100; }
.header-user-menu.open { display: block; }
.header-user-menu a { display: block; padding: 9px 12px; font-size: var(--text-body); color: var(--gray-700); border-radius: var(--radius-sm); transition: all 0.15s; }
.header-user-menu a:hover { background: var(--brand-primary-light); color: var(--brand-primary); }
.hamburger-btn { width: 40px; height: 40px; display: none; align-items: center; justify-content: center; border: none; background: transparent; color: var(--gray-700); border-radius: var(--radius-sm); transition: background 0.2s; }
.hamburger-btn:hover { background: var(--gray-100); }
.mobile-drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1050; display: none; }
.mobile-drawer-overlay.open { display: block; }
.mobile-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 300px; max-width: 85vw; background: #fff; z-index: 1060; transform: translateX(100%); transition: transform 0.3s ease-out; display: flex; flex-direction: column; }
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-md) var(--space-lg); border-bottom: 1px solid var(--gray-100); }
.mobile-drawer-header .logo { font-size: 16px; }
.mobile-drawer-close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--gray-500); border-radius: var(--radius-sm); }
.mobile-drawer-close:hover { background: var(--gray-100); }
.mobile-drawer-nav { padding: var(--space-md) 0; overflow-y: auto; flex: 1; }
.mobile-drawer-nav a { display: flex; align-items: center; gap: var(--space-md); padding: 12px var(--space-lg); font-size: var(--text-body-lg); color: var(--gray-700); transition: background 0.2s; }
.mobile-drawer-nav a:hover { background: var(--gray-50); }
.mobile-drawer-nav a.active { color: var(--brand-primary); font-weight: 600; background: var(--brand-primary-light); }
.mobile-drawer-nav a.active::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-primary); flex-shrink: 0; }
.mobile-drawer-login { padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--gray-100); }
.mobile-drawer-login .btn-login { width: 100%; height: 44px; }

