/* ========== 全局 ========== */
:root {
    --bg: #f5f7fa;
    --card: #ffffff;
    --primary: #6644cc;
    --primary-light: #f0eef8;
    --primary-dark: #5238a3;
    --text: #1a1a2e;
    --text-secondary: #8492a6;
    --border: #e4e7ed;
    --danger: #f56c6c;
    --success: #67c23a;
    --warning: #e6a23c;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-hover: 0 6px 24px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; }

/* Bootstrap 工具类替代 */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 15px; }
.text-center { text-align: center; }
.mt-4 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1.5rem; }

/* 自定义滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #adb5bd; }

body {
    background: var(--bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== 顶部搜索栏（前台版，简化） ========== */
/* ========== 搜索栏（与 admin 完全一致的紫色渐变） ========== */
.search-bar {
    background: linear-gradient(135deg, #7c5ce0 0%, #5a3db5 50%, #4a2fa0 100%);
    border-radius: 14px;
    padding: 22px 28px;
    box-shadow: 0 4px 20px rgba(102,68,204,0.25), 0 1px 4px rgba(0,0,0,0.08);
    margin: 20px 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

/* 搜索栏装饰光效 */
.search-bar::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 40%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* 搜索栏 Logo */
.search-logo-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 16px;
}

.search-logo-img {
    height: 28px;
    width: auto;
    display: block;
    filter: brightness(1.05);
}

/* 滚动公告 */
.scroll-announcement {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    margin: 0 24px;
    height: 30px;
    line-height: 30px;
    position: relative;
    background: rgba(255,255,255,0.08);
    border-radius: 15px;
    padding: 0 12px;
}

.scroll-announcement-inner {
    display: inline-block;
    white-space: nowrap;
    color: #fff;
    font-size: 0.88rem;
    animation: scroll-left 20s linear infinite;
    padding-left: 100%;
}

.scroll-announcement-inner:hover {
    animation-play-state: paused;
}

@keyframes scroll-left {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* 搜索栏右侧统计+按钮 */
.search-stats-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.header-btns {
    display: flex;
    gap: 8px;
}

.header-btn {
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s;
    backdrop-filter: blur(4px);
}

.header-btn:hover {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.6);
    color: #fff;
    transform: translateY(-1px);
}

.search-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
    letter-spacing: 0.03em;
}

.stat-num {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.stat-divider-v {
    width: 1px;
    height: 28px;
    background: rgba(255,255,255,0.2);
    flex-shrink: 0;
}

/* ========== 分类筛选卡片 ========== */
.filter-card {
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 10px 20px 12px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
}

.filter-tags-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 13px;
    flex: 1;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px 5px 6px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
}

.filter-tag:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-1px);
}

.filter-tag.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(102,68,204,0.25);
    transform: translateY(-1px);
}

/* ========== 搜索排序栏 ========== */
.search-sort-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 0;
}

.search-sort-bar .search-input-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
}

.search-sort-bar .search-input-wrap input {
    width: 100%;
    padding: 9px 36px 9px 36px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    background: var(--card);
    color: var(--text);
}

.search-sort-bar .search-input-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,68,204,0.1);
}

.search-sort-bar .search-input-wrap input::placeholder {
    color: #aab0c0;
}

.search-sort-bar .search-input-wrap .si-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-sort-bar .search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.2rem;
    display: none;
}

.search-sort-bar .search-clear:hover {
    color: var(--danger);
}

.sort-select {
    padding: 9px 36px 9px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238492a6' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
    color: var(--text);
    flex-shrink: 0;
    min-width: 150px;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    line-height: 1.4;
}

.sort-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,68,204,0.1);
}
.products-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.products-count {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* ========== 商品卡片（前台版，简化） ========== */
.fe-card {
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: row;
    align-items: stretch;
    padding: 12px 14px;
    gap: 12px;
    min-height: 80px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.fe-card:hover {
    box-shadow: 0 4px 16px rgba(102,68,204,0.1), 0 1px 3px rgba(0,0,0,0.06);
    border-color: rgba(102,68,204,0.3);
    transform: translateY(-2px);
}

/* 缩略图 */
.fe-thumb-wrap {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg);
    align-self: center;
    border: 1px solid rgba(0,0,0,0.04);
}

.fe-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fe-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c0c4cc;
    font-size: 1.4rem;
}

/* 右侧信息区 */
.fe-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    justify-content: center;
}

/* 第一行：商品名称 */
.fe-line1 {
    display: flex;
    align-items: center;
}

.fe-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    transition: color 0.15s;
}

