/* 商城页面布局 */
body {
    padding-top: 60px;
}

.shop-container {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 20px;
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

/* 筛选区样式 */
.filter-section {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.filter-section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 18px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filter-group ul {
    list-style: none;
    padding: 0;
}

.filter-group li {
    margin: 8px 0;
}

.filter-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: color 0.3s;
}

.filter-group label:hover {
    color: #4CAF50;
}

.filter-group input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-radius: 3px;
    transition: all 0.3s;
    cursor: pointer;
}

.filter-group input[type="checkbox"]:checked {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

/* 商品展示区样式 */
.products-section {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-height: 500px;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.products-header h2 {
    font-size: 24px;
    color: #333;
}

.sort-options select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s;
}

.sort-options select:hover {
    border-color: #4CAF50;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.product-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 15px;
    transition: transform 0.3s;
}

.product-card:hover img {
    transform: scale(1.05);
}

.product-card h3 {
    font-size: 16px;
    margin: 10px 0;
    color: #333;
    line-height: 1.4;
}

.product-card .description {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
    flex-grow: 1;
}

.product-card .price {
    font-size: 20px;
    color: #e53935;
    font-weight: bold;
    margin: 10px 0;
}

.add-to-cart {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-to-cart:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.add-to-cart:active {
    transform: translateY(0);
}

/* 购物车侧栏样式 */
.cart-sidebar {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.cart-sidebar h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 18px;
}

.cart-items {
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 5px;
}

.cart-items::-webkit-scrollbar {
    width: 4px;
}

.cart-items::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.cart-items::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr 30px;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #eee;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.item-info h4 {
    font-size: 14px;
    margin: 0 0 5px 0;
    color: #333;
}

.item-info .price {
    font-size: 16px;
    color: #e53935;
    font-weight: bold;
    margin-bottom: 8px;
}

.quantity {
    display: flex;
    align-items: center;
    gap: 5px;
}

.quantity button {
    width: 24px;
    height: 24px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.quantity button:hover {
    border-color: #4CAF50;
    color: #4CAF50;
}

.quantity input {
    width: 40px;
    height: 24px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.remove-item {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.3s;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-item:hover {
    color: #e53935;
}

.cart-summary {
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.cart-summary p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
}

.total-price {
    font-size: 24px;
    color: #e53935;
    font-weight: bold;
}

.checkout-btn {
    width: 100%;
    background: #e53935;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.checkout-btn:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

.checkout-btn:active {
    transform: translateY(0);
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    margin: 0 4px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
}

.pagination a.active {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.pagination a:hover:not(.active) {
    background: #f5f5f5;
    border-color: #4CAF50;
}

/* 空状态样式 */
.no-products {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.no-products p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* 购物车通知样式 */
.cart-notification {
    animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .shop-container {
        grid-template-columns: 200px 1fr 250px;
    }
}

@media (max-width: 992px) {
    .shop-container {
        grid-template-columns: 200px 1fr;
    }

    .cart-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 300px;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        border-radius: 0;
        padding-top: 60px;
    }

    .cart-sidebar::before {
        content: '购物车';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 50px;
        background: #4CAF50;
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
    }

    .cart-sidebar.active {
        transform: translateX(0);
    }

    .cart-toggle {
        opacity: 0.9;
    }

    .cart-toggle:hover {
        opacity: 1;
        transform: scale(1.1);
    }
}

@media (max-width: 768px) {
    .shop-container {
        grid-template-columns: 1fr;
        padding: 0 10px;
    }

    .filter-section {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 250px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        border-radius: 0;
        overflow-y: auto;
    }

    .filter-section.active {
        transform: translateX(0);
    }

    .products-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .sort-options {
        width: 100%;
    }

    .sort-options select {
        width: 100%;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .product-card {
        padding: 10px;
    }

    .product-card img {
        height: 150px;
    }

    .product-card h3 {
        font-size: 14px;
    }

    .product-card .description {
        font-size: 12px;
    }

    .product-card .price {
        font-size: 16px;
    }

    .add-to-cart {
        padding: 8px 16px;
        font-size: 12px;
    }
}

/* 移动端筛选按钮 */
.filter-toggle {
    display: none;
    position: fixed;
    left: 20px;
    bottom: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.filter-toggle:hover {
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .filter-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
} 