/* 跨境商品选品系统 - 前台样式 */

/* 基础重置 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f5f7fa; color: #333; line-height: 1.6; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

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

/* 顶部导航 */
.header { background: #e74c3c; box-shadow: 0 2px 8px rgba(0,0,0,0.08); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-img { height: 40px; max-width: 120px; width: auto; object-fit: contain; }
.logo-text { font-size: 20px; font-weight: 700; color: #fff; letter-spacing: 2px; white-space: nowrap; }
.header-right { display: flex; align-items: center; gap: 16px; }
.cart-link { position: relative; display: flex; align-items: center; padding: 8px 14px; border-radius: 10px; transition: all 0.2s; background: rgba(255,255,255,0.2); }
.cart-link:hover { background: rgba(255,255,255,0.3); }
.cart-badge { position: absolute; top: -6px; right: -6px; background: #fff; color: #e74c3c; font-size: 11px; min-width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; padding: 0 5px; box-shadow: 0 2px 6px rgba(0,0,0,0.2); border: 2px solid #e74c3c; }
.user-avatar { display: flex; align-items: center; padding: 8px 12px; background: rgba(255,255,255,0.2); border-radius: 10px; cursor: default; }
.icon { width: 22px; height: 22px; color: #fff; }

/* 主内容 */
.main { min-height: calc(100vh - 64px - 60px); padding: 30px 0; }

/* 页面标题 */
.page-title { font-size: 24px; font-weight: 600; color: #2c3e50; margin-bottom: 24px; }

/* 分类网格 */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.category-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.06); transition: transform 0.2s, box-shadow 0.2s; display: block; }
.category-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.category-card-img { width: 100%; height: 200px; overflow: hidden; background: #f0f2f5; display: flex; align-items: center; justify-content: center; }
.category-card-img img { width: 100%; height: 100%; object-fit: cover; }
.category-card-name { padding: 14px 16px; font-size: 15px; font-weight: 500; text-align: center; color: #2c3e50; }

/* 占位图 */
.placeholder-img { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; font-size: 48px; font-weight: 700; }
.placeholder-img.small { font-size: 24px; width: 100%; height: 100%; }
.placeholder-img.large { font-size: 80px; }

/* 公告栏 */
.notice-bar { background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%); border: 1px solid #ffc107; border-radius: 8px; padding: 12px 20px; margin-bottom: 24px; display: flex; align-items: center; gap: 10px; color: #856404; font-size: 14px; }
.notice-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* 面包屑 */
.breadcrumb { margin-bottom: 20px; font-size: 14px; color: #888; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.breadcrumb a { color: #666; transition: color 0.2s; }
.breadcrumb a:hover { color: #3498db; }
.breadcrumb .sep { color: #ccc; margin: 0 2px; }

/* 区块标题 */
.section-title { font-size: 18px; font-weight: 600; color: #2c3e50; margin: 28px 0 16px; padding-left: 12px; border-left: 3px solid #3498db; }

/* 分组区域 */
.category-group { margin-bottom: 32px; }
.group-title { font-size: 16px; font-weight: 600; color: #fff; margin-bottom: 16px; padding: 12px 20px; background: #e74c3c; border-radius: 6px; letter-spacing: 1px; }

/* 商品网格 */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.product-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.06); transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.product-card-link { flex: 1; display: block; }
.product-card-img { width: 100%; height: 220px; overflow: hidden; background: #f0f2f5; display: flex; align-items: center; justify-content: center; }
.product-card-img img { width: 100%; height: 100%; object-fit: cover; }
.product-card-info { padding: 14px 16px 8px; }
.product-card-name { font-size: 14px; color: #333; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 44px; }
.product-card-price { font-size: 18px; font-weight: 700; color: #e74c3c; }

/* 加入购物车按钮区域 */
.card-action-area { padding: 0 16px 16px; }
.btn-add-cart { width: 100%; padding: 10px 0; background: #3498db; color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background 0.2s; }
.btn-add-cart:hover { background: #2980b9; }
.btn-add-cart:active { background: #2472a4; }

/* 卡片内数量控制 */
.card-qty-control { display: flex; align-items: center; justify-content: center; gap: 0; background: #f8f9fa; border-radius: 8px; overflow: hidden; }
.card-qty-btn { width: 40px; height: 38px; border: none; background: transparent; cursor: pointer; font-size: 18px; font-weight: 600; display: flex; align-items: center; justify-content: center; transition: background 0.2s; color: #3498db; }
.card-qty-btn:hover { background: #e3e7eb; }
.card-qty-num { flex: 1; text-align: center; font-weight: 700; font-size: 16px; color: #2c3e50; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 24px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; border: none; }
.btn-primary { background: #3498db; color: #fff; }
.btn-primary:hover { background: #2980b9; }
.btn-outline { background: #fff; color: #3498db; border: 1px solid #3498db; }
.btn-outline:hover { background: #ebf5fb; }
.btn-lg { padding: 14px 36px; font-size: 16px; }
.btn-sm { padding: 6px 16px; font-size: 13px; }
.btn-block { width: 100%; }

/* 商品详情 */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 10px; }
.product-gallery { position: sticky; top: 84px; }
.product-main-img { background: #fff; border-radius: 12px; overflow: hidden; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.product-main-img img { width: 100%; height: 100%; object-fit: contain; }
.product-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.product-thumb { width: 72px; height: 72px; border-radius: 8px; overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: border-color 0.2s; flex-shrink: 0; }
.product-thumb.active { border-color: #3498db; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-info { padding-top: 10px; }
.product-title { font-size: 22px; font-weight: 600; color: #2c3e50; margin-bottom: 20px; }
.product-price-row { background: #fef5f5; padding: 16px 20px; border-radius: 8px; margin-bottom: 20px; display: flex; align-items: baseline; gap: 12px; }
.product-price-label { font-size: 14px; color: #888; }
.product-price-value { font-size: 28px; font-weight: 700; color: #e74c3c; }
.product-desc { color: #666; font-size: 14px; line-height: 1.8; margin-bottom: 24px; }
.product-actions { display: flex; gap: 16px; margin-top: 30px; }

/* 规格选择器 */
.spec-section { margin-bottom: 20px; }
.spec-label { font-size: 14px; font-weight: 600; color: #555; margin-bottom: 10px; }
.spec-options { display: flex; flex-wrap: wrap; gap: 8px; }
.spec-option { padding: 8px 18px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all 0.2s; background: #fff; color: #555; }
.spec-option:hover { border-color: #3498db; color: #3498db; }
.spec-option.active { border-color: #3498db; background: #ebf5fb; color: #3498db; font-weight: 600; }

/* 购物车表格 */
.cart-table-wrap { overflow-x: auto; }
.cart-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.cart-table th { background: #f8f9fa; padding: 14px 16px; text-align: left; font-weight: 600; font-size: 14px; color: #555; border-bottom: 2px solid #eee; }
.cart-table td { padding: 14px 16px; border-bottom: 1px solid #f0f0f0; font-size: 14px; vertical-align: middle; }
.cart-table tbody tr:hover { background: #fafbfc; }
.cart-product { display: flex; align-items: center; gap: 12px; }
.cart-product-img { width: 60px; height: 60px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: #f0f2f5; }
.cart-product-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-product-name { font-weight: 500; color: #333; }
.cart-product-spec { font-size: 12px; color: #888; margin-top: 4px; }
.cart-subtotal { font-weight: 600; color: #e74c3c; }

/* 数量控制 */
.qty-control { display: inline-flex; align-items: center; gap: 0; border: 1px solid #ddd; border-radius: 6px; overflow: hidden; }
.qty-btn { width: 32px; height: 32px; border: none; background: #f8f9fa; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.qty-btn:hover { background: #e9ecef; }
.qty-num { width: 40px; text-align: center; font-weight: 600; font-size: 14px; }

/* 删除按钮 */
.btn-remove { background: none; border: none; color: #e74c3c; cursor: pointer; font-size: 13px; padding: 4px 8px; border-radius: 4px; transition: background 0.2s; }
.btn-remove:hover { background: #fef5f5; }

/* 购物车汇总 */
.cart-summary { margin-top: 24px; background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.cart-total { font-size: 16px; display: flex; align-items: baseline; gap: 8px; }
.cart-total-price { font-size: 28px; font-weight: 700; color: #e74c3c; }
.cart-actions { display: flex; gap: 12px; }

/* 空状态 */
.empty-state { text-align: center; padding: 80px 20px; }
.empty-icon { width: 80px; height: 80px; color: #ccc; margin-bottom: 20px; }
.empty-state p { font-size: 16px; color: #888; margin-bottom: 24px; }

/* 订单结果 */
.order-result { background: #fff; border-radius: 12px; padding: 32px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.order-code-display { text-align: center; padding: 32px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 12px; color: #fff; margin-bottom: 24px; }
.order-code-label { font-size: 14px; opacity: 0.9; margin-bottom: 8px; }
.order-code-value { font-size: 36px; font-weight: 700; letter-spacing: 4px; margin-bottom: 16px; font-family: 'Courier New', monospace; }
.order-code-display .btn-copy { display: inline-flex; align-items: center; gap: 6px; padding: 8px 20px; border: 1.5px solid rgba(255,255,255,0.7); border-radius: 8px; background: rgba(255,255,255,0.15); color: #fff; font-size: 13px; cursor: pointer; transition: all 0.2s; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.order-code-display .btn-copy:hover { background: rgba(255,255,255,0.3); border-color: #fff; }
.order-info-row { margin-bottom: 20px; color: #888; font-size: 14px; }

/* 弹窗 */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); }
.modal-content { position: relative; background: #fff; border-radius: 16px; width: 90%; max-width: 560px; max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: 18px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #888; padding: 4px 8px; }
.modal-body { padding: 24px; }
.modal-body .order-code-value { font-size: 28px; color: #764ba2; }
.modal-body .btn-copy-modal { display: inline-flex; align-items: center; gap: 6px; padding: 8px 20px; border: 1.5px solid #667eea; border-radius: 8px; background: #667eea; color: #fff; font-size: 13px; cursor: pointer; transition: all 0.2s; }
.modal-body .btn-copy-modal:hover { background: #5a6fd6; border-color: #5a6fd6; }

/* 页脚 */
.footer { text-align: center; padding: 20px; color: #999; font-size: 13px; background: #fff; margin-top: 40px; }

/* 通知 */
.toast { position: fixed; top: 80px; right: 20px; background: #27ae60; color: #fff; padding: 12px 24px; border-radius: 8px; font-size: 14px; z-index: 2000; box-shadow: 0 4px 12px rgba(0,0,0,0.15); transform: translateX(120%); transition: transform 0.3s; }
.toast.show { transform: translateX(0); }
.toast.error { background: #e74c3c; }

/* 响应式 */
@media (max-width: 768px) {
    .category-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-detail { grid-template-columns: 1fr; gap: 20px; }
    .product-gallery { position: static; }
    .cart-summary { flex-direction: column; text-align: center; }
    .cart-actions { width: 100%; flex-direction: column; }
    .cart-actions .btn { flex: 1; }
    .header-inner { height: 56px; }
    .page-title { font-size: 20px; }
}

@media (max-width: 480px) {
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .product-card-img { height: 160px; }
    .category-card-img { height: 140px; }
}
