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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 容器样式 */
.container {
    width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 顶部导航栏 */
.top-nav {
    background-color: #f2f2f2;
    height: 30px;
    line-height: 30px;
    font-size: 12px;
}

.top-links {
    list-style: none;
    display: flex;
    justify-content: flex-end;
}

.top-links li {
    margin-left: 20px;
}

.top-links a {
    color: #666;
    text-decoration: none;
}

.top-links a:hover {
    color: #f60;
}

/* 主导航栏 */
.main-nav {
    background-color: #fff;
    padding: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.logo h1 {
    color: #f60;
    font-size: 28px;
    font-weight: bold;
}

.search-bar {
    display: flex;
    width: 500px;
}

.search-bar input {
    flex: 1;
    height: 40px;
    padding: 0 15px;
    border: 2px solid #f60;
    border-radius: 4px 0 0 4px;
    outline: none;
}

.search-bar button {
    width: 50px;
    height: 40px;
    background-color: #f60;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 16px;
}

.cart-icon a {
    display: flex;
    align-items: center;
    color: #666;
    text-decoration: none;
    font-size: 16px;
}

.cart-icon i {
    margin-right: 5px;
}

.cart-count {
    background-color: #f60;
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
}

/* 分类导航 */
.category-nav {
    background-color: #f60;
}

.categories {
    list-style: none;
    display: flex;
    height: 40px;
    line-height: 40px;
}

.categories li {
    margin-right: 30px;
}

.categories a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

.categories a:hover {
    text-decoration: underline;
}

/* 轮播图 */
.carousel {
    position: relative;
    margin: 20px 0;
    overflow: hidden;
    border-radius: 8px;
    height: 400px;
}

.carousel-items {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

.carousel-item {
    flex: 0 0 100%;
    position: relative;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-caption {
    position: absolute;
    bottom: 50px;
    left: 50px;
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 8px;
}

.carousel-caption h2 {
    font-size: 32px;
    margin-bottom: 10px;
}

.carousel-caption p {
    font-size: 18px;
    margin-bottom: 15px;
}

.btn {
    display: inline-block;
    background-color: #f60;
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #e55a00;
}

.carousel-prev, .carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: background-color 0.3s;
}

.carousel-prev:hover, .carousel-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.carousel-prev {
    left: 20px;
}

.carousel-next {
    right: 20px;
}

.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.carousel-indicators span {
    width: 12px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s;
}

.carousel-indicators span.active {
    background-color: white;
}

/* 特色分类 */
.featured-categories {
    margin: 40px 0;
}

.featured-categories h2 {
    font-size: 24px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f60;
}

.category-items {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.category-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.category-item:hover {
    transform: translateY(-5px);
}

.category-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s;
}

.category-item:hover img {
    transform: scale(1.05);
}

.category-item span {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 16px;
}

/* 商品网格 */
.recommended-products, .flash-deals {
    margin: 40px 0;
}

.recommended-products h2, .flash-deals h2 {
    font-size: 24px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f60;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.product-item {
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

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

.product-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 10px;
}

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

.product-item:hover .product-image img {
    transform: scale(1.05);
}

.product-title {
    font-size: 14px;
    height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 10px;
}

.product-price {
    font-size: 18px;
    color: #f60;
    font-weight: bold;
}

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

.product-rating {
    color: #ffd700;
    font-size: 14px;
    margin-bottom: 10px;
}

.product-sales {
    font-size: 12px;
    color: #999;
}

/* 限时特惠 */
.flash-deals-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.countdown {
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    color: #f60;
}

.time {
    background-color: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
}

/* 品牌专区 */
.brands {
    margin: 40px 0;
}

.brands h2 {
    font-size: 24px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f60;
}

.brand-logos {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
}

.brand-logos img {
    height: 50px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.brand-logos img:hover {
    opacity: 1;
}

/* 购物车侧边栏 */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background-color: white;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    transition: right 0.3s;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.cart-header h3 {
    font-size: 18px;
}

.close-cart {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

.empty-cart i {
    font-size: 60px;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 15px;
}

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

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    font-size: 14px;
    height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 10px;
}

.cart-item-price {
    font-size: 16px;
    color: #f60;
    font-weight: bold;
}

.cart-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    background-color: white;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 18px;
}

.total-price {
    color: #f60;
    font-weight: bold;
}

.checkout-btn {
    width: 100%;
    background-color: #f60;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.checkout-btn:hover {
    background-color: #e55a00;
}

/* 商品详情模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 20px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-body {
    display: flex;
    padding: 20px;
}

.modal-image {
    flex: 0 0 40%;
    margin-right: 30px;
}

.modal-image img {
    width: 100%;
    border-radius: 4px;
}

.modal-details {
    flex: 1;
}

.modal-price {
    margin-bottom: 20px;
}

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

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

.modal-description {
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 30px;
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.decrease-quantity, .increase-quantity {
    width: 30px;
    height: 30px;
    background-color: #f2f2f2;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.quantity-input {
    width: 60px;
    height: 30px;
    text-align: center;
    border: none;
    outline: none;
}

.add-to-cart-btn {
    background-color: #f60;
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.add-to-cart-btn:hover {
    background-color: #e55a00;
}

/* 页脚 */
footer {
    background-color: #333;
    color: white;
    padding: 40px 0;
    margin-top: 60px;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 40px;
    margin-bottom: 30px;
}

.link-group h3 {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #555;
}

.link-group ul {
    list-style: none;
}

.link-group li {
    margin-bottom: 10px;
}

.link-group a {
    color: #ccc;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.link-group a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #555;
    font-size: 14px;
    color: #999;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .container {
        width: 100%;
    }
    
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .search-bar {
        width: 350px;
    }
    
    .category-items {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .footer-links {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .main-nav .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-bar {
        width: 100%;
    }
    
    .categories {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 0;
    }
    
    .categories li {
        margin-right: 15px;
        margin-bottom: 5px;
    }
    
    .carousel {
        height: 250px;
    }
    
    .carousel-caption {
        bottom: 20px;
        left: 20px;
        padding: 15px;
    }
    
    .carousel-caption h2 {
        font-size: 24px;
    }
    
    .carousel-caption p {
        font-size: 14px;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .brand-logos {
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .modal-body {
        flex-direction: column;
    }
    
    .modal-image {
        flex: none;
        margin-right: 0;
        margin-bottom: 20px;
    }
    
    .footer-links {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-links {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}