/*
 * Single Product Page - Complete Styling
 * This file ONLY affects single product pages (body.single-product)
 */

/* ========================================
   GLOBAL RESETS
   ======================================== */

body.single-product,
body.single-product html {
    overflow: visible !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

body.single-product #page,
body.single-product .site-content,
body.single-product .content-area,
body.single-product main {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
}

/* ========================================
   SINGLE PRODUCT PAGE - AGGRESSIVE FIXES
   ======================================== */

/* GLOBAL RESETS & SPACING REDUCTION */
body.single-product .product_title {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    /* Reduced from 700/900 */
    color: #1a1a1a !important;
    margin: 5px 0 10px 0 !important;
    /* Aggressive reduction */
    line-height: 1.2 !important;
}

body.single-product .stock-status {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.5rem 1rem !important;
    border-radius: 50px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    margin-bottom: 5px !important;
}

body.single-product .product-rating-wrapper {
    margin-bottom: 5px !important;
}

body.single-product .product-price-wrapper {
    margin-bottom: 15px !important;
}

body.single-product .product-description {
    margin-bottom: 10px !important;
    padding: 10px !important;
    background: #f8f9fa !important;
    border-radius: 12px !important;
    border-left: 4px solid #667eea !important;
    display: block !important;
    visibility: visible !important;
}

/* Hide if empty (Double check) */
body.single-product .product-description:empty {
    display: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ========================================
   PRODUCT CONTAINER LAYOUT
   ======================================== */

body.single-product .premium-single-product .product-container {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 20px !important;
}

@media (min-width: 1024px) {
    body.single-product .premium-single-product .product-container {
        grid-template-columns: 1fr 1fr !important;
        gap: 4rem !important;
        padding: 40px !important;
    }
}

/* ========================================
   PRODUCT IMAGES SECTION
   ======================================== */

body.single-product .product-images-section {
    width: 100% !important;
    max-width: 600px !important;
}

body.single-product .woocommerce-product-gallery {
    margin: 0 !important;
    opacity: 1 !important;
    max-width: 100% !important;
}

body.single-product .woocommerce-product-gallery__wrapper {
    margin: 0 !important;
    max-width: 100% !important;
}

body.single-product .woocommerce-product-gallery__image {
    margin-bottom: 1rem !important;
    max-width: 100% !important;
}

/* Main Product Image */
body.single-product .woocommerce-product-gallery__image:first-child {
    margin-bottom: 1rem !important;
}

body.single-product .woocommerce-product-gallery__image:first-child img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 600px !important;
    object-fit: cover !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
    display: block !important;
    transition: all 0.3s ease !important;
}

/* Gallery Thumbnails */
body.single-product .woocommerce-product-gallery__image:not(:first-child) {
    display: inline-block !important;
    margin: 0 0.5rem 0.5rem 0 !important;
    cursor: pointer !important;
}

body.single-product .woocommerce-product-gallery__image:not(:first-child) img {
    width: 80px !important;
    height: 80px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    border: 2px solid #e0e0e0 !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
}

body.single-product .woocommerce-product-gallery__image:not(:first-child):hover img {
    border-color: #667eea !important;
    transform: scale(1.05) !important;
}

body.single-product .woocommerce-product-gallery__image.active:not(:first-child) img {
    border-color: #667eea !important;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2) !important;
}

/* Hide duplicate gallery images from FlexSlider */
body.single-product .flex-control-thumbs {
    display: none !important;
}

body.single-product .flex-viewport {
    max-height: 600px !important;
}

/* ========================================
   STOCK STATUS
   ======================================== */

body.single-product .stock-status.in-stock {
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%) !important;
    color: #155724 !important;
}

body.single-product .stock-status.out-of-stock {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%) !important;
    color: #856404 !important;
}

body.single-product .stock-status .stock-icon {
    font-size: 16px !important;
}

/* ========================================
   PRODUCT TITLE
   ======================================== */

@media (min-width: 1024px) {
    body.single-product .product_title {
        font-size: 1.75rem !important;
    }
}

/* ========================================
   RATING
   ======================================== */

body.single-product .woocommerce-product-rating {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    margin: 0 !important;
}

body.single-product .star-rating {
    color: #ffc107 !important;
    font-size: 18px !important;
}

