/* SitePlanExpert - WooCommerce Single Product Layout Fix */

/* Main product area */
body.single-product .site-content {
    padding: 34px 0 50px;
}

body.single-product .ast-container {
    max-width: 1200px;
}

body.single-product div.product {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
    gap: 36px;
    align-items: start;
}

/* Product gallery: prevent oversized image */
body.single-product div.product div.images,
body.single-product div.product .woocommerce-product-gallery {
    float: none !important;
    width: 100% !important;
    max-width: 100%;
    margin: 0 !important;
}

body.single-product div.product .woocommerce-product-gallery {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    padding: 14px;
    box-sizing: border-box;
}

body.single-product div.product .woocommerce-product-gallery__wrapper {
    margin: 0;
}

body.single-product div.product .woocommerce-product-gallery__image,
body.single-product div.product .woocommerce-product-gallery__image a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

body.single-product div.product .woocommerce-product-gallery__image img {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 520px;
    object-fit: contain;
    margin: 0 auto;
    border-radius: 6px;
}

/* Product summary */
body.single-product div.product .summary {
    float: none !important;
    width: 100% !important;
    max-width: 100%;
    margin: 0 !important;
    padding: 26px;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}

body.single-product .woocommerce-breadcrumb {
    margin-bottom: 18px;
    color: #64748b;
    font-size: 13px;
}

body.single-product div.product .product_title {
    margin: 0 0 14px;
    color: #0b2545;
    font-size: 30px;
    line-height: 1.3;
    font-weight: 700;
}

body.single-product div.product p.price,
body.single-product div.product span.price {
    margin: 0 0 22px;
    color: #0b2545;
    font-size: 28px;
    font-weight: 700;
}

body.single-product div.product form.cart {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0;
}

body.single-product div.product form.cart .quantity {
    margin: 0 !important;
}

body.single-product div.product form.cart .quantity .qty {
    width: 72px;
    min-height: 46px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    text-align: center;
}

body.single-product div.product .single_add_to_cart_button {
    min-height: 46px;
    padding: 12px 24px;
    border: 0;
    border-radius: 6px;
    background: #1769e0 !important;
    color: #fff !important;
    font-weight: 600;
}

body.single-product div.product .single_add_to_cart_button:hover {
    background: #0b2545 !important;
}

body.single-product div.product .product_meta {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.8;
}

/* Description and Reviews tabs: restore normal flow below product columns */
body.single-product div.product .woocommerce-tabs {
    grid-column: 1 / -1;
    clear: both;
    float: none !important;
    width: 100% !important;
    margin: 4px 0 0 !important;
    padding: 26px 30px;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
}

body.single-product .woocommerce-tabs ul.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin: 0 0 22px !important;
    padding: 0 !important;
    border-bottom: 1px solid #e2e8f0;
}

body.single-product .woocommerce-tabs ul.tabs::before,
body.single-product .woocommerce-tabs ul.tabs li::before,
body.single-product .woocommerce-tabs ul.tabs li::after {
    display: none !important;
    content: none !important;
}

body.single-product .woocommerce-tabs ul.tabs li {
    margin: 0 !important;
    padding: 0 0 12px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
}

body.single-product .woocommerce-tabs ul.tabs li.active {
    border-bottom: 3px solid #1769e0 !important;
}

body.single-product .woocommerce-tabs ul.tabs li a {
    padding: 0 !important;
    color: #0b2545 !important;
    font-size: 15px;
    font-weight: 600;
}

body.single-product .woocommerce-tabs .woocommerce-Tabs-panel {
    display: block;
    float: none !important;
    width: 100% !important;
    max-width: 920px;
    margin: 0 !important;
    padding: 0 !important;
    color: #475569;
    font-size: 15px;
    line-height: 1.8;
}

body.single-product .woocommerce-tabs .woocommerce-Tabs-panel h2,
body.single-product .woocommerce-tabs .woocommerce-Tabs-panel h3 {
    margin: 22px 0 10px;
    color: #0b2545;
    font-size: 21px;
    line-height: 1.4;
}

body.single-product .woocommerce-tabs .woocommerce-Tabs-panel h2:first-child,
body.single-product .woocommerce-tabs .woocommerce-Tabs-panel h3:first-child {
    margin-top: 0;
}

body.single-product .woocommerce-tabs .woocommerce-Tabs-panel ul,
body.single-product .woocommerce-tabs .woocommerce-Tabs-panel ol {
    padding-left: 24px;
    margin: 12px 0 20px;
}

body.single-product .woocommerce-tabs .woocommerce-Tabs-panel li {
    margin-bottom: 7px;
}

/* Tablet and mobile */
@media (max-width: 768px) {
    body.single-product .site-content {
        padding: 20px 0 32px;
    }

    body.single-product div.product {
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
    }

    body.single-product div.product .woocommerce-product-gallery__image img {
        max-height: 380px;
    }

    body.single-product div.product .summary {
        padding: 20px;
    }

    body.single-product div.product .product_title {
        font-size: 25px;
    }

    body.single-product div.product p.price,
    body.single-product div.product span.price {
        font-size: 25px;
    }

    body.single-product div.product .woocommerce-tabs {
        padding: 20px;
    }

    body.single-product .woocommerce-tabs ul.tabs {
        gap: 18px;
    }
}


