/*
Theme Name: Astra Child
Template: astra
Version: 2.0.0
*/

/* ============================================
   京东风格商品详情页 - JD Style Product Page
   ============================================ */

/* 清理旧样式，从零开始 */
.single-product .woocommerce-product-gallery {
    margin-bottom: 0;
}

/* ============================================
   整体布局：左图右信息（京东经典两列）
   ============================================ */

.single-product div.product {
    display: flex;
    gap: 0;
}

.single-product .woocommerce-product-gallery {
    width: 50%;
    flex: 0 0 50%;
    order: 1;
    padding-right: 30px;
    box-sizing: border-box;
}

.single-product div.product .summary.entry-summary {
    width: 50%;
    flex: 0 0 50%;
    order: 2;
    padding-left: 20px;
    box-sizing: border-box;
    border-left: 1px solid #eee;
    padding-left: 30px;
}

/* ============================================
   左侧：图片画廊（京东风格）
   - 竖排缩略图 + 主图
   ============================================ */

.jd-gallery-container {
    display: flex;
    gap: 12px;
}

/* 左侧竖排缩略图列 */
.jd-thumbnails {
    width: 64px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.jd-thumbnails::-webkit-scrollbar {
    width: 4px;
}
.jd-thumbnails::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.jd-thumb {
    width: 60px;
    height: 60px;
    border: 2px solid #e5e5e5;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.jd-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.jd-thumb:hover {
    border-color: #e2231a;
}

.jd-thumb.active {
    border-color: #e2231a;
    box-shadow: 0 0 0 2px rgba(226, 35, 26, 0.2);
}

/* 主图区域 */
.jd-main-image {
    flex: 1;
    position: relative;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f8f8;
    aspect-ratio: 1 / 1;
}

.jd-main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

/* 主图切换箭头 */
.jd-main-image .jd-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.jd-main-image .jd-nav-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.jd-main-image .jd-prev {
    left: 10px;
}

.jd-main-image .jd-next {
    right: 10px;
}

/* ============================================
   右侧：商品信息区（京东风格）
   ============================================ */

/* 商品标题 */
.single-product .product_title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

/* 价格区 - 京东红色风格 */
.jd-price-section {
    background: #fff5f5;
    border: 1px solid #ffe0e0;
    border-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.jd-price-section .price {
    font-size: 14px;
    color: #999;
    margin: 0;
}

.jd-price-section .price .woocommerce-Price-amount,
.jd-price-section .price .woocommerce-Price-currency-symbol {
    color: #e2231a;
    font-size: 28px;
    font-weight: 700;
}

.jd-price-section .price del {
    color: #999;
    font-size: 14px;
    margin-left: 8px;
}

/* 评分/评价 */
.jd-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #666;
}

.jd-rating .star-rating {
    font-size: 16px;
}

.jd-rating a {
    color: #666;
}

/* 商品短描述 */
.jd-short-desc {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
    padding: 12px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

/* SKU/变体选择 */
.single-product table.variations {
    width: 100%;
    border: none;
    margin-bottom: 20px;
}

.single-product table.variations td {
    border: none;
    padding: 8px 0;
}

.single-product table.variations label {
    font-weight: 600;
    color: #333;
}

.single-product table.variations select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
    max-width: 300px;
    font-size: 14px;
}

/* 数量选择 */
.single-product form.cart .quantity {
    display: inline-block;
    margin-right: 12px;
}

.single-product form.cart .quantity input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 80px;
    text-align: center;
    font-size: 14px;
}

/* ============================================
   操作按钮区（京东风格：红底白字大按钮）
   ============================================ */

.single-product form.cart {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.single-product form.cart .single_add_to_cart_button {
    background: #e2231a;
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 180px;
    text-align: center;
}

.single-product form.cart .single_add_to_cart_button:hover {
    background: #c81623;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(226, 35, 26, 0.3);
}

.single-product form.cart .single_add_to_cart_button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 立即购买按钮（如果有） */
.single-product form.cart button.checkout-button,
.single-product form.cart a.checkout-button {
    background: #ff6600;
    color: white;
    border: none;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.single-product form.cart button.checkout-button:hover,
.single-product form.cart a.checkout-button:hover {
    background: #e55a00;
}

/* 商品元信息 */
.single-product .product_meta {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    font-size: 13px;
    color: #999;
}

.single-product .product_meta span {
    display: block;
    margin-bottom: 4px;
}

.single-product .product_meta a {
    color: #666;
}

/* ============================================
   Tab 区域（商品详情、评价等）
   ============================================ */

.woocommerce-tabs {
    margin-top: 40px;
    clear: both;
}

.woocommerce-tabs ul.tabs {
    display: flex;
    gap: 0;
    padding: 0;
    margin: 0;
    list-style: none;
    border-bottom: 2px solid #e2231a;
}

.woocommerce-tabs ul.tabs li {
    margin: 0;
    padding: 0;
}

.woocommerce-tabs ul.tabs li a {
    display: block;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 500;
    color: #666;
    text-decoration: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.woocommerce-tabs ul.tabs li.active a,
.woocommerce-tabs ul.tabs li a:hover {
    color: #e2231a;
    border-bottom-color: #e2231a;
}

.woocommerce-tabs .woocommerce-Tabs-panel {
    padding: 24px 0;
}

/* ============================================
   响应式适配
   ============================================ */

@media (max-width: 768px) {
    /* 移动端：图片在上，信息在下，垂直排列 */
    .single-product div.product {
        display: block;
    }

    .single-product .woocommerce-product-gallery {
        width: 100%;
        padding-right: 0;
        margin-bottom: 20px;
    }

    .single-product div.product .summary.entry-summary {
        width: 100%;
        padding-left: 0;
        border-left: none;
    }

    /* 移动端：缩略图改为横向排列 */
    .jd-gallery-container {
        flex-direction: column-reverse;
    }

    .jd-thumbnails {
        width: 100%;
        max-height: none;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 8px;
    }

    .jd-thumbnails::-webkit-scrollbar {
        height: 4px;
    }

    .jd-thumb {
        width: 56px;
        height: 56px;
        flex-shrink: 0;
    }

    .single-product .product_title {
        font-size: 18px;
    }

    .jd-price-section .price .woocommerce-Price-amount,
    .jd-price-section .price .woocommerce-Price-currency-symbol {
        font-size: 24px;
    }

    .single-product form.cart {
        flex-direction: column;
        align-items: stretch;
    }

    .single-product form.cart .single_add_to_cart_button {
        width: 100%;
        padding: 16px;
        font-size: 18px;
    }
}

/* ============================================
   隐藏旧的不需要的元素
   ============================================ */

.single-product .woocommerce-product-gallery__trigger,
.single-product .flex-control-nav,
.single-product .flex-control-thumbs {
    display: none !important;
}
