/*
 * Single Product Page — Layout, Gallery & Summary Styles
 * Extracted from functions.php (FIX 2.2) for browser caching.
 * Previously echoed inline via wp_head which blocked rendering on every product page.
 * Bump the version in functions.php enqueue call when making changes here.
 */

/* =========================================
   DESKTOP & TABLET (992px and up)
   ========================================= */
@media (min-width: 992px) {
    /* Grid Layout for Single Product page */
    .single-product div.product {
        display: grid !important;
        grid-template-columns: var(--ts-gallery-width, 60%) 1fr !important;
        column-gap: 40px !important;
        align-items: start !important;
    }

    /* Left Column: Gallery Parent */
    .single-product div.product .woocommerce-product-gallery {
        grid-column: 1 !important;
        grid-row: 1 !important;
        display: flex !important;
        flex-direction: row-reverse !important; /* Puts main image on right, thumbs on left */
        gap: 20px !important;
        align-items: flex-start !important;
        width: 100% !important;
        max-width: 650px !important; /* Slightly wider to accommodate side thumbs */
        margin: 0 auto 0 auto !important;
        padding: 0 !important;
        background: transparent !important;
    }

    /* Main Image Wrapper - Leaves room for vertical thumbnails */
    .single-product .woocommerce-product-gallery .flex-viewport,
    .single-product .woocommerce-product-gallery > .woocommerce-product-gallery__wrapper {
        width: calc(100% - 100px) !important;
        flex: 1 !important;
    }

    /* Vertical Thumbnail Layout Fixes */
    .single-product .woocommerce-product-gallery .flex-control-thumbs {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 80px !important;
        flex: 0 0 80px !important;
    }
    .single-product .woocommerce-product-gallery .flex-control-thumbs li {
        width: 100% !important;
        flex: 0 0 80px !important;
        float: none !important;
    }
    .single-product .woocommerce-product-gallery .flex-control-thumbs img {
        height: 80px !important;
    }

    /* Right Column: Sticky Summary */
    .single-product div.product div.summary {
        grid-column: 2 !important;
        grid-row: 1 / span 2 !important;
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 120px !important;
        margin: 0 !important;
        width: 100% !important;
        align-self: start !important;
    }

    /* Left Column: Tabs (Row 2) */
    .single-product div.product .woocommerce-tabs {
        grid-column: 1 !important;
        grid-row: 2 !important;
        width: 100% !important;
        padding: 40px 60px !important; /* Added 60px left/right padding for luxurious breathing room */
        margin-top: 20px !important;
    }

} /* END DESKTOP MEDIA QUERY */


/* =========================================
   GLOBAL (Mobile & Desktop)
   ========================================= */

/* --- Frequently Bought Together inside Summary --- */
.single-product .summary .ts-frequently-bought-together {
    margin-top: 30px !important;
    padding: 20px !important;
    background-color: #fdfbf7 !important; /* Premium cream background */
    border: 1px solid #e1d8cd !important; /* Elegant gold/bronze border */
    border-radius: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    float: none !important;
    clear: both !important;
}

