/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    text-decoration: none;
    color: #333;
    transition: color 0.3s;
}

a:hover {
    color: #ff6600;
}

ul {
    list-style: none;
}

/* ========== 顶部栏 ========== */
.top-bar {
    background: #f8f8f8;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    padding: 8px 0;
}

.top-bar .container {
    display: flex;
    justify-content: space-between;
}

.top-left .separator {
    margin: 0 10px;
    color: #ddd;
}

.top-right a {
    margin-left: 20px;
}

/* ========== 头部 ========== */
header {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
}

.logo h1 {
    font-size: 28px;
    color: #ff6600;
    margin-bottom: 5px;
}

.logo span {
    font-size: 12px;
    color: #999;
}

.search-box {
    flex: 1;
    max-width: 500px;
    margin: 0 30px;
}

.search-box form {
    display: flex;
    border: 2px solid #ff6600;
    border-radius: 35px;
    overflow: hidden;
}

.search-box input {
    flex: 1;
    padding: 12px 18px;
    border: none;
    outline: none;
    font-size: 14px;
}

.search-box button {
    padding: 0 25px;
    background: #ff6600;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.search-box button:hover {
    background: #e55a00;
}

.cart-box {
    position: relative;
}

.cart-icon {
    display: inline-block;
    padding: 10px 20px;
    background: #f8f8f8;
    border-radius: 35px;
    font-size: 16px;
    position: relative;
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff6600;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    text-align: center;
    line-height: 20px;
}

/* 购物车下拉 */
.cart-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    width: 320px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
}

/* ========== 导航菜单 ========== */
.nav-menu {
    background: #333;
}

.nav-menu ul {
    display: flex;
}

.nav-menu li {
    position: relative;
}

.nav-menu li a {
    display: block;
    padding: 14px 25px;
    color: #fff;
    font-size: 15px;
}

.nav-menu li a:hover,
.nav-menu li a.active {
    background: #ff6600;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 160px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 4px;
    display: none;
    z-index: 100;
}

.nav-menu li.has-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu li a {
    padding: 10px 20px;
    color: #333;
}

.dropdown-menu li a:hover {
    background: #f5f5f5;
    color: #ff6600;
}

/* ========== 首页Banner ========== */
.banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-align: center;
    padding: 60px 0;
    margin-bottom: 40px;
}

.banner h2 {
    font-size: 36px;
    margin-bottom: 15px;
}

.banner p {
    font-size: 18px;
    opacity: 0.9;
}

/* ========== 主营推荐 ========== */
.featured-section {
    padding: 40px 0;
    background: #fff;
    margin-bottom: 20px;
}

.section-title {
    text-align: center;
    font-size: 28px;
    margin-bottom: 30px;
    position: relative;
    padding-bottom: 15px;
}

.section-title:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: #ff6600;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
}

.product-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.product-image {
    height: 220px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 15px;
}