/* Product page finishing touches: balanced gallery, clearer form and related items. */
body.single-product {
    --spe-navy: #08223d;
    --spe-blue: #1769e0;
    --spe-border: #dbe5f0;
    --spe-soft: #f4f8fc;
}

body.single-product .site-content {
    background: #fff;
}

body.single-product div.product {
    column-gap: 28px;
    row-gap: 28px;
}

/* Give the plan preview enough height so the product columns feel balanced. */
body.single-product div.product .woocommerce-product-gallery {
    min-height: 440px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--spe-soft);
    background-image:
        linear-gradient(rgba(8, 34, 61, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(8, 34, 61, .035) 1px, transparent 1px);
    background-size: 22px 22px;
}

body.single-product div.product .woocommerce-product-gallery__wrapper,
body.single-product div.product .woocommerce-product-gallery__image,
body.single-product div.product .woocommerce-product-gallery__image a {
    width: 100%;
}

body.single-product div.product .woocommerce-product-gallery__image img {
    max-height: 470px;
    object-fit: contain;
}

/* Use the same navy and white palette throughout the product summary. */
body.single-product div.product .summary {
    border-color: var(--spe-border);
    background: #fff;
    box-shadow: 0 8px 24px rgba(8, 34, 61, .07);
}

body.single-product div.product .product_title,
body.single-product div.product p.price,
body.single-product div.product span.price,
body.single-product .woocommerce-tabs ul.tabs li a,
body.single-product .woocommerce-tabs .woocommerce-Tabs-panel h2,
body.single-product .woocommerce-tabs .woocommerce-Tabs-panel h3 {
    color: var(--spe-navy);
}

body.single-product div.product .single_add_to_cart_button,
body.single-product div.product .single_add_to_cart_button:focus {
    background: var(--spe-navy) !important;
    color: #fff !important;
    border: 1px solid var(--spe-navy) !important;
    transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

body.single-product div.product .single_add_to_cart_button:hover {
    background: var(--spe-blue) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

body.single-product .woocommerce-tabs {
    margin-top: 0 !important;
    border-color: var(--spe-border);
    box-shadow: 0 5px 18px rgba(8, 34, 61, .035);
}

body.single-product .woocommerce-tabs ul.tabs li.active {
    border-bottom-color: var(--spe-blue) !important;
}

/* Related products: tidy responsive cards instead of a small, unaligned item. */
body.single-product section.related.products {
    clear: both;
    width: 100%;
    margin-top: 30px;
    padding: 28px;
    border: 1px solid var(--spe-border);
    border-radius: 14px;
    background: #f7faff;
}

body.single-product section.related.products > h2 {
    margin: 0 0 22px;
    color: var(--spe-navy);
    font-size: 25px;
    line-height: 1.3;
}

body.single-product section.related.products ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    margin: 0 !important;
    padding: 0 !important;
}

body.single-product section.related.products ul.products::before,
body.single-product section.related.products ul.products::after {
    display: none !important;
    content: none !important;
}

body.single-product section.related.products ul.products li.product {
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 16px;
    overflow: hidden;
    border: 1px solid var(--spe-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(8, 34, 61, .045);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

body.single-product section.related.products ul.products li.product:hover {
    transform: translateY(-3px);
    border-color: #a9c7e8;
    box-shadow: 0 10px 24px rgba(8, 34, 61, .10);
}

body.single-product section.related.products ul.products li.product a img {
    display: block;
    width: 100%;
    height: 180px;
    margin: 0 0 14px;
    object-fit: contain;
    border-radius: 7px;
    background: #f7faff;
}

body.single-product section.related.products ul.products li.product .woocommerce-loop-product__title {
    padding: 0;
    color: var(--spe-navy);
    font-size: 17px;
    line-height: 1.4;
}

body.single-product section.related.products ul.products li.product .price {
    color: var(--spe-navy);
    font-weight: 700;
}

body.single-product section.related.products ul.products li.product .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid var(--spe-navy);
    border-radius: 6px;
    background: var(--spe-navy);
    color: #fff;
    font-weight: 600;
    transition: background-color .18s ease, color .18s ease;
}

body.single-product section.related.products ul.products li.product .button:hover {
    background: var(--spe-blue);
    border-color: var(--spe-blue);
    color: #fff;
}

@media (max-width: 768px) {
    body.single-product div.product {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    body.single-product div.product .woocommerce-product-gallery {
        min-height: 280px;
    }

    body.single-product div.product .woocommerce-product-gallery__image img {
        max-height: 340px;
    }

    body.single-product section.related.products {
        padding: 18px;
    }

    body.single-product section.related.products ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    body.single-product section.related.products ul.products li.product {
        padding: 12px;
    }

    body.single-product section.related.products ul.products li.product a img {
        height: 140px;
    }
}

@media (max-width: 480px) {
    body.single-product section.related.products ul.products {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    body.single-product section.related.products ul.products li.product,
    body.single-product div.product .single_add_to_cart_button,
    body.single-product section.related.products ul.products li.product .button {
        transition: none;
    }
}
