/* ===== 产品画册 - 前台样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===== 头部 ===== */
.header {
    background: #fff;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    gap: 12px;
}

.header h1 {
    font-size: 20px;
    color: #1e293b;
    white-space: nowrap;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.header-actions input[type="text"] {
    padding: 9px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 20px;
    width: 240px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.header-actions input[type="text"]:focus {
    outline: none;
    border-color: #3b82f6;
}

.btn-admin {
    padding: 8px 16px;
    background: #1e293b;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
}

.btn-admin:hover { background: #334155; }

/* ===== 分类筛选 ===== */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 0;
    border-bottom: 1px solid #e5e7eb;
}

.cat-btn {
    padding: 7px 16px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    color: #374151;
}

.cat-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.cat-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

/* ===== 产品网格 ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    padding: 20px 0;
}

/* ===== 产品卡片 ===== */
.product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.product-image {
    height: 180px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-image {
    color: #94a3b8;
    font-size: 13px;
}

.product-info {
    padding: 14px;
}

.product-info h3 {
    font-size: 15px;
    margin-bottom: 6px;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-info .spec {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 4px;
}

.product-info .item-no {
    font-size: 12px;
    color: #94a3b8;
}

.product-info .price {
    font-size: 16px;
    color: #ef4444;
    font-weight: 700;
    margin-top: 8px;
}

.category-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #eff6ff;
    color: #3b82f6;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 6px;
}

/* ===== 加载/空状态 ===== */
.loading {
    text-align: center;
    padding: 50px;
    color: #94a3b8;
}

.empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    font-size: 15px;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 24px 0;
}

.pagination button {
    padding: 8px 18px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.pagination button:hover {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.pagination span { color: #64748b; font-size: 14px; }

/* ===== 详情页 ===== */
.detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    margin: 24px 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.detail-image {
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
}

.detail-image img {
    width: 100%;
    height: auto;
}

.detail-info h2 {
    font-size: 24px;
    color: #1e293b;
    margin-bottom: 20px;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.detail-table th,
.detail-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

.detail-table th {
    width: 90px;
    color: #64748b;
    font-weight: 500;
}

.detail-table .price {
    font-size: 20px;
    font-weight: 700;
    color: #ef4444;
}

.detail-table .price.highlight {
    color: #dc2626;
}

.detail-content {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.detail-content h3 {
    margin-bottom: 10px;
    font-size: 15px;
    color: #374151;
}

.detail-content .content-body {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.8;
}

.detail-actions {
    margin-top: 24px;
}

.btn-secondary {
    padding: 10px 24px;
    background: #6c757d;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover { background: #5a6268; }

/* 返回链接 */
.back-link {
    color: #3b82f6;
    text-decoration: none;
    font-size: 14px;
}

.back-link:hover { text-decoration: underline; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    /* 头部 */
    .header .container {
        height: auto;
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    .header h1 { font-size: 18px; }

    .header-actions {
        width: 100%;
        justify-content: stretch;
    }

    .header-actions input[type="text"] {
        flex: 1;
        width: auto;
    }

    /* 分类筛选横向滚动 */
    .category-filter {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 12px;
    }

    .category-filter::-webkit-scrollbar { display: none; }

    .cat-btn { white-space: nowrap; flex-shrink: 0; }

    /* 产品网格 */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .product-image { height: 140px; }

    .product-info { padding: 10px; }
    .product-info h3 { font-size: 14px; }

    /* 详情页 */
    .detail-container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 16px;
        margin: 12px 0;
    }

    .detail-info h2 { font-size: 20px; }
}

@media (max-width: 400px) {
    .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}
