/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

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

/* 顶部导航 */
.header {
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 20px 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 24px;
    color: #667eea;
}

.nav a {
    color: #666;
    text-decoration: none;
    margin-left: 30px;
    transition: color 0.3s;
}

.nav a:hover, .nav a.active {
    color: #667eea;
}

/* 分类导航 */
.category-nav {
    background: #667eea;
    padding: 15px 0;
}

.category-nav .container {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.category-nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
}

.category-nav a:hover, .category-nav a.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* 主内容区 */
.main {
    padding: 40px 0;
    min-height: calc(100vh - 300px);
}

/* 商品列表 */
.goods-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.goods-item {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.goods-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.goods-image {
    height: 200px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.goods-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.goods-image .no-image {
    color: #999;
}

.goods-info {
    padding: 20px;
}

.goods-info h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.goods-price {
    margin-bottom: 10px;
}

.goods-price .current {
    font-size: 24px;
    color: #f44336;
    font-weight: bold;
}

.goods-price .original {
    font-size: 16px;
    color: #999;
    text-decoration: line-through;
    margin-left: 10px;
}

.goods-meta {
    display: flex;
    gap: 20px;
    color: #999;
    font-size: 14px;
    margin-bottom: 15px;
}

.btn-buy {
    display: block;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px;
    border-radius: 5px;
    text-decoration: none;
    transition: opacity 0.3s;
}

.btn-buy:hover {
    opacity: 0.9;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

.pagination a, .pagination span {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #666;
}

.pagination a:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.pagination span.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* 购买页面 */
.buy-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: #fff;
    padding: 40px;
    border-radius: 10px;
}

.goods-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.goods-detail .goods-image {
    height: 300px;
}

.goods-info h2 {
    font-size: 28px;
    margin-bottom: 15px;
}

.goods-info .price {
    font-size: 32px;
    color: #f44336;
    font-weight: bold;
    margin-bottom: 10px;
}

.goods-info .stock {
    color: #999;
    margin-bottom: 20px;
}

.goods-info .description {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.goods-info .description h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.goods-info .description p {
    color: #666;
    line-height: 1.8;
}

.order-form h3 {
    font-size: 24px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="email"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group input[disabled] {
    background: #f5f5f5;
    cursor: not-allowed;
}

.payment-methods {
    display: flex;
    gap: 20px;
}

.payment-methods label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    transition: all 0.3s;
}

.payment-methods label:hover {
    border-color: #667eea;
}

.payment-methods label input[type="radio"]:checked + span {
    font-weight: bold;
}

.payment-methods .alipay { color: #1678ff; }
.payment-methods .wxpay { color: #07c160; }
.payment-methods .qqpay { color: #12b7f5; }

.total-price {
    margin-top: 30px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 5px;
}

.total-price p {
    font-size: 16px;
    color: #666;
}

.total-price strong {
    color: #f44336;
    font-size: 24px;
}

.btn-submit {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s;
    margin-top: 20px;
}

.btn-submit:hover {
    opacity: 0.9;
}

/* 页脚 */
.footer {
    background: #fff;
    padding: 30px 0;
    text-align: center;
    color: #999;
    border-top: 1px solid #eee;
}

.footer p {
    margin: 5px 0;
}

/* 响应式 */
@media (max-width: 768px) {
    .buy-page {
        grid-template-columns: 1fr;
    }
    
    .header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav a {
        margin: 0 15px;
    }
    
    .goods-list {
        grid-template-columns: 1fr;
    }
}