.fe-card:hover .fe-name {
    color: var(--primary);
}

/* 第二行：价格 + ID + 复制按钮 */
.fe-line2 {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.fe-price {
    font-size: 0.82rem;
    font-weight: 700;
    color: #6644cc;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    height: 16px;
    letter-spacing: 0.01em;
}

.fe-gid {
    font-size: 0.58rem;
    color: #909399;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    height: 16px;
}

/* 起订限购信息 */
.fe-order-info {
    font-size: 0.62rem;
    color: #909399;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 16px;
}

.fe-order-info .oi-label {
    color: #c0c4cc;
}

/* 复制下单按钮 */
.fe-copy-btn {
    margin-left: auto;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.2;
}

.fe-copy-btn:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102,68,204,0.3);
}

/* ========== 加载更多 ========== */
.btn-loadmore {
    padding: 10px 32px;
    border-radius: 20px;
    border: 1px solid var(--primary);
    background: #fff;
    color: var(--primary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-loadmore:hover {
    background: var(--primary);
    color: #fff;
}

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

.empty-state .si-inbox {
    display: block;
    margin: 0 auto 16px;
    color: var(--border);
}

.empty-state h5 {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    max-width: 90vw;
    width: 460px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.25s;
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h5 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-body {
    padding: 18px 24px;
    overflow-y: auto;
    flex: 1;
    font-size: 0.82rem;
}

/* 下单必看内容 */
.info-content {
    font-size: 0.82rem;
    line-height: 1.6;
}

/* 联系下单弹窗内容 */
#contactModal .modal-body {
    font-size: 90%;
}

.contact-title {
    font-size: 0.9rem;
    margin-bottom: 12px;
    text-align: center;
    font-weight: 600;
}

.contact-qr {
    max-width: 200px;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.contact-subtitle {
    margin-top: 12px;
    color: #666;
    font-size: 0.78rem;
    text-align: center;
}

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 居中 Toast（复制成功等） */
.toast-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    border: none;
    box-shadow: 0 8px 32px rgba(102,68,204,0.35);
}

.toast-center.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.toast-success {
    background: #f0f9eb;
    color: var(--success);
    border: 1px solid #c2e7b0;
}

.toast-error {
    background: #fef0f0;
    color: var(--danger);
    border: 1px solid #fbc4c4;
}

.toast-info {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid #d9c8f0;
}

/* ========== 响应式 ========== */

/* ≤992px（平板 + 手机） */
@media (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .search-bar {
        flex-wrap: wrap;
        padding: 24px 20px;
        gap: 12px;
    }

    .search-logo-wrap {
        flex: 1 1 100%;
        justify-content: center;
    }

    .search-logo-img {
        height: 24px;
    }

    .search-stats-right {
        flex: 1 1 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* ≤768px（手机） */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    html, body { overflow-x: hidden; }

    .search-bar {
        padding: 20px 14px;
    }

    .search-logo-img {
        height: 20px;
    }

    .header-btns {
        gap: 6px;
    }

    .header-btn {
        padding: 5px 10px;
        font-size: 0.78rem;
        font-weight: 700;
    }

    .filter-card {
        padding: 10px 14px 12px;
    }

    .fe-card {
        padding: 10px 12px;
        gap: 10px;
    }

    .fe-thumb-wrap {
        width: 44px;
        height: 44px;
    }

    .fe-name {
        font-size: 0.82rem;
    }

    .fe-price {
        font-size: 0.78rem;
    }
}

/* ≤480px（小手机） */
@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    html { overflow-x: hidden; }
    body { font-size: 14px; overflow-x: hidden; }

    .search-bar {
        padding: 16px 12px;
        border-radius: 14px;
        flex-wrap: wrap;
    }

    .search-logo-wrap {
        flex: 0 0 auto;
        justify-content: flex-start;
        margin-bottom: 0;
    }

    .search-logo-img {
        height: 21px;
    }

    .scroll-announcement {
        flex: 1 1 100%;
        margin: 6px 0 0;
        font-size: 0.78rem;
    }

    .header-btns {
        flex: 0 0 auto;
        justify-content: flex-end;
    }

    .search-stats-right {
        flex: 1 1 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 6px;
    }

    .search-stat-item {
        flex: 1;
        justify-content: center;
    }

    .search-stat-item .stat-label {
        font-size: 0.72rem;
    }

    .search-stat-item .stat-num {
        font-size: 0.95rem;
    }

    .header-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
        font-weight: 700;
    }

    .stat-divider-v {
        display: block;
        height: 18px;
    }
