/* ========== 前台样式 ========== */
:root {
    --primary: #667eea;
    --primary-dark: #5a6fd6;
    --secondary: #764ba2;
    --accent: #f093fb;
    --bg: #f5f7fb;
    --card-bg: #ffffff;
    --text: #2d3436;
    --text-muted: #636e72;
    --border: #e9ecef;
    --success: #00b894;
    --danger: #e17055;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 14px;
}

* { box-sizing: border-box; }
body {
    background:
        linear-gradient(135deg, rgba(102,126,234,0.06) 0%, rgba(118,75,162,0.05) 50%, rgba(240,147,251,0.04) 100%),
        linear-gradient(to bottom right, #f8f9fd, #eef1f8, #f5f0ff);
    background-attachment: fixed;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    color: var(--text);
    min-height: 100vh;
}

/* 导航栏 */
.navbar {
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    box-shadow: 0 2px 20px rgba(102,126,234,0.3);
    padding: 12px 0;
}
.navbar-brand {
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.5px;
}
.nav-link {
    color: rgba(255,255,255,0.85) !important;
    font-size: 14px;
    transition: all 0.2s;
}
.nav-link:hover { color: #fff !important; transform: translateY(-1px); }

/* 公告栏 */
.notice-bar {
    background: linear-gradient(135deg, #fff3cd, #ffeeba);
    border: 1px solid #ffc107;
    border-radius: var(--radius);
    padding: 12px 20px;
    font-size: 14px;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 分类导航 */
.category-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 4px 0;
}
.cat-btn {
    padding: 8px 18px;
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s;
    border: 1px solid var(--border);
}
.cat-btn:hover, .cat-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(102,126,234,0.3);
    transform: translateY(-1px);
}

/* 搜索框 */
.search-box .form-control {
    border-radius: 25px 0 0 25px;
    border: 2px solid var(--border);
    padding: 10px 20px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.search-box .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}
.search-box .btn {
    border-radius: 0 25px 25px 0;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
}

/* 商品卡片 */
.product-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid transparent;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}
.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s;
}
.product-card:hover::before { opacity: 1; }

.product-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(102,126,234,0.1);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 12px;
}
.product-info { flex: 1; }
.product-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.product-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--danger);
}
.product-price::before { content: '¥'; font-size: 13px; }
.product-stock { font-size: 12px; }
.product-original-price {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: line-through;
    background: rgba(0,0,0,0.05);
    padding: 2px 8px;
    border-radius: 10px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* ============ 购买页面 ============ */
.buy-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.buy-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    padding: 30px;
    text-align: center;
}
.buy-header h4 { font-weight: 700; margin-bottom: 10px; }
.buy-price {
    font-size: 36px;
    font-weight: 800;
}
.buy-desc {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
}
.buy-desc h6 { color: var(--primary); margin-bottom: 10px; }
.desc-content {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.8;
    background: #f8f9fa;
    padding: 14px;
    border-radius: 10px;
}
.buy-stock { padding: 0 30px; }
.buy-form { padding: 0 30px 30px; }

/* 支付方式选择 */
.payment-methods {
    display: flex;
    gap: 12px;
}
.payment-method {
    flex: 1;
    cursor: pointer;
}
.payment-method input { display: none; }
.payment-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
}
.payment-method input:checked + .payment-label {
    border-color: var(--primary);
    background: rgba(102,126,234,0.08);
    color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #fff3cd;
    border-radius: 12px;
    font-weight: 600;
}
.total-price {
    font-size: 24px;
    font-weight: 800;
    color: var(--danger);
}

/* ============ 支付页面 ============ */
.pay-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
}
.pay-header { margin-bottom: 10px; }
.pay-amount {
    font-size: 42px;
    font-weight: 800;
    color: var(--danger);
    margin: 10px 0;
}
.pay-amount::before { content: '¥'; font-size: 22px; }

.pay-tabs {
    display: flex;
    gap: 0;
    background: #f1f3f5;
    border-radius: 12px;
    padding: 4px;
}
.pay-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.pay-tab.active {
    background: var(--card-bg);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.pay-qr-area { padding: 10px 0; }
.qr-image {
    max-width: 260px;
    max-height: 260px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 4px solid #fff;
}
.qr-placeholder {
    padding: 40px;
    background: #f8f9fa;
    border-radius: 16px;
    color: var(--text-muted);
}

/* ============ 订单查询 ============ */
.query-card, .order-card, .order-list-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}
.order-header {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.order-body .table td { padding: 8px 0; font-size: 14px; }

.card-delivery {
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #c8e6c9;
}
.card-delivery h6 { color: #2e7d32; margin-bottom: 12px; }
.card-content-box {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    position: relative;
    border: 1px dashed #a5d6a7;
}
.card-content-box pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-all;
    color: #1b5e20;
    line-height: 1.8;
}
.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
}

.order-item {
    display: block;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background 0.2s;
}
.order-item:hover {
    background: #f8f9fa;
    margin: 0 -24px;
    padding: 14px 24px;
    color: var(--text);
}
.order-item:last-child { border-bottom: none; }

/* ============ 通用 ============ */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

footer {
    padding: 30px 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* 响应式 */
@media (max-width: 576px) {
    .product-card { padding: 14px; }
    .product-price { font-size: 17px; }
    .buy-header { padding: 20px; }
    .buy-price { font-size: 28px; }
    .pay-amount { font-size: 32px; }
    .buy-form { padding: 0 16px 20px; }
    .buy-desc { padding: 16px; }
    .buy-stock { padding: 0 16px; }
}
