/*
 * Sana Baghdad Pharmacy — WooCommerce single product page v1.5
 * Preserves the approved v1.4 product-page design.
 */
:root {
    --sana-teal: #0DA8A8;
    --sana-teal-dark: #078989;
    --sana-text: #17202A;
    --sana-muted: #6B7280;
    --sana-border: #E7ECEF;
    --sana-soft: #F7FAFA;
    --sana-white: #FFFFFF;
}

html:has(body.single-product),
body.single-product {
    color-scheme: light !important;
    background: var(--sana-white) !important;
    color: var(--sana-text) !important;
}

body.single-product .wp-site-blocks,
body.single-product main,
body.single-product .site-main,
body.single-product .woocommerce,
body.single-product .woocommerce-page {
    background-color: var(--sana-white) !important;
    color: var(--sana-text) !important;
}

body.single-product main,
body.single-product .wp-site-blocks main,
body.single-product .site-main {
    max-width: 1240px;
    margin-inline: auto;
}

body.single-product .woocommerce-breadcrumb,
body.single-product nav.woocommerce-breadcrumb {
    display: none !important;
}

body.single-product .woocommerce div.product {
    direction: rtl;
    text-align: right;
    color: var(--sana-text);
}

body.single-product .woocommerce div.product div.summary {
    direction: rtl;
    text-align: right;
    color: var(--sana-text);
}

body.single-product .woocommerce div.product div.images {
    direction: ltr;
}

body.single-product .woocommerce-product-gallery,
body.single-product .woocommerce div.product div.images,
body.single-product .wp-block-woocommerce-product-image-gallery {
    background: var(--sana-white) !important;
    border-radius: 16px;
}

body.single-product .woocommerce div.product div.images img,
body.single-product .woocommerce-product-gallery__image img,
body.single-product .wc-block-components-product-image img {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    object-position: center;
}

body.single-product .sana-hide-duplicate-title,
body.single-product .sana-product-title {
    display: none !important;
}

body.single-product .sana-title-host {
    margin: 0 0 1rem !important;
    padding: 0 !important;
    color: var(--sana-text) !important;
    font-size: 1rem !important;
    line-height: 1.2 !important;
    font-weight: 400 !important;
    letter-spacing: 0 !important;
}

body.single-product .sana-structured-title {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: right;
    gap: 0.22rem;
    width: 100%;
}

body.single-product .sana-title-ar {
    display: block;
    width: 100%;
    font-size: clamp(1.55rem, 2vw, 1.9rem);
    line-height: 1.4;
    font-weight: 700;
    color: var(--sana-text) !important;
    unicode-bidi: isolate;
    text-align: right;
}

body.single-product .sana-title-en {
    display: block;
    width: 100%;
    font-size: clamp(1.08rem, 1.45vw, 1.34rem);
    line-height: 1.42;
    font-weight: 600;
    color: #4B5563 !important;
    unicode-bidi: isolate;
    text-align: right;
    overflow-wrap: anywhere;
}

body.single-product .sana-title-size {
    display: inline-flex;
    width: max-content;
    align-items: center;
    margin-top: 0.48rem;
    margin-left: auto;
    margin-right: 0;
    padding: 0.3rem 0.72rem;
    border: 1px solid var(--sana-border);
    border-radius: 999px;
    background: var(--sana-soft) !important;
    color: #4B5563 !important;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.25;
}

body.single-product .woocommerce div.product p.price,
body.single-product .woocommerce div.product span.price,
body.single-product .wc-block-components-product-price {
    color: var(--sana-teal-dark) !important;
    font-size: 1.34rem !important;
    font-weight: 800 !important;
    line-height: 1.4;
    margin: 0.72rem 0 0.92rem;
}

body.single-product .woocommerce-product-details__short-description,
body.single-product .woocommerce-product-details__short-description p {
    color: #374151 !important;
    font-size: 1rem;
    line-height: 1.9;
}

body.single-product .woocommerce .quantity .qty {
    min-width: 64px;
    min-height: 48px;
    border: 1px solid var(--sana-border) !important;
    border-radius: 10px;
    text-align: center;
    font-size: 1rem;
    background: var(--sana-white) !important;
    color: var(--sana-text) !important;
}

