/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif; background: #0f0f1a; color: #e0e0e0; min-height: 100vh; transition: background 0.3s, color 0.3s; }
body:not(.dark) { background: #f8f9fa; color: #1a1a2e; }

/* ===== 顶部导航栏 ===== */
.top-bar { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem 1.2rem; background: linear-gradient(135deg, #1a1a2e, #16213e); border-bottom: 1px solid rgba(212,175,55,0.3); position: sticky; top: 0; z-index: 100; }
body:not(.dark) .top-bar { background: #fff; border-bottom: 1px solid #e0e0e0; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.top-bar-left { display: flex; align-items: center; gap: 1rem; }
.back-link { color: #d4af37; text-decoration: none; font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 0.3rem; }
.back-link:hover { text-decoration: underline; }
.top-bar-right { display: flex; gap: 0.5rem; }
.icon-btn { background: rgba(212,175,55,0.1); border: 1px solid rgba(212,175,55,0.3); color: #d4af37; padding: 0.4rem 0.8rem; border-radius: 0.5rem; cursor: pointer; font-size: 0.85rem; font-weight: 600; transition: all 0.3s; display: flex; align-items: center; gap: 0.3rem; }
.icon-btn:hover { background: rgba(212,175,55,0.2); }
body:not(.dark) .icon-btn { background: #f0f0f0; border-color: #ddd; color: #5f4b8b; }

/* ===== 主容器 ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 1.2rem; }

/* ===== 产品主区域 ===== */
.product-main { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
@media (max-width: 768px) { .product-main { grid-template-columns: 1fr; gap: 1.2rem; } }

/* ===== 轮播图 ===== */
.carousel { position: relative; border-radius: 1rem; overflow: hidden; background: linear-gradient(135deg, #2d2d44, #1a1a2e); aspect-ratio: 1/1; }
body:not(.dark) .carousel { background: #f0f0f0; }
.carousel-track { display: flex; transition: transform 0.5s ease; height: 100%; }
.carousel-slide { min-width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 6rem; }
.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.5); color: #fff; border: none; width: 2.5rem; height: 2.5rem; border-radius: 50%; cursor: pointer; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; transition: all 0.3s; z-index: 10; }
.carousel-btn:hover { background: rgba(212,175,55,0.8); }
.carousel-prev { left: 0.8rem; }
.carousel-next { right: 0.8rem; }
.carousel-dots { position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; gap: 0.5rem; z-index: 10; }
.carousel-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: rgba(255,255,255,0.4); cursor: pointer; transition: all 0.3s; border: none; }
.carousel-dot.active { background: #d4af37; transform: scale(1.3); }

/* ===== 缩略图导航（豆腐块） ===== */
.carousel-thumbs { display: flex; gap: 0.5rem; margin-top: 0.8rem; overflow-x: auto; padding-bottom: 0.3rem; scrollbar-width: thin; }
.carousel-thumbs::-webkit-scrollbar { height: 4px; }
.carousel-thumbs::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.5); border-radius: 2px; }
.carousel-thumb { width: 4rem; height: 4rem; border-radius: 0.5rem; overflow: hidden; cursor: pointer; border: 2px solid transparent; background: rgba(255,255,255,0.1); padding: 0; transition: all 0.3s; flex-shrink: 0; }
.carousel-thumb:hover { border-color: rgba(212,175,55,0.5); transform: translateY(-2px); }
.carousel-thumb.active { border-color: #d4af37; box-shadow: 0 0 0 2px rgba(212,175,55,0.3); }
.carousel-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
body:not(.dark) .carousel-thumb { background: #f0f0f0; }

/* ===== 产品信息区 ===== */
.product-info { display: flex; flex-direction: column; }
.product-name { font-size: 1.6rem; font-weight: 800; color: #fff; margin-bottom: 0.8rem; line-height: 1.4; }
body:not(.dark) .product-name { color: #1a1a2e; }
.product-price { font-size: 2.2rem; font-weight: 900; color: #d4af37; margin: 0.5rem 0 1.2rem; }
.product-price .original { font-size: 1rem; color: #888; text-decoration: line-through; margin-left: 0.8rem; font-weight: 400; }
.product-sales { font-size: 0.9rem; color: #e74c3c; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.3rem; }
body:not(.dark) .product-sales { color: #c0392b; }

/* ===== 变体选择 ===== */
.variant-section { margin-bottom: 1.2rem; }
.variant-label { font-size: 0.9rem; font-weight: 600; color: #aaa; margin-bottom: 0.5rem; }
body:not(.dark) .variant-label { color: #666; }
.variant-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.variant-btn { padding: 0.5rem 1rem; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.15); color: #ccc; border-radius: 0.5rem; cursor: pointer; font-size: 0.85rem; transition: all 0.3s; }
.variant-btn:hover { border-color: #d4af37; color: #d4af37; }
.variant-btn.active { background: rgba(212,175,55,0.15); border-color: #d4af37; color: #d4af37; font-weight: 600; }
body:not(.dark) .variant-btn { background: #f8f8f8; border-color: #ddd; color: #555; }
body:not(.dark) .variant-btn.active { background: rgba(95,75,139,0.1); border-color: #5f4b8b; color: #5f4b8b; }

/* ===== 数量选择 ===== */
.quantity-section { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.quantity-control { display: flex; align-items: center; border: 1px solid rgba(255,255,255,0.15); border-radius: 0.5rem; overflow: hidden; }
body:not(.dark) .quantity-control { border-color: #ddd; }
.quantity-btn { background: rgba(255,255,255,0.05); border: none; color: #fff; width: 2.2rem; height: 2.2rem; cursor: pointer; font-size: 1rem; transition: all 0.3s; }
.quantity-btn:hover { background: rgba(212,175,55,0.2); color: #d4af37; }
body:not(.dark) .quantity-btn { background: #f8f8f8; color: #333; }
.quantity-input { width: 3rem; text-align: center; background: transparent; border: none; color: #fff; font-size: 1rem; font-weight: 600; }
body:not(.dark) .quantity-input { color: #333; }

/* ===== 购买按钮 ===== */
.buy-btn { display: block; width: 100%; padding: 1rem; background: linear-gradient(135deg, #5f4b8b, #7b5fb0); color: #fff; border: none; border-radius: 0.8rem; font-size: 1.1rem; font-weight: 700; cursor: pointer; text-align: center; text-decoration: none; transition: all 0.3s; margin-bottom: 0.8rem; }
.buy-btn:hover { opacity: 0.9; transform: scale(1.02); box-shadow: 0 8px 24px rgba(95,75,139,0.4); }
.buy-btn.coming-soon { background: linear-gradient(135deg, #555, #666); cursor: not-allowed; }

/* ===== 发货信息 ===== */
.shipping-info { background: rgba(95,75,139,0.15); padding: 1rem; border-radius: 0.8rem; font-size: 0.8rem; color: #999; line-height: 1.8; border-left: 3px solid #5f4b8b; }
body:not(.dark) .shipping-info { background: rgba(95,75,139,0.05); color: #666; }

/* ===== 标签页 ===== */
.tabs { margin-bottom: 2rem; }
.tab-header { display: flex; border-bottom: 2px solid rgba(255,255,255,0.1); margin-bottom: 1.2rem; }
body:not(.dark) .tab-header { border-bottom-color: #e0e0e0; }
.tab-btn { background: transparent; border: none; color: #888; padding: 0.8rem 1.5rem; cursor: pointer; font-size: 0.95rem; font-weight: 600; transition: all 0.3s; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab-btn.active { color: #d4af37; border-bottom-color: #d4af37; }
body:not(.dark) .tab-btn.active { color: #5f4b8b; border-bottom-color: #5f4b8b; }
.tab-content { display: none; line-height: 1.8; color: #bbb; font-size: 0.95rem; }
body:not(.dark) .tab-content { color: #444; }
.tab-content.active { display: block; }
.spec-table { width: 100%; border-collapse: collapse; }
.spec-table td { padding: 0.6rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.08); }
body:not(.dark) .spec-table td { border-bottom-color: #eee; }
.spec-table td:first-child { color: #888; width: 35%; font-weight: 600; }

/* ===== 相关产品 ===== */
.related-title { font-size: 1.3rem; font-weight: 800; color: #fff; margin-bottom: 1.2rem; }
body:not(.dark) .related-title { color: #1a1a2e; }
.related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
@media (max-width: 768px) { .related-grid { grid-template-columns: repeat(2, 1fr); } }

/* ===== 移动端全面优化 ===== */
@media (max-width: 768px) {
    .product-main { padding: 1rem; gap: 1rem; }
    
    .product-gallery { gap: 0.6rem; }
    
    .main-image { border-radius: 0.8rem; }
    
    .thumbnails { gap: 0.4rem; }
    
    .thumbnail { width: 50px; height: 50px; border-radius: 0.4rem; }
    
    .product-info { padding: 0; }
    
    .product-name { font-size: 1.3rem; line-height: 1.4; }
    
    .product-price-row { flex-wrap: wrap; gap: 0.5rem; }
    
    .product-price { font-size: 1.6rem; }
    
    .product-original { font-size: 0.95rem; }
    
    .product-sales { font-size: 0.85rem; }
    
    .variant-section { margin-bottom: 1rem; }
    
    .variant-label { font-size: 0.95rem; margin-bottom: 0.5rem; }
    
    .variant-options { gap: 0.5rem; }
    
    .variant-option { padding: 0.6rem 1rem; font-size: 0.9rem; border-radius: 0.5rem; min-height: 44px; display: flex; align-items: center; justify-content: center; }
    
    .quantity-section { margin-bottom: 1rem; }
    
    .quantity-label { font-size: 0.95rem; margin-bottom: 0.5rem; }
    
    .quantity-controls { gap: 0.5rem; }
    
    .quantity-btn { width: 44px; height: 44px; font-size: 1.3rem; border-radius: 0.5rem; }
    
    .quantity-input { width: 3.5rem; font-size: 1.1rem; height: 44px; }
    
    .buy-btn { padding: 1.1rem; font-size: 1.15rem; border-radius: 0.8rem; min-height: 52px; margin-bottom: 1rem; }
    
    .shipping-info { font-size: 0.85rem; line-height: 1.8; padding: 0.8rem; border-radius: 0.5rem; }
    
    .tabs { margin-top: 1.5rem; }
    
    .tab-header { gap: 0.3rem; overflow-x: auto; padding-bottom: 0.3rem; }
    
    .tab-btn { padding: 0.7rem 1rem; font-size: 0.9rem; white-space: nowrap; min-height: 44px; display: flex; align-items: center; }
    
    .tab-content { padding: 1rem 0; font-size: 0.95rem; line-height: 1.8; }
    
    .specs-table { font-size: 0.9rem; }
    
    .specs-table td { padding: 0.6rem 0.5rem; }
    
    .related-title { font-size: 1.15rem; margin-bottom: 1rem; }
    
    .related-info { padding: 0.6rem; }
    
    .related-name { font-size: 0.8rem; min-height: 2em; }
    
    .related-price { font-size: 0.95rem; }
    
    .back-link { font-size: 0.9rem; padding: 0.8rem 0; }
}
.related-card { background: linear-gradient(135deg, #1e1e35, #16162a); border-radius: 0.8rem; overflow: hidden; border: 1px solid rgba(212,175,55,0.15); cursor: pointer; transition: all 0.3s; text-decoration: none; }
.related-card:hover { transform: translateY(-4px); border-color: rgba(212,175,55,0.5); }
body:not(.dark) .related-card { background: #fff; border-color: #eee; }
.related-image { width: 100%; aspect-ratio: 1/1; background: linear-gradient(135deg, #2d2d44, #1a1a2e); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; }
body:not(.dark) .related-image { background: #f0f0f0; }
.related-info { padding: 0.8rem; }
.related-name { font-size: 0.85rem; font-weight: 600; color: #fff; margin-bottom: 0.3rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; }
body:not(.dark) .related-name { color: #333; }
.related-price { font-size: 1rem; font-weight: 800; color: #d4af37; }

/* ===== 页脚 ===== */
.footer { text-align: center; padding: 1.5rem; color: #666; font-size: 0.8rem; border-top: 1px solid #2a2a40; }
body:not(.dark) .footer { border-top-color: #e0e0e0; color: #999; }

/* ===== 加载状态 ===== */
.loading { text-align: center; padding: 3rem; color: #999; font-size: 1.1rem; }

/* 購物車角標增強 */
.cart-badge {
    background: #e74c3c !important;
    color: #fff !important;
    font-size: 0.8rem !important;
    font-weight: 900 !important;
    min-width: 22px !important;
    height: 22px !important;
    line-height: 22px !important;
    border: 2px solid #fff !important;
    box-shadow: 0 0 6px rgba(231,76,60,0.7) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
