/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.logo h1 {
    font-size: 24px;
    color: #e74c3c;
    font-weight: bold;
}

.logo h1 a {
    text-decoration: none;
    color: inherit;
}

.nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 10px 0;
    transition: color 0.3s;
}

.nav a:hover,
.nav a.active {
    color: #e74c3c;
}

.user-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.user-actions a {
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    font-weight: 500;
    transition: all 0.3s;
}

.login-btn {
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.login-btn:hover {
    background: #e74c3c;
    color: #fff;
}

.register-btn {
    background: #e74c3c;
    color: #fff;
}

.register-btn:hover {
    background: #c0392b;
}

.cart-btn {
    background: #3498db;
    color: #fff;
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    position: relative;
}

.cart-count {
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    position: absolute;
    top: -5px;
    right: -5px;
}

.profile-btn, .logout-btn {
    color: #666;
    border: 1px solid #ddd;
}

.profile-btn:hover, .logout-btn:hover {
    background: #666;
    color: #fff;
}

/* 主要内容 */
.main {
    min-height: calc(100vh - 200px);
    padding: 40px 0;
}

/* 英雄区域 */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-align: center;
    padding: 80px 0;
    margin-bottom: 60px;
}

.hero-content h2 {
    font-size: 48px;
    margin-bottom: 20px;
    font-weight: bold;
}

.hero-content p {
    font-size: 20px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.cta-btn {
    display: inline-block;
    background: #e74c3c;
    color: #fff;
    padding: 15px 30px;
    text-decoration: none;
    border-radius: 5px;
    font-size: 18px;
    font-weight: 500;
    transition: background 0.3s;
}

.cta-btn:hover {
    background: #c0392b;
}

/* 分类区域 */
.categories {
    margin-bottom: 60px;
}

.section-title {
    text-align: center;
    font-size: 36px;
    margin-bottom: 40px;
    color: #333;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.category-card {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.category-card:hover {
    transform: translateY(-5px);
}

.category-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.category-card h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #333;
}

.category-card p {
    color: #666;
    margin-bottom: 20px;
}

.category-link {
    display: inline-block;
    background: #3498db;
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.category-link:hover {
    background: #2980b9;
}

/* 商品区域 */
.featured-products {
    margin-bottom: 60px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.product-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-image {
    height: 200px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-image img {
    transform: scale(1.1);
}

.product-info {
    padding: 20px;
}

.product-category {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.product-name {
    font-size: 18px;
    margin-bottom: 10px;
}

.product-name a {
    text-decoration: none;
    color: #333;
}

.product-description {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

.product-price {
    margin-bottom: 15px;
}

.current-price {
    font-size: 24px;
    font-weight: bold;
    color: #e74c3c;
}

.original-price {
    font-size: 16px;
    color: #999;
    text-decoration: line-through;
    margin-left: 10px;
}

.product-stats {
    display: flex;
    justify-content: space-between;
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.product-actions {
    display: flex;
    gap: 10px;
}

.view-btn, .add-to-cart-btn, .login-required {
    flex: 1;
    padding: 10px;
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.view-btn {
    background: #3498db;
    color: #fff;
}

.view-btn:hover {
    background: #2980b9;
}

.add-to-cart-btn {
    background: #e74c3c;
    color: #fff;
}

.add-to-cart-btn:hover {
    background: #c0392b;
}

.sold-out-btn {
    background: #95a5a6;
    color: #fff;
    cursor: not-allowed;
    opacity: 0.7;
}

.sold-out-btn:hover {
    background: #95a5a6;
    opacity: 0.7;
}

.login-required {
    background: #95a5a6;
    color: #fff;
}

.login-required:hover {
    background: #7f8c8d;
}

/* 筛选和搜索 */
.filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.search-box form {
    display: flex;
    gap: 10px;
}

.search-box input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 300px;
}

.search-btn {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

.sort-options select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
}

/* 购物车样式 */
.cart-container {
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.cart-container h1 {
    margin-bottom: 30px;
    color: #333;
}

.empty-cart {
    text-align: center;
    padding: 60px 20px;
}

.empty-cart p {
    font-size: 18px;
    color: #666;
    margin-bottom: 20px;
}

.cart-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cart-item {
    display: grid;
    grid-template-columns: 100px 2fr 1fr 1fr 1fr;
    gap: 20px;
    align-items: center;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
}

.item-image img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
}

.item-name a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
}

.item-price {
    font-weight: bold;
    color: #e74c3c;
}

.item-stock {
    color: #666;
    font-size: 14px;
}

.quantity-form {
    display: flex;
    align-items: center;
    gap: 5px;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 3px;
}

.quantity-input {
    width: 50px;
    height: 30px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.item-subtotal {
    font-weight: bold;
    color: #e74c3c;
}

.remove-btn {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.cart-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    height: fit-content;
}

.cart-summary h3 {
    margin-bottom: 20px;
    color: #333;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.summary-item.total {
    font-weight: bold;
    font-size: 18px;
    color: #e74c3c;
    border-bottom: none;
}

.cart-actions {
    margin-top: 20px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    margin-bottom: 10px;
    width: 100%;
}

.continue-shopping {
    background: #95a5a6;
    color: #fff;
}

.continue-shopping:hover {
    background: #7f8c8d;
}

.checkout-btn {
    background: #e74c3c;
    color: #fff;
}

.checkout-btn:hover {
    background: #c0392b;
}

.clear-cart-btn {
    background: #e67e22;
    color: #fff;
}

.clear-cart-btn:hover {
    background: #d35400;
}

/* 认证页面样式 */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-form {
    background: #fff;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 500px;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
}

.submit-btn {
    width: 100%;
    background: #e74c3c;
    color: #fff;
    padding: 15px;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.submit-btn:hover {
    background: #c0392b;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: #3498db;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* 消息样式 */
.success-message, .error-message {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.error-messages {
    margin-bottom: 20px;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

.page-link {
    padding: 10px 15px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    border-radius: 5px;
    transition: all 0.3s;
}

.page-link:hover {
    background: #f8f9fa;
}

.page-link.active {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

/* 页脚样式 */
.footer {
    background: #2c3e50;
    color: #fff;
    padding: 40px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    margin-bottom: 20px;
    color: #ecf0f1;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: #ecf0f1;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #34495e;
    color: #bdc3c7;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 20px;
    }
    
    .nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 20px;
    }
    
    .user-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero-content h2 {
        font-size: 32px;
    }
    
    .hero-content p {
        font-size: 16px;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .cart-content {
        grid-template-columns: 1fr;
    }
    
    .cart-item {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 15px;
    }
    
    .filters {
        flex-direction: column;
        gap: 20px;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .hero {
        padding: 40px 0;
    }
    
    .hero-content h2 {
        font-size: 24px;
    }
    
    .section-title {
        font-size: 28px;
    }
    
    .auth-form {
        padding: 20px;
    }
}
