* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
}

body {
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 100%;
    overflow-x: hidden;
    padding-bottom: 70px; /* 为底部导航留出空间 */
}

/* 隐藏不需要的页面 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #1a73e8 0%, #6c8ef5 100%);
    color: white;
    padding: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.logo {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 1.2rem;
    cursor: pointer;
}

.logo i {
    margin-right: 8px;
    font-size: 1.5rem;
}

/* 购物车图标样式 */
.cart-header-icon {
    position: relative;
    font-size: 1.2rem;
    cursor: pointer;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e53935;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-img {
    height: 150px;
    background-color: #f8f9fa;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    opacity: 0;
}

.product-img.loaded {
    opacity: 1;
}

.product-img:hover {
    transform: scale(1.05);
}

.product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
    height: 40px;
    overflow: hidden;
    line-height: 1.4;
}

.product-price {
    color: #e53935;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.add-to-cart {
    background: #1a73e8;
    color: white;
    border: none;
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.3s;
    margin-top: auto;
}

.add-to-cart:hover {
    background: #0d62d9;
}

/* 商品详情页面样式 - 修改布局 */
.product-detail-page {
    background: white;
    min-height: calc(100vh - 60px);
}

.product-detail-container {
    display: flex;
    flex-direction: column;
    padding: 20px;
}

@media (min-width: 768px) {
    .product-detail-container {
        flex-direction: row;
        gap: 30px;
    }
}

.product-detail-left {
    flex: 1;
}

.product-detail-image {
    height: 300px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: opacity 0.5s ease-in-out, transform 0.3s ease-in-out;
    opacity: 0;
    position: relative;
    overflow: hidden;
}

.product-detail-image.loaded {
    opacity: 1;
}

.product-detail-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f0f0f0 75%), 
                linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    animation: loading 1s linear infinite;
    opacity: 0.3;
}

.product-detail-image.loaded::before {
    display: none;
}

@keyframes loading {
    0% {
        background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    }
    100% {
        background-position: 20px 0, 20px 10px, 30px -10px, 10px 0px;
    }
}

.product-detail-right {
    flex: 1;
}

/* 价格信息区域 - 在图片右侧 */
.price-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid #eee;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.product-detail-name {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.4;
    color: #333;
}

.price-info {
    margin-bottom: 20px;
}

.current-price {
    font-size: 2.2rem;
    font-weight: 800;
    color: #e53935;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.current-price .yuan {
    font-size: 1.8rem;
    font-weight: 700;
    margin-right: 5px;
}

.product-detail-specs {
    margin-top: 30px;
}

.specs-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #1a73e8;
    display: inline-block;
    color: #333;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.specs-table tr {
    border-bottom: 1px solid #eee;
}

.specs-table tr:nth-child(even) {
    background: #f9f9f9;
}

.specs-table tr:hover {
    background: #f0f7ff;
}

.specs-table td {
    padding: 15px;
}

.specs-table td:first-child {
    color: #666;
    width: 40%;
    font-weight: 500;
    border-right: 1px solid #eee;
}

.specs-table td:last-child {
    color: #333;
    font-weight: 500;
}

.product-actions {
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    background: white;
    padding: 15px;
    border-top: 1px solid #eee;
    z-index: 99;
    display: flex;
    gap: 10px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.buy-now-btn {
    flex: 1;
    background: #e53935;
    color: white;
    border: none;
    padding: 18px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.3);
}

.buy-now-btn:hover {
    background: #c62828;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(229, 57, 53, 0.4);
}

.add-to-cart-detail {
    flex: 1;
    background: #1a73e8;
    color: white;
    border: none;
    padding: 18px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

.add-to-cart-detail:hover {
    background: #0d62d9;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(26, 115, 232, 0.4);
}

.action-icon {
    font-size: 1.2rem;
}

/* 购物车页面样式 */
.cart-header {
    background: white;
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.cart-clear {
    color: #e53935;
    background: none;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
}

.cart-items {
    padding: 15px;
}

.cart-item {
    display: flex;
    background: white;
    border-radius: 12px;
    margin-bottom: 15px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    align-items: center;
}

.cart-item-img {
    width: 80px;
    height: 80px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    margin-right: 15px;
    border-radius: 8px;
    background-color: #f8f9fa;
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
    position: relative;
    overflow: hidden;
}

.cart-item-img.loaded {
    opacity: 1;
}

.cart-item-img::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f0f0f0 75%), 
                linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
    animation: loading 1s linear infinite;
    opacity: 0.3;
}

