/**
 * WooCommerce 自定义样式 - 完全模仿源网站设计
 *
 * @package Baske_Theme
 */

/* ========================================
   产品详情页样式
   ======================================== */

/* 面包屑导航 */
.breadcrumb a:hover {
    color: #333;
    text-decoration: underline;
}

/* 产品图片画廊 */
.product-gallery-wrapper {
    position: sticky;
    top: 20px;
    align-self: flex-start;
}

.product-main-image {
    position: relative;
    background: #f9f9f9;
    width: 100%;
    height: 600px;
    max-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 20px;
    border-radius: 8px;
}

.product-main-image img,
img.main-product-image,
#main-product-image {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 600px !important;
    display: block !important;
    object-fit: contain !important;
    margin: 0 auto !important;
}

/* 强制覆盖WordPress自动添加的尺寸 */
.product-main-image img[width],
.product-main-image img[height] {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 600px !important;
}

/* 桌面端/移动端显示控制 */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

/* 缩略图画廊 - 桌面端横向滑动 */
.product-thumbnails {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 10px;
}

.thumbnail-item {
    flex: 0 0 auto;
    width: 100px;
    height: 100px;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    background: #f9f9f9;
    scroll-snap-align: start;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumbnail-item.active {
    border-color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.thumbnail-item:hover {
    transform: scale(1.05);
    border-color: #666 !important;
}

/* 美化滚动条 - 桌面端 */
.product-thumbnails::-webkit-scrollbar {
    height: 8px;
}

.product-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.product-thumbnails::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.product-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 移动端滑动画廊 */
.product-gallery-mobile {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.gallery-slider {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.gallery-slider::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

.gallery-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    border-radius: 8px;
    scroll-snap-align: start;
    overflow: hidden;
}

.gallery-slide img {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
}

/* 指示器圆点 */
.gallery-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
    transition: all 0.3s ease;
    cursor: pointer;
}

.indicator-dot.active {
    background: #333;
    width: 24px;
    border-radius: 4px;
}

/* 产品标题 */
.product_title {
    line-height: 1.3;
}

/* 价格显示 */
.product-price {
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}

.product-price .price {
    display: block;
}

.product-price .woocommerce-Price-amount {
    font-size: 32px;
    font-weight: 700;
    color: #333;
}

.product-price del .woocommerce-Price-amount {
    font-size: 24px;
    color: #999;
}

.product-price ins .woocommerce-Price-amount {
    color: #e74c3c;
}

/* 数量选择器 */
.quantity {
    position: relative;
}

.quantity input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    transition: border-color 0.3s;
}

.quantity input[type="number"]:focus {
    outline: none;
    border-color: #333;
}

.quantity input[type="number"]::-webkit-inner-spin-button,
.quantity input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 添加到购物车按钮 */
.single_add_to_cart_button {
    background: var(--primary-color, #333);
    color: white;
    transition: all 0.3s ease;
}

.single_add_to_cart_button:hover {
    background: var(--primary-hover-color, #000);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.single_add_to_cart_button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 立即购买按钮 */
.buy-now-button {
    background: #333;
    color: white;
    transition: all 0.3s ease;
}

.buy-now-button:hover {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 产品简介 */
.product-short-description p {
    margin-bottom: 10px;
}

.product-short-description ul {
    list-style: disc;
    padding-left: 20px;
}

/* 产品标签 */
.product-tabs {
    margin-top: 80px;
}

.tabs-navigation {
    display: flex;
    gap: 40px;
    border-bottom: 2px solid #eee;
}

.tab-link {
    position: relative;
    padding: 20px 0;
    font-size: 16px;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-link.active {
    color: #333;
    border-bottom: 3px solid #333;
}

.tab-link:not(.active) {
    color: #999;
}

.tab-link:hover {
    color: #333;
}

/* 详细信息 */
.product-details {
    font-size: 14px;
    line-height: 2;
}

.detail-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}

.detail-item:last-child {
    border-bottom: none;
}

/* 完整描述 */
.product-full-description h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.product-full-description p {
    margin-bottom: 15px;
    line-height: 1.8;
}

.product-full-description ul,
.product-full-description ol {
    padding-left: 20px;
    margin-bottom: 15px;
}

/* 评论区 */
.commentlist {
    list-style: none;
    padding: 0;
}

.comment {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.comment:last-child {
    border-bottom: none;
}

.comment-text {
    margin-left: 80px;
}

.comment-author {
    font-weight: 600;
    margin-bottom: 5px;
}

.comment-metadata {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
}

.comment-content p {
    margin-bottom: 10px;
    line-height: 1.6;
}

/* 星级评分 */
.star-rating {
    display: inline-block;
    color: #ffd700;
    font-size: 14px;
}

.star-rating:before {
    content: "★★★★★";
    letter-spacing: 3px;
    color: #ddd;
}

.star-rating span {
    position: absolute;
    overflow: hidden;
    color: #ffd700;
}

.star-rating span:before {
    content: "★★★★★";
    letter-spacing: 3px;
}

/* 相关产品 */
.related-products h2 {
    text-align: center;
    margin-bottom: 40px;
}

.related-products .product-item {
    transition: transform 0.3s;
}

.related-products .product-item:hover {
    transform: translateY(-5px);
}

.related-products .product-item:hover .product-image img {
    transform: scale(1.05);
}

.related-products .product-image {
    overflow: hidden;
    border-radius: 8px;
    background: #f9f9f9;
}

.related-products .product-image img {
    transition: transform 0.5s;
}

/* 变体选择 */
.product-variations select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s;
}

.product-variations select:focus {
    outline: none;
    border-color: #333;
}

.product-variations select:hover {
    border-color: #666;
}

/* ========================================
   商品列表页样式
   ======================================== */

/* 商品网格 */
.woocommerce .products {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.woocommerce .products .product {
    text-align: left;
    transition: transform 0.3s;
}

.woocommerce .products .product:hover {
    transform: translateY(-5px);
}

/* 商品图片 */
.woocommerce .products .product .attachment-woocommerce_thumbnail {
    width: 100%;
    height: auto;
    border-radius: 8px;
    transition: transform 0.5s;
}

.woocommerce .products .product:hover .attachment-woocommerce_thumbnail {
    transform: scale(1.05);
}

/* 商品标题 */
.woocommerce .products .woocommerce-loop-product__title {
    font-size: 16px;
    font-weight: 500;
    margin: 15px 0 10px;
    line-height: 1.4;
}

/* 商品价格 */
.woocommerce .products .price {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* 添加到购物车按钮（列表） */
.woocommerce .products .button {
    margin-top: 10px;
    padding: 10px 20px;
    background: #333;
    color: white;
    border-radius: 4px;
    transition: all 0.3s;
}

.woocommerce .products .button:hover {
    background: #000;
    transform: translateY(-2px);
}

/* ========================================
   购物车页面
   ======================================== */

.woocommerce-cart .cart_totals {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
}

.woocommerce-cart .cart-collaterals .cart_totals h2 {
    margin-bottom: 20px;
    font-size: 24px;
}

/* ========================================
   结账页面
   ======================================== */

.woocommerce-checkout .woocommerce-billing-fields h3,
.woocommerce-checkout .woocommerce-shipping-fields h3 {
    font-size: 20px;
    margin-bottom: 20px;
}

.woocommerce-checkout input[type="text"],
.woocommerce-checkout input[type="email"],
.woocommerce-checkout input[type="tel"],
.woocommerce-checkout select,
.woocommerce-checkout textarea {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s;
}

.woocommerce-checkout input:focus,
.woocommerce-checkout select:focus,
.woocommerce-checkout textarea:focus {
    outline: none;
    border-color: #333;
}

/* ========================================
   响应式设计
   ======================================== */

@media (max-width: 1200px) {
    .woocommerce .products {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    /* 产品详情页 */
    .product-main {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }

    .product-gallery-wrapper {
        position: static;
    }

    /* 产品主图在移动端优化 */
    .product-main-image {
        height: 400px !important;
        max-height: 400px !important;
        margin-bottom: 15px !important;
    }
    
    .product-main-image img,
    img.main-product-image,
    #main-product-image {
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 400px !important;
        object-fit: contain !important;
        margin: 0 auto !important;
    }
    
    /* 移动端强制覆盖WordPress尺寸 */
    .product-main-image img[width],
    .product-main-image img[height] {
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 400px !important;
    }

    /* 移动端显示/隐藏控制 */
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
    
    /* 确保缩略图在移动端完全隐藏 - 使用多重选择器 */
    .product-images .product-thumbnails,
    .product-thumbnails.desktop-only,
    .product-thumbnails.hide-on-mobile,
    div.product-thumbnails,
    .thumbnail-item {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        opacity: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    /* 确保桌面端主图在移动端隐藏 */
    .product-main-image.desktop-only,
    .product-images .product-main-image.desktop-only {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
        opacity: 0 !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    /* 移动端滑动画廊高度调整 */
    .gallery-slide {
        height: 400px !important;
    }

    .product_title {
        font-size: 24px !important;
    }

    .product-price .woocommerce-Price-amount {
        font-size: 24px !important;
    }

    .product-details {
        grid-template-columns: 1fr !important;
    }

    .tabs-navigation {
        gap: 20px !important;
        overflow-x: auto;
    }

    /* 商品列表 - 强制2列 */
    .woocommerce .products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px;
    }

    /* 相关产品 */
    .related-products .products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    /* 移动端也强制2列，不是1列！ */
    .woocommerce .products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }

    /* 小屏手机也是横向滑动 */
    /* 小屏手机滑动画廊高度 */
    .gallery-slide {
        height: 350px !important;
    }
    
    .gallery-indicators {
        margin-top: 12px !important;
    }
    
    .indicator-dot {
        width: 6px !important;
        height: 6px !important;
    }
    
    .indicator-dot.active {
        width: 20px !important;
    }

    .tabs-navigation {
        gap: 15px !important;
    }

    .tab-link {
        font-size: 14px;
        padding: 15px 0;
    }
    
    /* 小屏幕价格字体进一步减小 */
    .product-price .woocommerce-Price-amount {
        font-size: 22px !important;
    }
}

/* ========================================
   加载动画
   ======================================== */

.woocommerce .blockUI.blockOverlay {
    background: rgba(255, 255, 255, 0.8) !important;
}

.woocommerce .loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #333;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   通知消息
   ======================================== */

.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    border-left: 4px solid;
}

.woocommerce-message {
    background: #f0fdf4;
    border-color: #10b981;
    color: #065f46;
}

.woocommerce-info {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

.woocommerce-error {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

/* ========================================
   空状态
   ======================================== */

.woocommerce-info.woocommerce-no-products-found {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

