/* ============================================================
   纽缦供应链云 - 全局样式
   ============================================================ */

/* ---- 重置 ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ---- 变量 ---- */
:root {
  --primary: #1677ff;
  --primary-dark: #0958d9;
  --primary-light: #e6f4ff;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;
  --text-1: #1f1f1f;
  --text-2: #595959;
  --text-3: #8c8c8c;
  --bg-1: #fff;
  --bg-2: #f5f7fa;
  --border: #e8e8e8;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ---- 容器 ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---- 顶部条 ---- */
.top-bar {
  background: #f0f2f5;
  border-bottom: 1px solid #e8e8e8;
  font-size: 12px;
  color: var(--text-3);
  padding: 6px 0;
}
.top-bar .container { display: flex; justify-content: space-between; align-items: center; }
.top-bar a { margin-left: 12px; }
.top-bar a:hover { color: var(--primary); }

/* ---- 头部 ---- */
.header { background: #fff; padding: 16px 0; border-bottom: 2px solid var(--primary); }
.header .container { display: flex; align-items: center; gap: 40px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.logo .icon { width: 36px; height: 36px; background: var(--primary); color: #fff; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.search-box { flex: 1; max-width: 500px; display: flex; }
.search-box input { flex: 1; height: 38px; border: 2px solid var(--primary); border-right: none; border-radius: 4px 0 0 4px; padding: 0 12px; outline: none; }
.search-box button { background: var(--primary); color: #fff; padding: 0 20px; border-radius: 0 4px 4px 0; font-size: 14px; }
.search-box button:hover { background: var(--primary-dark); }
.header-right { display: flex; align-items: center; gap: 20px; }
.cart-icon { position: relative; font-size: 14px; }
.cart-icon .badge { position: absolute; top: -8px; right: -10px; background: var(--danger); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.user-info { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.user-info .name { font-weight: 600; }

/* ---- 导航栏 ---- */
.nav { background: #fff; border-bottom: 1px solid var(--border); }
.nav .container { display: flex; align-items: center; }
.nav-cats { display: flex; }
.nav-cats a { display: block; padding: 12px 20px; font-size: 14px; color: var(--text-1); position: relative; }
.nav-cats a:hover, .nav-cats a.active { color: var(--primary); }
.nav-cats a.active::after { content: ''; position: absolute; bottom: 0; left: 20px; right: 20px; height: 2px; background: var(--primary); }

/* ---- 轮播图 ---- */
.hero { background: linear-gradient(135deg, #1677ff, #4096ff); color: #fff; padding: 60px 0; text-align: center; }
.hero h1 { font-size: 36px; margin-bottom: 12px; }
.hero p { font-size: 16px; opacity: 0.9; margin-bottom: 24px; }
.hero .btn-large { display: inline-block; padding: 12px 36px; background: #fff; color: var(--primary); border-radius: 6px; font-size: 16px; font-weight: 600; }
.hero .btn-large:hover { background: var(--primary-light); }

/* ---- 分类区 ---- */
.section { padding: 32px 0; }
.section-title { font-size: 22px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ''; width: 4px; height: 20px; background: var(--primary); border-radius: 2px; }
.section-title .more { margin-left: auto; font-size: 14px; font-weight: 400; color: var(--text-3); }

/* ---- 分类网格 ---- */
.category-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.category-card { background: #fff; border-radius: var(--radius); padding: 20px 12px; text-align: center; box-shadow: var(--shadow); transition: all 0.3s; cursor: pointer; }
.category-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-color: var(--primary); }
.category-card .cat-icon { font-size: 28px; margin-bottom: 8px; }
.category-card .cat-name { font-size: 13px; color: var(--text-2); }

/* ---- 商品网格 ---- */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.product-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: all 0.3s; cursor: pointer; border: 1px solid transparent; }
.product-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); border-color: var(--primary); }
.product-card .img-box { width: 100%; aspect-ratio: 3/2; background: #f5f5f5; overflow: hidden; }
.product-card .img-box img { width: 100%; height: 100%; object-fit: cover; }
.product-card .info { padding: 12px; }
.product-card .name { font-size: 14px; line-height: 1.4; height: 40px; overflow: hidden; color: var(--text-1); margin-bottom: 8px; }
.product-card .brand { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.product-card .price-row { display: flex; align-items: baseline; gap: 8px; }
.product-card .price { font-size: 18px; font-weight: 700; color: var(--danger); }
.product-card .market-price { font-size: 12px; color: var(--text-3); text-decoration: line-through; }
.product-card .meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.product-card .badge-tag { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 3px; margin-right: 4px; }
.badge-tag.hot { background: #fff1f0; color: #cf1322; }
.badge-tag.new { background: #e6f4ff; color: #0958d9; }

/* ---- 品牌区 ---- */
.brand-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.brand-card { background: #fff; border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow); transition: all 0.3s; cursor: pointer; }
.brand-card:hover { border: 1px solid var(--primary); }
.brand-card .b-name { font-size: 14px; font-weight: 600; }

/* ---- 页脚 ---- */
.footer { background: #1f1f1f; color: #8c8c8c; padding: 40px 0 20px; margin-top: 40px; }
.footer .container { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; }
.footer h4 { color: #fff; font-size: 15px; margin-bottom: 12px; }
.footer a { display: block; color: #8c8c8c; font-size: 13px; line-height: 2; }
.footer a:hover { color: #fff; }
.footer .copyright { text-align: center; border-top: 1px solid #333; padding-top: 16px; margin-top: 20px; font-size: 12px; }

/* ---- 按钮 ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 8px 16px; border-radius: 6px; font-size: 14px; transition: all 0.3s; border: 1px solid transparent; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border-color: var(--primary); color: var(--primary); background: #fff; }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-default { border-color: var(--border); color: var(--text-2); background: #fff; }
.btn-default:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 12px 32px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- 表单 ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 6px; outline: none; transition: border-color 0.3s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary); }
.form-group textarea { height: auto; padding: 8px 12px; resize: vertical; }

/* ---- 页面布局 ---- */
.page-wrap { min-height: calc(100vh - 300px); }
.breadcrumb { padding: 12px 0; font-size: 13px; color: var(--text-3); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { margin: 0 8px; }

/* ---- 商品列表页 ---- */
.products-page { display: flex; gap: 20px; }
.filter-sidebar { width: 200px; flex-shrink: 0; }
.filter-sidebar .card { background: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.filter-sidebar h4 { font-size: 14px; margin-bottom: 8px; }
.filter-sidebar .cat-list a { display: block; padding: 6px 8px; font-size: 13px; border-radius: 4px; color: var(--text-2); }
.filter-sidebar .cat-list a:hover, .filter-sidebar .cat-list a.active { background: var(--primary-light); color: var(--primary); }
.products-main { flex: 1; }
.products-toolbar { background: #fff; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow); }
.products-toolbar .sort a { margin-right: 16px; font-size: 13px; color: var(--text-2); }
.products-toolbar .sort a.active { color: var(--primary); font-weight: 600; }
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 24px; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.pagination a:hover { border-color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- 商品详情 ---- */
.detail-page { display: flex; gap: 24px; }
.detail-img { width: 480px; flex-shrink: 0; }
.detail-img img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.detail-info { flex: 1; }
.detail-info h1 { font-size: 20px; margin-bottom: 8px; }
.detail-info .brand-line { font-size: 13px; color: var(--text-3); margin-bottom: 12px; }
.price-box { background: #f5f7fa; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px; }
.price-box .label { font-size: 12px; color: var(--text-3); }
.price-box .price { font-size: 28px; font-weight: 700; color: var(--danger); }
.price-box .market-price { font-size: 14px; color: var(--text-3); text-decoration: line-through; margin-left: 12px; }
.spec-row { display: flex; gap: 12px; margin-bottom: 12px; font-size: 13px; }
.spec-row .label { color: var(--text-3); width: 60px; flex-shrink: 0; }
.qty-selector { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.qty-selector button { width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 4px; background: #fff; font-size: 16px; }
.qty-selector input { width: 60px; height: 32px; text-align: center; border: 1px solid var(--border); border-radius: 4px; }
.detail-actions { display: flex; gap: 12px; margin-top: 20px; }

/* ---- 购物车 ---- */
.cart-table { width: 100%; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cart-table th { background: #fafafa; padding: 12px 16px; text-align: left; font-size: 13px; color: var(--text-3); font-weight: normal; border-bottom: 1px solid var(--border); }
.cart-table td { padding: 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.cart-table .prod-info { display: flex; gap: 12px; align-items: center; }
.cart-table .prod-info img { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; }
.cart-summary { background: #fff; border-radius: var(--radius); padding: 20px; margin-top: 16px; box-shadow: var(--shadow); text-align: right; }
.cart-summary .total { font-size: 20px; font-weight: 700; color: var(--danger); }

/* ---- 询价/订单页 ----
.status-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.status-tabs a { padding: 8px 16px; border-radius: 6px; font-size: 13px; color: var(--text-2); background: #fff; }
.status-tabs a.active { background: var(--primary); color: #fff; } */
.data-table { width: 100%; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th { background: #fafafa; padding: 12px 16px; text-align: left; font-size: 13px; color: var(--text-3); font-weight: normal; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }

/* ---- 状态标签 ---- */
.status-tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.status-pending { background: #fff7e6; color: #d46b08; }
.status-confirmed { background: #e6f4ff; color: #0958d9; }
.status-shipping { background: #f6ffed; color: #389e0d; }
.status-delivered { background: #f0f5ff; color: #2f54eb; }
.status-cancelled { background: #fff1f0; color: #cf1322; }
.status-quoted { background: #f6ffed; color: #389e0d; }
.status-accepted { background: #e6f4ff; color: #0958d9; }
.status-rejected { background: #fff1f0; color: #cf1322; }

/* ---- 空状态 ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state a { color: var(--primary); }

/* ---- 管理后台 ---- */
.admin-layout { display: flex; gap: 0; min-height: calc(100vh - 60px); }
.admin-sidebar { width: 200px; background: #001529; color: rgba(255,255,255,0.65); flex-shrink: 0; }
.admin-sidebar .logo { padding: 16px 20px; color: #fff; font-size: 16px; }
.admin-sidebar .menu a { display: block; padding: 12px 20px; font-size: 13px; color: rgba(255,255,255,0.65); border-left: 3px solid transparent; }
.admin-sidebar .menu a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.admin-sidebar .menu a.active { background: var(--primary); color: #fff; }
.admin-main { flex: 1; padding: 24px; background: #f0f2f5; }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card .stat-val { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-3); margin-top: 4px; }

/* ---- Toast ---- */
.toast { position: fixed; top: 20px; right: 20px; z-index: 9999; padding: 12px 24px; border-radius: 8px; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); opacity: 0; transition: opacity 0.3s; }
.toast.show { opacity: 1; }
.toast.success { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.toast.error { background: #fff1f0; color: #cf1322; border: 1px solid #ffa39e; }

/* ---- 响应式 ---- */
@media (max-width: 768px) {
  .container { padding: 0 12px; }
  .header .container { flex-wrap: wrap; gap: 12px; }
  .search-box { order: 3; max-width: 100%; width: 100%; }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .brand-grid { grid-template-columns: repeat(3, 1fr); }
  .products-page { flex-direction: column; }
  .filter-sidebar { width: 100%; }
  .detail-page { flex-direction: column; }
  .detail-img { width: 100%; }
  .footer .container { grid-template-columns: 1fr 1fr; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}