.cart-item-img.loaded::before {
    display: none;
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.cart-item-price {
    color: #e53935;
    font-weight: 700;
    font-size: 1rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.quantity-input {
    width: 40px;
    text-align: center;
    border: none;
    margin: 0 10px;
    font-size: 1rem;
}

.cart-item-remove {
    color: #e53935;
    background: none;
    border: none;
    margin-left: 15px;
    cursor: pointer;
}

.cart-footer {
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    background: white;
    padding: 15px;
    border-top: 1px solid #eee;
    z-index: 99;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.total-label {
    font-size: 1rem;
    color: #666;
}

.total-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e53935;
}

.checkout-btn {
    background: #1a73e8;
    color: white;
    border: none;
    width: 100%;
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.checkout-btn:hover {
    background: #0d62d9;
}

/* 支付页面样式 */
.payment-page {
    padding: 15px;
    background: white;
    min-height: calc(100vh - 120px);
}

.payment-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.order-summary {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.order-summary h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.order-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.order-total {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    font-weight: 700;
    font-size: 1.2rem;
}

.payment-methods {
    margin-bottom: 30px;
}

.payment-method {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #eee;
    border-radius: 12px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.payment-method.active {
    border-color: #1a73e8;
    background: #f0f7ff;
}

.payment-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1.5rem;
    color: white;
}

.alipay {
    background: #009fe8;
}

.wechatpay {
    background: #07c160;
}

.payment-info {
    flex: 1;
}

.payment-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.payment-desc {
    font-size: 0.85rem;
    color: #666;
}

.pay-now-btn {
    background: #1a73e8;
    color: white;
    border: none;
    width: 100%;
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.pay-now-btn:hover {
    background: #0d62d9;
}

/* 支付处理页面 */
.payment-processing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    background: white;
    min-height: calc(100vh - 120px);
}

.processing-icon {
    width: 80px;
    height: 80px;
    background: #1a73e8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 2.5rem;
    color: white;
}

.processing-icon .fa-spinner {
    animation: spin 2s linear infinite;
}

.processing-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.processing-desc {
    color: #666;
    margin-bottom: 30px;
    max-width: 300px;
}

/* 支付结果页面 */
.payment-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    background: white;
    min-height: calc(100vh - 120px);
}

.result-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 2.5rem;
    color: white;
}

.success-icon {
    background: #4caf50;
}

.failure-icon {
    background: #e53935;
}

.result-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.result-desc {
    color: #666;
    margin-bottom: 30px;
    max-width: 300px;
}

.order-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    max-width: 350px;
    width: 100%;
    border: 1px solid #eee;
}

.order-info h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
    text-align: center;
}

.order-details {
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.6;
}

.order-details p {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.order-details span.label {
    color: #666;
    min-width: 80px;
}

.order-details span.value {
    color: #333;
    font-weight: 500;
    text-align: right;
    flex: 1;
}

.continue-shopping {
    background: #1a73e8;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
}

/* 产品区域 */
.products-section {
    padding-top: 15px;
}

.products {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 0 15px 15px;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    border-top: 1px solid #eee;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #666;
    text-decoration: none;
    font-size: 0.8rem;
    padding: 5px;
    cursor: pointer;
}

.nav-item.active {
    color: #1a73e8;
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

/* 响应式调整 */
@media (min-width: 768px) {
    .container {
        max-width: 768px;
        margin: 0 auto;
    }
    
    .products {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .product-detail-image {
        height: 400px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    text-align: center;
    font-weight: 600;
    font-size: 1.2rem;
}

.modal-body {
    padding: 20px;
    text-align: center;
}

.modal-footer {
    padding: 20px;
    display: flex;
    gap: 10px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.modal-btn.cancel {
    background: #f5f5f5;
    color: #333;
}

.modal-btn.confirm {
    background: #1a73e8;
    color: white;
}

/* 返回按钮 */
.back-button {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #333;
    cursor: pointer;
    margin-right: 10px;
}

.page-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border-bottom: 1px solid #eee;
}

.page-title {
    font-size: 1.2rem;
    font-weight: 600;
}

/* 隐藏支付宝表单 */
.alipay-form {
    display: none;
}

/* 通知样式 */
@keyframes slideDown {
    from { top: -100px; opacity: 0; }
    to { top: 20px; opacity: 1; }
}

@keyframes slideUp {
    from { top: 20px; opacity: 1; }
    to { top: -100px; opacity: 0; }
}

/* 加载动画增强 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 按钮悬停效果增强 */
button {
    transition: all 0.3s ease;
}

button:hover {
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

/* 卡片交互效果 */
.product-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 骨架屏效果 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

/* 加载状态指示器 */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1a73e8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

/* 空状态样式 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #666;
}

.empty-state i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #333;
}

.empty-state p {
    margin-bottom: 20px;
}

/* 成功/错误提示样式 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success {
    background: #4caf50;
    color: white;
}

.toast.error {
    background: #f44336;
    color: white;
}

.toast.info {
    background: #2196f3;
    color: white;
}

/* 响应式设计增强 */
@media (max-width: 480px) {
    .product-card {
        margin: 0 10px;
    }
    
    .products {
        padding: 0 10px;
        gap: 10px;
    }
    
    .product-title {
        font-size: 0.9rem;
    }
    
    .product-price {
        font-size: 1rem;
    }
    
    .add-to-cart {
        padding: 8px;
        font-size: 0.9rem;
    }
    
    .cart-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cart-item-img {
        width: 100%;
        height: 120px;
        margin-right: 0;
    }
    
    .cart-item-info {
        width: 100%;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    body {
        background-color: #000;
        color: #fff;
    }
    
    .product-card {
        background: #222;
        border: 1px solid #444;
    }
    
    .add-to-cart {
        background: #0066cc;
    }
    
    .add-to-cart:hover {
        background: #0052a3;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}