body.single-product .woocommerce-review-link {
    color: #667eea !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

body.single-product .woocommerce-review-link:hover {
    text-decoration: underline !important;
}

/* ========================================
   SIZE GUIDE LINK
   ======================================== */

body.single-product .size-guide-link {
    margin-bottom: 0.75rem !important;
}

body.single-product .size-guide-trigger {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.5rem 1rem !important;
    background: #f8f9fa !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    color: #333 !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

body.single-product .size-guide-trigger:hover {
    background: #667eea !important;
    color: #fff !important;
    border-color: #667eea !important;
}

body.single-product .size-guide-trigger .icon {
    font-size: 18px !important;
}

/* ========================================
   PRODUCT DESCRIPTION
   ======================================== */

/* Hide description if empty */
body.single-product .product-description p {
    margin: 0 !important;
    color: #555 !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
}

body.single-product .woocommerce-product-details__short-description {
    margin: 0 !important;
    display: block !important;
    visibility: visible !important;
}

/* ========================================
   PRICE WITH DISCOUNT
   ======================================== */

body.single-product .price-container {
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
    flex-wrap: wrap !important;
}

body.single-product .regular-price {
    font-size: 1.25rem !important;
    color: #999 !important;
}

body.single-product .regular-price del {
    text-decoration: line-through !important;
}

body.single-product .sale-price {
    font-size: 2rem !important;
    font-weight: 900 !important;
    color: #667eea !important;
}

body.single-product .discount-badge {
    display: inline-block !important;
    padding: 0.5rem 1rem !important;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    border-radius: 50px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

body.single-product .price {
    font-size: 2rem !important;
    font-weight: 900 !important;
    color: #667eea !important;
    margin: 0 !important;
}

/* ========================================
   VARIATIONS (Color & Size)
   ======================================== */

body.single-product .variations {
    margin-bottom: 1.5rem !important;
}

body.single-product .variations tr {
    display: block !important;
    margin-bottom: 1.5rem !important;
}

body.single-product .variations th {
    display: block !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #333 !important;
    margin-bottom: 0.75rem !important;
    padding: 0 !important;
}

body.single-product .variations td {
    display: block !important;
    padding: 0 !important;
}

/* FORCE VARIATION SELECTS TO BE VISIBLE */
body.single-product .variations select,
body.single-product select#pa_color,
body.single-product select#pa_size,
body.single-product select.pa_color,
body.single-product select.pa_size,
body.single-product .variations_form select {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    padding: 0.75rem 1rem !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #333 !important;
    background: #fff !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

body.single-product .variations select:hover,
body.single-product .variations select:focus {
    border-color: #667eea !important;
    outline: none !important;
}

body.single-product .reset_variations {
    display: inline-block !important;
    margin-top: 0.5rem !important;
    color: #667eea !important;
    font-size: 13px !important;
    text-decoration: none !important;
}

body.single-product .reset_variations:hover {
    text-decoration: underline !important;
}

/* ========================================
   QUANTITY SELECTOR
   ======================================== */

body.single-product .quantity {
    display: inline-flex !important;
    align-items: center !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    margin-right: 1rem !important;
}

body.single-product .quantity input.qty {
    width: 60px !important;
    text-align: center !important;
    border: none !important;
    padding: 0.75rem 0.5rem !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #333 !important;
}

body.single-product .quantity input.qty:focus {
    outline: none !important;
}

/* ========================================
   ADD TO CART BUTTON
   ======================================== */

body.single-product .product-add-to-cart-wrapper {
    margin-bottom: 2rem !important;
}

body.single-product .cart {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 1rem !important;
}

body.single-product .single_add_to_cart_button {
    flex: 1 !important;
    min-width: 200px !important;
    padding: 1rem 2rem !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

body.single-product .single_add_to_cart_button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4) !important;
}

body.single-product .single_add_to_cart_button:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Buy Now Button */
body.single-product .buy-now-button {
    flex: 1 !important;
    min-width: 200px !important;
    padding: 1rem 2rem !important;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    margin-top: 1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
}

body.single-product .buy-now-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 25px rgba(245, 87, 108, 0.4) !important;
}

body.single-product .buy-now-button .button-icon {
    font-size: 18px !important;
}

/* ========================================
   PRODUCT META (SKU, Categories, Tags)
   ======================================== */

body.single-product .product-meta-wrapper {
    margin-bottom: 2rem !important;
    padding: 1.5rem !important;
    background: #f8f9fa !important;
    border-radius: 12px !important;
}

body.single-product .product_meta {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
}

body.single-product .product_meta>span {
    display: flex !important;
    align-items: center !important;
    font-size: 14px !important;
    color: #555 !important;
}

body.single-product .product_meta .sku_wrapper,
body.single-product .product_meta .posted_in,
body.single-product .product_meta .tagged_as {
    display: flex !important;
    gap: 0.5rem !important;
}

body.single-product .product_meta a {
    color: #667eea !important;
    text-decoration: none !important;
    font-weight: 600 !important;
}

body.single-product .product_meta a:hover {
    text-decoration: underline !important;
}

body.single-product .sku {
    font-weight: 700 !important;
    color: #333 !important;
}

/* ========================================
   PRODUCT TABS
   ======================================== */

body.single-product .product-tabs-wrapper {
    margin-top: 3rem !important;
    padding-top: 3rem !important;
    border-top: 2px solid #e0e0e0 !important;
}

body.single-product .woocommerce-tabs {
    margin: 0 !important;
}

body.single-product .woocommerce-tabs ul.tabs {
    display: flex !important;
    justify-content: center !important;
    /* Centered */
    gap: 1.5rem !important;
    /* Spaced */
    border-bottom: 2px solid #e0e0e0 !important;
    margin: 0 auto 2rem auto !important;
    /* Centered container */
    padding: 0 !important;
    list-style: none !important;
    width: fit-content !important;
}

body.single-product .woocommerce-tabs ul.tabs li {
    margin: 0 !important;
}

body.single-product .woocommerce-tabs ul.tabs li a {
    display: block !important;
    padding: 1rem 1.5rem !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #999 !important;
    text-decoration: none !important;
    border-bottom: 3px solid transparent !important;
    transition: all 0.3s ease !important;
}

body.single-product .woocommerce-tabs ul.tabs li.active a,
body.single-product .woocommerce-tabs ul.tabs li a:hover {
    color: #667eea !important;
    border-bottom-color: #667eea !important;
}

body.single-product .woocommerce-Tabs-panel {
    padding: 1.5rem !important;
    background: #f8f9fa !important;
    border-radius: 12px !important;
}

/* ========================================
   RELATED PRODUCTS GRID & STYLING
   ======================================== */

body.single-product .related.products,
body.single-product .upsells.products {
    margin-top: 3rem !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body.single-product .related.products h2,
body.single-product .upsells.products h2 {
    font-size: 2rem !important;
    font-weight: 600 !important;
    /* Reduced */
    text-align: center !important;
    margin-bottom: 1.5rem !important;
    color: #1a1a1a !important;
    text-transform: uppercase !important;
}

body.single-product .related.products ul.products,
body.single-product .upsells.products ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

@media (min-width: 768px) {

    body.single-product .related.products ul.products,
    body.single-product .upsells.products ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Force 4 Columns on Desktop */
@media (min-width: 1024px) {

    body.single-product section.related.products ul.products,
    body.single-product .related.products ul.products,
    body.single-product .upsells.products ul.products,
    .woocommerce ul.products {
        /* Global targeting to be safe */
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 20px !important;
        background: transparent !important;
        width: 100% !important;
        float: none !important;
        justify-content: center !important;
    }

    /* Ensure they fit and don't wrap oddly */
    body.single-product section.related.products ul.products li.product,
    body.single-product .related.products ul.products li.product,
    body.single-product .upsells.products ul.products li.product,
    .woocommerce ul.products li.product {
        width: auto !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        /* Remove padding that might add to width */
        float: none !important;
        /* Prevent float interference */
        clear: none !important;
    }
}



/* Product Card Styling Updates */
body.single-product .related.products li.product,
.woocommerce ul.products li.product {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    background: #fff !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    position: relative !important;
}

body.single-product .related.products ul.products li.product:hover,
body.single-product .upsells.products ul.products li.product:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
}

body.single-product .related.products ul.products li.product img,
body.single-product .upsells.products ul.products li.product img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

/* Show ShopEngine Icons */
body.single-product .shopengine-wishlist,
body.single-product .shopengine-comparison,
body.single-product .shopengine-quickview {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body.single-product .shopengine-icon-add_to_favourite_1,
body.single-product .shopengine-icon-product_compare_1,
body.single-product .shopengine-icon-quickview_1,
body.single-product .material-icons-outlined {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 20px !important;
    line-height: 1 !important;
}

/* Product Card Content Spacing */
body.single-product .related.products .woocommerce-loop-product__title,
body.single-product .upsells.products .woocommerce-loop-product__title {
    font-size: 1rem !important;
    font-weight: 600 !important;
    margin: 0.75rem 0.75rem 0.5rem 0.75rem !important;
    line-height: 1.3 !important;
}

body.single-product .related.products .price,
body.single-product .upsells.products .price {
    margin: 0 0.75rem 0.75rem 0.75rem !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
}

/* Show product descriptions in related products */
body.single-product .related.products .woocommerce-loop-product__description,
body.single-product .upsells.products .woocommerce-loop-product__description {
    display: block !important;
    visibility: visible !important;
    padding: 0 0.75rem 0.75rem 0.75rem !important;
    font-size: 0.875rem !important;
    color: #666 !important;
    line-height: 1.4 !important;
}

/* ========================================
   SHOPENGINE ICONS STYLING (NEW)
   ======================================== */
.shopengine-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    width: 100%;
}

.shopengine-wishlist-btn,
.shopengine-compare-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: #f5f5f5;
    border-radius: 50%;
    color: #333;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.shopengine-wishlist-btn:hover,
.shopengine-compare-btn:hover {
    background: #667eea;
    color: #fff;
    transform: translateY(-2px);
}

.shopengine-wishlist-btn i,
.shopengine-compare-btn i {
    font-size: 16px;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 767px) {
    body.single-product .premium-single-product .product-container {
        padding: 1rem !important;
    }

    body.single-product .product_title {
        font-size: 1.25rem !important;
    }

    body.single-product .sale-price,
    body.single-product .price {
        font-size: 1.5rem !important;
    }

    body.single-product .woocommerce-tabs ul.tabs {
        flex-direction: column !important;
        border-bottom: none !important;
    }

    body.single-product .woocommerce-tabs ul.tabs li {
        border-bottom: 1px solid #e0e0e0 !important;
    }

    body.single-product .woocommerce-tabs ul.tabs li a {
        border-bottom: none !important;
        border-left: 3px solid transparent !important;
    }

    body.single-product .woocommerce-tabs ul.tabs li.active a {
        border-left-color: #667eea !important;
        background-color: #f8f9fa !important;
    }

    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}