body.single-product .woocommerce div.product form.cart .button,
body.single-product .woocommerce button.single_add_to_cart_button,
body.single-product .wp-block-woocommerce-add-to-cart-form button,
body.single-product .wc-block-components-button {
    background: var(--sana-teal) !important;
    color: var(--sana-white) !important;
    border: 0 !important;
    border-radius: 10px !important;
    min-height: 48px;
    padding: 0.8rem 1.35rem !important;
    font-weight: 700 !important;
    box-shadow: none !important;
}

body.single-product .woocommerce div.product form.cart .button:hover,
body.single-product .woocommerce button.single_add_to_cart_button:hover,
body.single-product .wp-block-woocommerce-add-to-cart-form button:hover,
body.single-product .wc-block-components-button:hover {
    background: var(--sana-teal-dark) !important;
    color: var(--sana-white) !important;
}

body.single-product .product_meta,
body.single-product .wp-block-woocommerce-product-meta {
    display: none !important;
}

body.single-product .woocommerce-tabs {
    clear: both;
    padding-top: 2rem;
    direction: rtl;
    text-align: right;
    color: var(--sana-text);
}

body.single-product .woocommerce-tabs ul.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: center;
    padding: 0 !important;
    margin: 0 auto 1.3rem !important;
    border-bottom: 1px solid var(--sana-border);
    max-width: 980px;
}

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;
}

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

body.single-product .woocommerce-tabs ul.tabs li a {
    display: inline-block;
    padding: 0.72rem 1rem !important;
    color: var(--sana-muted) !important;
    font-weight: 650 !important;
    text-decoration: none !important;
    border-bottom: 2px solid transparent;
}

body.single-product .woocommerce-tabs ul.tabs li.active a {
    color: var(--sana-teal-dark) !important;
    border-bottom-color: var(--sana-teal);
}

body.single-product .woocommerce-tabs .panel,
body.single-product .woocommerce-Tabs-panel {
    width: min(980px, calc(100% - 36px)) !important;
    max-width: 980px !important;
    margin: 0 auto !important;
    padding: 26px 30px !important;
    box-sizing: border-box;
    direction: rtl;
    text-align: right;
    font-size: 1.02rem;
    line-height: 1.95;
    color: #29323D !important;
    background: var(--sana-white) !important;
    border: 1px solid #EEF2F3;
    border-radius: 16px;
}

body.single-product .woocommerce-tabs .panel > *,
body.single-product .woocommerce-Tabs-panel > * {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    color: inherit !important;
    box-sizing: border-box;
}

body.single-product .woocommerce-tabs .panel h2 {
    font-size: 1.35rem;
    line-height: 1.4;
    margin: 0 0 1rem !important;
    color: var(--sana-text) !important;
}

body.single-product .woocommerce-tabs .panel p {
    margin-top: 0;
    margin-bottom: 1rem !important;
}

body.single-product .woocommerce-tabs .panel ul {
    padding-right: 1.3rem !important;
    padding-left: 0 !important;
    margin-right: 0 !important;
}

body.single-product .woocommerce-tabs .panel li {
    margin-bottom: 0.35rem;
}

@media (max-width: 900px) {
    body.single-product main,
    body.single-product .wp-site-blocks main,
    body.single-product .site-main {
        padding-inline: 18px;
    }

    body.single-product .woocommerce div.product div.images,
    body.single-product .woocommerce div.product div.summary {
        float: none !important;
        width: 100% !important;
    }

    body.single-product .woocommerce div.product div.images {
        margin-bottom: 1.1rem;
    }

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

    body.single-product .sana-title-ar {
        font-size: clamp(1.4rem, 5.5vw, 1.72rem);
    }

    body.single-product .sana-title-en {
        font-size: clamp(1.02rem, 4.2vw, 1.25rem);
    }

    body.single-product .woocommerce-tabs .panel,
    body.single-product .woocommerce-Tabs-panel {
        width: 100% !important;
        padding: 22px 20px !important;
    }
}

