/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #2a7d8c 0%, #1a5a6c 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2.5rem;
    color: #ffcc00;
}

.logo-text h1 {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
}

.logo-text p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 5px;
}

.cart-icon {
    position: relative;
    font-size: 1.8rem;
    cursor: pointer;
    transition: transform 0.3s;
}

.cart-icon:hover {
    transform: scale(1.1);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

/* 导航栏样式 */
nav {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 15px 0;
    margin-bottom: 30px;
}

.nav-links {
    display: flex;
    justify-content: center;
    list-style: none;
    gap: 40px;
}

.nav-links a {
    text-decoration: none;
    color: #555;
    font-weight: 600;
    font-size: 1.1rem;
    transition: color 0.3s;
    padding-bottom: 5px;
    border-bottom: 3px solid transparent;
}

.nav-links a:hover, .nav-links a.active {
    color: #2a7d8c;
    border-bottom: 3px solid #2a7d8c;
}

/* 商品网格样式 */
.products-header {
    text-align: center;
    margin-bottom: 40px;
}

.products-header h2 {
    font-size: 2.2rem;
    color: #2a7d8c;
    margin-bottom: 15px;
}

.products-header p {
    color: #666;
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.product-img {
    height: 220px;
    overflow: hidden;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

.product-info {
    padding: 20px;
}

.product-info h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #333;
    height: 3.6rem;
    overflow: hidden;
}

.product-price {
    color: #ff4757;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.product-rating {
    color: #ffcc00;
    margin-bottom: 15px;
}

.product-stock {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.product-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-detail, .btn-buy {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    font-size: 1rem;
}

.btn-detail {
    background: #f1f8ff;
    color: #2a7d8c;
    border: 1px solid #2a7d8c;
}

.btn-detail:hover {
    background: #2a7d8c;
    color: white;
}

.btn-buy {
    background: linear-gradient(to right, #2a7d8c, #1a5a6c);
    color: white;
}

.btn-buy:hover {
    background: linear-gradient(to right, #237181, #164a5a);
    box-shadow: 0 5px 15px rgba(42, 125, 140, 0.3);
}

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

/* 商品详情页样式 */
.product-detail-page {
    display: none;
    padding: 30px 0;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.detail-container {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.detail-img {
    flex: 1;
    min-width: 300px;
    max-width: 500px;
    border-radius: 10px;
    overflow: hidden;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-img img {
    width: 100%;
    height: auto;
    display: block;
}

.detail-info {
    flex: 1;
    min-width: 300px;
}

.detail-info h2 {
    font-size: 2rem;
    color: #2a7d8c;
    margin-bottom: 15px;
}

.detail-price {
    font-size: 2rem;
    color: #ff4757;
    font-weight: 700;
    margin: 20px 0;
}

.detail-rating {
    color: #ffcc00;
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.detail-stock {
    color: #666;
    font-size: 1rem;
    margin-bottom: 20px;
}

.detail-description {
    margin-bottom: 30px;
    line-height: 1.8;
    color: #555;
    font-size: 1.1rem;
}

.detail-actions {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.btn-back {
    background: #f8f9fa;
    color: #555;
    border: 1px solid #ddd;
    padding: 12px 30px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-back:hover {
    background: #e9ecef;
}

.btn-add-to-cart {
    background: linear-gradient(to right, #2a7d8c, #1a5a6c);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-add-to-cart:hover {
    background: linear-gradient(to right, #237181, #164a5a);
    box-shadow: 0 5px 15px rgba(42, 125, 140, 0.3);
}

.btn-add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 付款页样式 */
.checkout-page {
    display: none;
    padding: 30px 0;
    animation: fadeIn 0.5s;
}

.checkout-container {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
}

.checkout-form, .order-summary {
    flex: 1;
    min-width: 300px;
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.checkout-form h2, .order-summary h2 {
    color: #2a7d8c;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border 0.3s;
}

.form-group input:focus, .form-group select:focus {
    border-color: #2a7d8c;
    outline: none;
}

.payment-methods {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.payment-method {
    flex: 1;
    min-width: 120px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.payment-method:hover, .payment-method.active {
    border-color: #2a7d8c;
    background-color: #f1f8ff;
}

.payment-method i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #555;
}

.payment-method.active i {
    color: #2a7d8c;
}

.checkout-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.checkout-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.checkout-item-info {
    flex: 1;
    padding: 0 20px;
}

.checkout-item-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.checkout-total {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ff4757;
    text-align: right;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.btn-checkout {
    background: linear-gradient(to right, #2a7d8c, #1a5a6c);
    color: white;
    border: none;
    width: 100%;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 30px;
}

.btn-checkout:hover {
    background: linear-gradient(to right, #237181, #164a5a);
    box-shadow: 0 5px 20px rgba(42, 125, 140, 0.3);
}

/* 购物车侧边栏样式 */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    transition: right 0.4s ease;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

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

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.cart-header h3 {
    color: #2a7d8c;
    font-size: 1.5rem;
}

.close-cart {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #777;
    cursor: pointer;
    transition: color 0.3s;
}

.close-cart:hover {
    color: #ff4757;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 30px;
}

.cart-item {
    display: flex;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-item-info {
    flex: 1;
    padding: 0 15px;
}

.cart-item-title {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.cart-item-price {
    color: #ff4757;
    font-weight: 700;
    font-size: 0.9rem;
}

.cart-item-subtotal {
    color: #666;
    font-size: 0.85rem;
    margin-top: 3px;
}

.remove-item {
    background: none;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.remove-item:hover {
    background-color: #ffeaea;
}

.cart-total {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    text-align: right;
    margin-bottom: 20px;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.cart-overlay.active {
    display: block;
}

/* 页脚样式 */
footer {
    background: #1a1a1a;
    color: #ddd;
    padding: 50px 0 20px;
    margin-top: auto;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section {
    flex: 1;
    min-width: 250px;
}

.footer-section h3 {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2a7d8c;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #aaa;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #2a7d8c;
}

.social-icons {
    margin-top: 15px;
    font-size: 1.5rem;
}

.social-icons i {
    margin-right: 15px;
    cursor: pointer;
    transition: color 0.3s;
}

.social-icons i:hover {
    color: #2a7d8c;
}

.copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #333;
    color: #888;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .nav-links {
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .detail-container, .checkout-container {
        flex-direction: column;
    }
    
    .footer-content {
        flex-direction: column;
    }
    
    .cart-sidebar {
        width: 100%;
        max-width: 380px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 1002;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 300px;
}