.product-name {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-subtitle {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
    height: 36px;
    overflow: hidden;
}

.product-price {
    font-size: 18px;
    color: #ff6600;
    font-weight: bold;
}

.product-price small {
    font-size: 12px;
}

/* 分类页左右布局 */
.category-layout {
    display: flex;
    gap: 30px;
    padding: 30px 0;
}

.category-sidebar {
    width: 220px;
    flex-shrink: 0;
}

.category-sidebar .sidebar-title {
    font-size: 18px;
    font-weight: bold;
    padding: 12px 15px;
    background: #ff6600;
    color: #fff;
    border-radius: 8px;
    margin-bottom: 15px;
}

.category-list {
    background: #fff;
    border-radius: 8px;
    padding: 10px 0;
}

.category-list li a {
    display: block;
    padding: 10px 15px;
    border-left: 3px solid transparent;
}

.category-list li a:hover,
.category-list li a.active {
    border-left-color: #ff6600;
    background: #f5f5f5;
    color: #ff6600;
}

.category-content {
    flex: 1;
}

.category-breadcrumb {
    margin-bottom: 20px;
    font-size: 14px;
    color: #999;
}

/* 分页 */
.pagination {
    margin-top: 30px;
    text-align: center;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.pagination a:hover {
    background: #ff6600;
    border-color: #ff6600;
    color: #fff;
}

.pagination .current {
    background: #ff6600;
    border-color: #ff6600;
    color: #fff;
}

/* 商品详情页 */
.product-detail {
    padding: 30px 0;
}

.product-detail-main {
    display: flex;
    gap: 40px;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.product-gallery {
    flex: 1;
}

.product-main-image {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.product-main-image img {
    width: 100%;
    height: auto;
}

.product-thumb-list {
    display: flex;
    gap: 10px;
}

.product-thumb-list img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.product-thumb-list img:hover {
    border-color: #ff6600;
}

.product-info-right {
    flex: 1;
}

.product-info-right h1 {
    font-size: 24px;
    margin-bottom: 10px;
}

.product-subtitle-detail {
    color: #999;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.product-price-detail {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.product-price-detail .label {
    font-size: 14px;
    color: #666;
}

.product-price-detail .value {
    font-size: 28px;
    color: #ff6600;
    font-weight: bold;
}

.product-stock {
    margin-bottom: 15px;
}

.spec-item {
    margin-bottom: 20px;
}

.spec-label {
    font-weight: 500;
    margin-bottom: 10px;
}

.spec-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.spec-option {
    padding: 8px 18px;
    border: 1px solid #ddd;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
}

.spec-option:hover {
    border-color: #ff6600;
}

.spec-option.selected {
    background: #ff6600;
    border-color: #ff6600;
    color: #fff;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 18px;
}

.quantity-input {
    width: 60px;
    height: 32px;
    text-align: center;
    border: 1px solid #ddd;
}

.cart-btn {
    padding: 12px 40px;
    background: #ff6600;
    color: #fff;
    border: none;
    border-radius: 35px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.cart-btn:hover {
    background: #e55a00;
}

.product-description {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
}

.tabs {
    display: flex;
    gap: 30px;
    border-bottom: 2px solid #eee;
    margin-bottom: 25px;
}

.tab-btn {
    padding: 10px 0;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    position: relative;
}

.tab-btn.active {
    color: #ff6600;
}

.tab-btn.active:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #ff6600;
}

.tab-content {
    display: none;
    line-height: 1.8;
}

.tab-content.active {
    display: block;
}

/* 购物车内商品 */
.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.cart-item-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-size: 13px;
    margin-bottom: 5px;
}

.cart-item-price {
    font-size: 13px;
    color: #ff6600;
}

.cart-item-quantity {
    width: 40px;
    text-align: center;
}

.cart-footer {
    padding: 12px;
    text-align: center;
}

.cart-footer .total {
    font-size: 14px;
    margin-bottom: 10px;
}

.checkout-btn {
    background: #ff6600;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    width: 100%;
}

.empty-cart {
    text-align: center;
    padding: 30px;
    color: #999;
}

/* 底部 */
footer {
    background: #222;
    color: #999;
    margin-top: 40px;
}

footer .container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    padding: 40px 15px;
}

footer h4 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 16px;
}

footer ul li {
    margin-bottom: 8px;
}

footer ul li a {
    color: #999;
}

footer ul li a:hover {
    color: #ff6600;
}

.footer-bottom {
    background: #1a1a1a;
    text-align: center;
    padding: 15px 0;
    font-size: 12px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .header-main {
        flex-wrap: wrap;
    }
    
    .search-box {
        order: 3;
        margin: 15px 0 0;
        max-width: 100%;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .product-detail-main {
        flex-direction: column;
    }
    
    .category-layout {
        flex-direction: column;
    }
    
    .category-sidebar {
        width: 100%;
    }
    
    footer .container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .nav-menu ul {
        overflow-x: auto;
    }
}