@media (max-width: 520px) {
    body.single-product .woocommerce div.product p.price,
    body.single-product .woocommerce div.product span.price {
        font-size: 1.22rem !important;
    }

    body.single-product .woocommerce div.product form.cart {
        display: flex;
        gap: 0.65rem;
        align-items: stretch;
        flex-wrap: wrap;
    }

    body.single-product .woocommerce div.product form.cart .button {
        flex: 1 1 180px;
    }

    body.single-product .woocommerce-tabs ul.tabs {
        display: grid;
        grid-template-columns: 1fr;
        border-bottom: 0;
        max-width: 100%;
    }

    body.single-product .woocommerce-tabs ul.tabs li a {
        width: 100%;
        border: 1px solid var(--sana-border);
        border-radius: 8px;
        box-sizing: border-box;
    }

    body.single-product .woocommerce-tabs ul.tabs li.active a {
        background: var(--sana-soft) !important;
        border-color: var(--sana-teal);
    }
}


/* v1.17 — Product page mobile */
@media (max-width: 520px) {
    body.single-product main,
    body.single-product .wp-site-blocks main,
    body.single-product .site-main {
        padding-inline: 12px !important;
    }

    body.single-product .woocommerce div.product div.images img,
    body.single-product .woocommerce-product-gallery__image img {
        max-height: 330px !important;
    }

    body.single-product .sana-title-ar {
        font-size: 1.45rem !important;
        line-height: 1.32 !important;
    }

    body.single-product .sana-title-en {
        font-size: .98rem !important;
        line-height: 1.35 !important;
    }

    body.single-product .woocommerce div.product p.price,
    body.single-product .woocommerce div.product span.price {
        font-size: 1.15rem !important;
    }

    /* Horizontal tabs instead of three very tall rows. */
    body.single-product .woocommerce-tabs ul.tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        justify-content: flex-start !important;
        gap: 6px !important;
        padding-bottom: 4px !important;
        scrollbar-width: none;
    }

    body.single-product .woocommerce-tabs ul.tabs::-webkit-scrollbar {
        display: none;
    }

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

    body.single-product .woocommerce-tabs ul.tabs li a {
        width: auto !important;
        min-height: 40px !important;
        display: inline-flex !important;
        align-items: center !important;
        padding: 8px 12px !important;
        font-size: .78rem !important;
        white-space: nowrap !important;
    }

    body.single-product .woocommerce-tabs .panel,
    body.single-product .woocommerce-Tabs-panel {
        width: 100% !important;
        padding: 18px 15px !important;
        border-radius: 13px !important;
        font-size: .92rem !important;
        line-height: 1.78 !important;
    }

    body.single-product .woocommerce-tabs .panel h2 {
        font-size: 1.18rem !important;
    }

    body.single-product .sana-site-footer {
        margin-top: 28px !important;
    }
}


/* v1.18 — compact product gallery and remove excess bottom whitespace */
@media (max-width: 520px) {
    body.single-product main,
    body.single-product .wp-site-blocks main,
    body.single-product .site-main {
        padding-bottom: 0 !important;
    }

    body.single-product .woocommerce div.product div.images,
    body.single-product .woocommerce-product-gallery,
    body.single-product .wp-block-woocommerce-product-image-gallery {
        min-height: 0 !important;
        margin-bottom: 12px !important;
    }

    body.single-product .woocommerce-product-gallery__wrapper {
        min-height: 0 !important;
        margin: 0 !important;
    }

    body.single-product .woocommerce-product-gallery .flex-viewport {
        height: 330px !important;
        min-height: 330px !important;
        max-height: 330px !important;
    }

    body.single-product .woocommerce-product-gallery__image,
    body.single-product .woocommerce-product-gallery__image > a {
        height: 330px !important;
        min-height: 330px !important;
        max-height: 330px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
    }

    body.single-product .woocommerce div.product div.images img,
    body.single-product .woocommerce-product-gallery__image img {
        width: 100% !important;
        height: 100% !important;
        max-height: 330px !important;
        object-fit: contain !important;
        object-position: center !important;
        margin: 0 !important;
    }

    body.single-product .woocommerce div.product div.summary {
        margin-top: 0 !important;
        margin-bottom: 18px !important;
    }

    body.single-product .woocommerce-tabs {
        padding-top: 1.1rem !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }

    body.single-product .woocommerce-tabs .panel,
    body.single-product .woocommerce-Tabs-panel {
        margin-bottom: 0 !important;
    }

    body.single-product .sana-site-footer {
        margin-top: 14px !important;
    }
}