.single-product .summary .ts-frequently-bought-together > h3 {
    font-size: 1.4rem !important;
    color: #a17838 !important; /* Premium brand gold */
    margin-top: 0 !important;
    margin-bottom: 15px !important;
    font-family: 'Playfair Display', serif !important;
    border-bottom: 1px solid #e1d8cd !important;
    padding-bottom: 8px !important;
    text-align: left !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

.single-product .summary .ts-fbt-form {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    width: 100% !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.single-product .summary .ts-fbt-form .items {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

.single-product .summary .ts-fbt-form .items .plus {
    display: none !important; /* Hide default plus divider */
}

.single-product .summary .ts-fbt-form .items .item {
    display: flex !important;
    flex-direction: row-reverse !important; /* Checkbox left, details right */
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 15px !important;
    width: 100% !important;
    padding: 12px 0 !important;
    border-bottom: 1px solid #e1d8cd !important;
    margin: 0 !important;
}

.single-product .summary .ts-fbt-form .items .item:last-child {
    border-bottom: none !important;
}

.single-product .summary .ts-fbt-form .items .item label {
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
}

.single-product .summary .ts-fbt-form .items .item label input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    accent-color: #a17838 !important;
    cursor: pointer !important;
    margin: 0 !important;
}

.single-product .summary .ts-fbt-form .items .item label span {
    display: none !important; /* Hide Select/Selected text */
}

.single-product .summary .ts-fbt-form .items .item .product-wrapper {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    flex: 1 !important;
}

.single-product .summary .ts-fbt-form .items .item .product-wrapper .thumbnail-wrapper {
    flex: 0 0 70px !important;
    width: 70px !important;
    height: 70px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.single-product .summary .ts-fbt-form .items .item .product-wrapper .thumbnail-wrapper img {
    width: 70px !important;
    height: 70px !important;
    object-fit: cover !important;
    border-radius: 6px !important;
}

.single-product .summary .ts-fbt-form .items .item .product-wrapper .meta-wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    flex: 1 !important;
    text-align: left !important;
}

.single-product .summary .ts-fbt-form .items .item .product-wrapper .meta-wrapper .product-name {
    font-size: 14px !important;
    line-height: 1.3 !important;
    font-weight: 500 !important;
    color: #333 !important;
    text-decoration: none !important;
    display: block !important;
}

.single-product .summary .ts-fbt-form .items .item .product-wrapper .meta-wrapper .price {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #a17838 !important;
    display: block !important;
}

.single-product .summary .ts-fbt-form .submit-wrapper {
    margin-top: 15px !important;
    padding-top: 15px !important;
    border-top: 1px solid #e1d8cd !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
    align-items: flex-start !important;
    text-align: left !important;
    background: transparent !important;
    border-width: 1px 0 0 0 !important;
}

.single-product .summary .ts-fbt-form .submit-wrapper h6 {
    font-size: 12px !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    margin: 0 0 4px 0 !important;
    color: #666 !important;
}

.single-product .summary .ts-fbt-form .submit-wrapper .total-price-label {
    font-size: 12px !important;
    color: #BB0925 !important;
    display: block !important;
}

.single-product .summary .ts-fbt-form .submit-wrapper .total-price {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #000 !important;
    display: block !important;
    margin-bottom: 8px !important;
}

.single-product .summary .ts-fbt-form .submit-wrapper button.button {
    background-color: #a17838 !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 20px !important;
    font-size: 14px !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    font-weight: 600 !important;
    border-radius: 30px !important;
    width: 100% !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

.single-product .summary .ts-fbt-form .submit-wrapper button.button:hover {
    background-color: #8c662e !important;
    color: #fff !important;
}

/* Hide Additional Information Tab */
li.additional_information_tab,
#tab-additional_information,
.elementor-widget-woocommerce-product-data-tabs .additional_information_tab,
.elementor-widget-woocommerce-product-data-tabs #tab-additional_information {
    display: none !important;
}

/* Global Description Padding (Mobile Base) */
.single-product div.product .woocommerce-tabs {
    padding: 20px !important;
    box-sizing: border-box !important;
}

/* Fix Description Bullet Points (Prevents text dropping below bullet) */
.single-product div.product .woocommerce-tabs .panel ul {
    list-style-position: outside !important;
    margin-left: 20px !important;
}
.single-product div.product .woocommerce-tabs .panel ul li {
    margin-bottom: 15px !important;
}
.single-product div.product .woocommerce-tabs .panel ul li p {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Fix Right Side Title Size */
.single-product div.product .summary.entry-summary .product_title {
    font-size: 2.2rem !important;
    line-height: 1.2 !important;
    margin-bottom: 20px !important;
}

/* Force Perfect Square & Fix Blur */
.single-product .woocommerce-product-gallery__image {
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 100% !important; /* CSS Hack for perfect square */
    position: relative !important;
    overflow: hidden !important;
    border-radius: 8px !important;
}
.single-product .woocommerce-product-gallery__image img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    filter: none !important;    /* Force remove blur */
    opacity: 1 !important;      /* Force remove transparency */
    transform: none !important; /* Prevent blur from scaling */
    margin: 0 !important;
}

/* Global Thumbnail Polish (Square aspect ratio for mobile horizontal scrolling too) */
.single-product .woocommerce-product-gallery .flex-control-thumbs img {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    border-radius: 6px !important;
    border: none !important;
    cursor: pointer !important;
    filter: none !important;
    opacity: 0.5 !important; /* Dim inactive thumbnails */
    transition: opacity 0.3s ease !important;
}
.single-product .woocommerce-product-gallery .flex-control-thumbs li img.flex-active,
.single-product .woocommerce-product-gallery .flex-control-thumbs li img:hover {
    opacity: 1 !important; /* Highlight active/hovered thumbnail */
}
