/* 商城样式文件 */

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

/* 头部样式 */
.shop-header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header-left .logo {
    font-size: 24px;
    font-weight: bold;
    color: #e74c3c;
    text-decoration: none;
}

.header-center {
    flex: 1;
    max-width: 500px;
    margin: 0 30px;
}

.search-form {
    display: flex;
    width: 100%;
}

.search-form input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}

.search-form button {
    padding: 10px 20px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.cart-link, .login-link {
    color: #333;
    text-decoration: none;
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s;
}

.cart-link:hover, .login-link:hover {
    background: #f8f8f8;
}

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

/* 面包屑 */
.breadcrumb {
    padding: 15px 0;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
}

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

.breadcrumb span {
    margin: 0 10px;
    color: #999;
}

/* 主要内容区域 */
.shop-main {
    padding: 20px 0;
}

.shop-sidebar {
    width: 200px;
    float: left;
    background: #fff;
    border-radius: 4px;
    padding: 20px;
    margin-right: 20px;
}

.shop-content {
    margin-left: 220px;
    background: #fff;
    border-radius: 4px;
    padding: 20px;
}

/* 分类树 */
.category-tree h3 {
    margin-bottom: 15px;
    color: #333;
}

.category-tree ul {
    list-style: none;
}

.category-tree li {
    margin-bottom: 5px;
}

.category-tree a {
    color: #666;
    text-decoration: none;
    padding: 5px 0;
    display: block;
    transition: color 0.3s;
}

.category-tree a:hover,
.category-tree li.active a {
    color: #e74c3c;
}

.category-tree ul ul {
    margin-left: 20px;
    margin-top: 5px;
}

/* 商品筛选 */
.product-filter {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e5e5;
}

.filter-left a {
    color: #666;
    text-decoration: none;
    margin-right: 15px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s;
}

.filter-left a:hover,
.filter-left a.active {
    background: #e74c3c;
    color: white;
}

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

.product-item {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    background: #fff;
}

.product-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.product-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

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

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: white;
}

.product-badge.hot {
    background: #e74c3c;
}

.product-badge.new {
    background: #27ae60;
}

.product-info {
    padding: 15px;
}

.product-name {
    margin-bottom: 10px;
}

.product-name a {
    color: #333;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
}

.product-name a:hover {
    color: #e74c3c;
}

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

.current-price {
    color: #e74c3c;
    font-size: 18px;
    font-weight: bold;
}

.market-price {
    color: #999;
    text-decoration: line-through;
    margin-left: 10px;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
    margin-bottom: 15px;
}

.btn-add-cart {
    width: 100%;
    padding: 8px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-add-cart:hover {
    background: #c0392b;
}

/* 商品详情页 */
.product-detail {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.product-gallery {
    flex: 1;
}

.main-image {
    margin-bottom: 15px;
    text-align: center;
}

.main-image img {
    max-width: 100%;
    height: 400px;
    object-fit: cover;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
}

.thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.3s;
}

.thumbnail.active,
.thumbnail:hover {
    border-color: #e74c3c;
}

.product-info {
    flex: 1;
}

.product-title {
    font-size: 24px;
    margin-bottom: 10px;
    color: #333;
}

.product-subtitle {
    color: #666;
    margin-bottom: 20px;
}

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

.product-meta {
    margin-bottom: 20px;
}

.meta-item {
    display: flex;
    margin-bottom: 10px;
}

.meta-item label {
    width: 80px;
    color: #666;
}

.product-specs {
    margin-bottom: 20px;
}

.product-specs h3 {
    margin-bottom: 10px;
}

.spec-item {
    margin-bottom: 10px;
}

.spec-item input[type="radio"] {
    margin-right: 10px;
}

.product-quantity {
    margin-bottom: 20px;
}

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

.quantity-control button {
    width: 30px;
    height: 30px;
    border: none;
    background: #f8f8f8;
    cursor: pointer;
}

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

.product-actions {
    display: flex;
    gap: 15px;
}

.btn-add-cart,
.btn-buy-now {
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.btn-add-cart {
    background: #e74c3c;
    color: white;
}

.btn-add-cart:hover {
    background: #c0392b;
}

.btn-buy-now {
    background: #f39c12;
    color: white;
}

.btn-buy-now:hover {
    background: #e67e22;
}

/* 商品标签页 */
.product-tabs {
    margin-bottom: 30px;
}

.tab-nav {
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 20px;
}

.tab-link {
    display: inline-block;
    padding: 10px 20px;
    color: #666;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-link.active {
    color: #e74c3c;
    border-bottom-color: #e74c3c;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* 购物车样式 */
.cart-table {
    margin-bottom: 20px;
}

.cart-table table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th,
.cart-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.cart-table th {
    background: #f8f8f8;
    font-weight: bold;
}

.cart-item .product-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-item .product-image {
    width: 80px;
    height: 80px;
}

.cart-item .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.cart-item .product-name a {
    color: #333;
    text-decoration: none;
}

.cart-item .product-name a:hover {
    color: #e74c3c;
}

.spec-name {
    color: #666;
    font-size: 12px;
    margin-top: 5px;
}

.stock-warning {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
}

.cart-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f8f8;
    border-radius: 4px;
}

.summary-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.total-amount {
    color: #e74c3c;
    font-size: 18px;
    font-weight: bold;
}

.btn-checkout {
    padding: 12px 30px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.btn-checkout:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.empty-cart {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-cart h3 {
    margin-bottom: 10px;
    color: #666;
}

.empty-cart p {
    color: #999;
    margin-bottom: 30px;
}

.btn-go-shopping {
    display: inline-block;
    padding: 12px 30px;
    background: #e74c3c;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

/* 登录页面 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
}

.login-box {
    width: 400px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
}

.login-tabs {
    display: flex;
    border-bottom: 1px solid #e5e5e5;
}

.tab-link {
    flex: 1;
    padding: 15px;
    text-align: center;
    color: #666;
    text-decoration: none;
    background: #f8f8f8;
    transition: all 0.3s;
}

.tab-link.active {
    background: #fff;
    color: #e74c3c;
}

.login-content {
    padding: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-login,
.btn-register {
    width: 100%;
    padding: 12px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.btn-login:hover,
.btn-register:hover {
    background: #c0392b;
}

/* 分页 */
.pagination {
    text-align: center;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    color: #666;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.pagination a:hover {
    background: #f8f8f8;
}

.pagination .current {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .shop-header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-center {
        margin: 0;
        max-width: none;
    }
    
    .shop-sidebar {
        width: 100%;
        float: none;
        margin-right: 0;
        margin-bottom: 20px;
    }
    
    .shop-content {
        margin-left: 0;
    }
    
    .product-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .product-detail {
        flex-direction: column;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .cart-table {
        overflow-x: auto;
    }
    
    .cart-summary {
        flex-direction: column;
        gap: 15px;
    }
}
