﻿/* 全局样式 */
* {
    margin: 0;
    padding: 0;
}
body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f5f5f5;
}
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}
.clearfix:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}

/* 头部 */
header {
    background-color: #333;
    color: white;
    padding: 15px 0;
    margin-bottom: 20px;
    text-align: center;
}
header h1 {
    margin: 0;
}

/* ========== 首页产品网格（每行4个） ========== */
.product-grid {
    overflow: hidden;
}
.product-card {
    float: left;
    width: 23%;           /* 4个总宽96%，留4%余量 */
    margin: 10px 0.5%;
    border: 1px solid #ddd;
    padding: 4px;         /* 减小内边距，避免宽度溢出 */
    background: #fff;
}
.product-image {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    background: #fafafa;
    border: 1px solid #eee;
    overflow: hidden;
}
.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.product-info {
    padding: 8px 4px 40px 4px;
    position: relative;
}
.product-info h3 {
    font-size: 1.2em;
    margin-bottom: 5px;
}
.product-price {
    color: #e44d26;
    font-weight: bold;
    font-size: 1.2em;
    margin: 5px 0;
}
.product-desc {
    color: #666;
    font-size: 0.85em;
    height: 36px;
    overflow: hidden;
    margin-bottom: 8px;
}
.btn-detail {
    position: absolute;
    right: 6px;
    bottom: 6px;
    background: #007bff;
    color: white;
    padding: 4px 8px;
    text-decoration: none;
    font-size: 0.8em;
}
.btn-detail:hover {
    background: #0056b3;
}
/* 平板：每行2个 */
@media (max-width: 768px) {
    .product-card {
        width: 48%;
        margin: 10px 1%;
    }
}
/* 手机：每行1个 */
@media (max-width: 480px) {
    .product-card {
        width: 96%;
        float: none;
        margin: 10px auto;
    }
}

/* ========== 产品详情页主图网格（每行4个） ========== */
.product-images-grid {
    overflow: hidden;
    margin: 20px 0;
}
.product-images-grid .image-card {
    float: left;
    width: 23.5%;
    margin: 0 0.5% 15px 0.5%;
    position: relative;
    padding-bottom: 24%;
    height: 0;
    background: #fafafa;
    border: 1px solid #eee;
    overflow: hidden;
}
.product-images-grid .image-card img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
@media (max-width: 768px) {
    .product-images-grid .image-card {
        width: 48%;
        padding-bottom: 48%;
        margin: 0 1% 15px 1%;
    }
}
@media (max-width: 480px) {
    .product-images-grid .image-card {
        width: 96%;
        float: none;
        padding-bottom: 96%;
        margin: 0 auto 15px;
    }
}

/* ========== 产品详情页其他样式 ========== */
.sku-list {
    overflow: hidden;
    margin: 15px 0;
}
.sku-item {
    float: left;
    background: #f0f0f0;
    border: 1px solid #ccc;
    padding: 6px 12px;
    margin-right: 10px;
    margin-bottom: 10px;
    cursor: pointer;
}
.sku-item.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}
.current-price {
    font-size: 1.5em;
    color: #e44d26;
    font-weight: bold;
    background: #fef5f0;
    padding: 8px 12px;
    margin: 15px 0;
}
.detail-description, .detail-rich {
    margin: 20px 0;
    line-height: 1.5;
}
.detail-rich img {
    max-width: 100%;
}
/* 表单卡片 */
.form-card {
    background: #f9fafc;
    border: 1px solid #e9ecef;
    padding: 15px 20px;
    margin-top: 20px;
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
}
.btn-submit {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 20px;
    cursor: pointer;
    font-size: 1em;
    text-decoration: none;
    display: inline-block;
}
.btn-submit:hover {
    background-color: #2ecc71;
}
.company-info {
    background: #fff;
    border: 1px solid #e9ecef;
    border-left: 4px solid #007bff;
    padding: 15px;
    margin-top: 30px;
    overflow: hidden;
}
.company-info .info-text {
    float: left;
    width: 70%;
}
.company-info .qrcode {
    float: right;
    max-width: 80px;
}
.back-link {
    display: inline-block;
    margin-top: 20px;
    color: #007bff;
    text-decoration: none;
}
/* 分页样式 */
.pager {
    text-align: center;
    margin: 20px 0;
    clear: both;
}
.pager a, .pager span {
    display: inline;
    padding: 4px 8px;
    margin: 0 2px;
    border: 1px solid #ddd;
    background: #fff;
    text-decoration: none;
    color: #333;
}
.pager .current {
    font-weight: bold;
    background: #007bff;
    color: white;
    border-color: #007bff;
}
/* 后台管理表格等通用样式 */
.grid {
    width: 100%;
    border-collapse: collapse;
}
.grid th, .grid td {
    border: 1px solid #ddd;
    padding: 6px;
    text-align: left;
}
.grid th {
    background: #f2f2f2;
}
.btn-edit, .btn-delete {
    display: inline-block;
    padding: 2px 6px;
    background: #007bff;
    color: white;
    text-decoration: none;
    margin-right: 4px;
}
.btn-delete {
    background: #dc3545;
}

.btn-copy {
    background-color: #17a2b8;
    color: white;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.8em;
    margin-right: 4px;
    display: inline-block;
}
.btn-copy:hover {
    background-color: #138496;
}