/* ── WooCommerce Weight Price Display ─────────────────────────────────── */

/*
 * font-size, padding, colors, and their @media overrides are generated in PHP
 * (build_inline_css) and appended AFTER this file. Do NOT add font-size or
 * color rules here — they will always be overridden by the inline block.
 * This file handles structural/layout styles only.
 */

/* ── Position reset — prevents themes floating/positioning the wrapper ── */
.wc-wpd-wrapper,
.woocommerce div.product div.summary .wc-wpd-wrapper,
.woocommerce-page div.product div.summary .wc-wpd-wrapper,
.woocommerce ul.products li.product .wc-wpd-wrapper {
    position: static !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    float: none !important;
    clear: both;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: block;
    border-radius: 0; /* Sharp corners — per site design */
    /* margin, padding, background-color, border: set by inline CSS from admin */
}

/* ── Header text ──────────────────────────────────────────────────────── */
.wc-wpd-header {
    text-align: left;
    margin-bottom: 6px;
    line-height: 1.4;
    font-weight: 600;
    /* font-size, color: set by inline CSS from admin */
}

/* ── Items row ────────────────────────────────────────────────────────── */
.wc-wpd-items {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    flex-wrap: nowrap;
    width: 100%;
    gap: 6px;
    box-sizing: border-box;
}

/* ── Individual item box ──────────────────────────────────────────────── */
.wc-wpd-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
    border-radius: 0; /* Sharp corners */
    /* padding, background-color: set by inline CSS from admin */
}

/* Divider between items — toggled/styled via inline CSS */
.wc-wpd-item + .wc-wpd-item {
    border-left: none;
}

/* ── Interactive boxes (single product page only) ─────────────────────── */
.wc-wpd-selectable {
    cursor: pointer;
    transition: opacity 0.15s ease, outline 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    outline: 2px solid transparent;
    outline-offset: -2px;
}

.wc-wpd-selectable:hover {
    opacity: 0.8;
}

.wc-wpd-selectable:focus-visible {
    outline: 2px dashed #666;
}

.wc-wpd-selectable.wc-wpd-active {
    outline: 2px solid #333;
}

/* ── Label ────────────────────────────────────────────────────────────── */
.wc-wpd-label {
    display: block;
    margin-bottom: 3px;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.3;
}

/* ── Price ────────────────────────────────────────────────────────────── */
.wc-wpd-price {
    display: block;
    color: inherit;
    line-height: 1.4;
    /* Allow wrapping for sale prices (<del> + <ins>) */
    white-space: normal;
    text-align: center;
}

/* Strip WooCommerce's own colour/size overrides */
.wc-wpd-price .woocommerce-Price-amount,
.wc-wpd-price bdi {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

/* Sale price: strikethrough original, highlight sale */
.wc-wpd-price del {
    opacity: 0.55;
    margin-right: 3px;
    font-size: 0.9em;
}

.wc-wpd-price del .woocommerce-Price-amount {
    color: inherit;
}

.wc-wpd-price ins {
    text-decoration: none;
    font-weight: 600;
}

.wc-wpd-price ins .woocommerce-Price-amount {
    color: inherit;
}

/* ── Single product: align qty + Add to Cart + YITH wishlist in one row ── */

.woocommerce div.product .woocommerce-variation-add-to-cart {
    display: flex !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Prevent YITH from stretching or adding extra vertical space inside the row */
.woocommerce div.product .woocommerce-variation-add-to-cart .yith-wcwl-add-to-wishlist,
.woocommerce div.product .woocommerce-variation-add-to-cart .yith-wcwl-add-button {
    display: flex !important;
    align-items: center;
    margin: 0 !important;
}

/* ── Shop loop: product title — fixed 2-line height for grid alignment ── */

/* Clamp title to 2 lines with ellipsis; min-height reserves space so single-line
 * titles don't cause the price boxes below to sit at different vertical positions */
.woocommerce ul.products li.product .products-title,
.woocommerce ul.products li.product h2.woocommerce-loop-product__title {
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 2.8em; /* 2 lines × 1.4 line-height */
}

/* ── Shop loop: star ratings ──────────────────────────────────────────── */

/* Center the star rating row above the action buttons */
.woocommerce ul.products li.product .woocommerce-product-rating {
    display: block;
    width: 100%;
    text-align: center;
    margin-bottom: 8px;
}

/* ── Shop loop actions ────────────────────────────────────────────────── */

/* Wrap that holds both the button and wishlist icon in one inline row */
.wc-wpd-loop-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

/* Button wrapper and YITH wishlist are flex children inside .wc-wpd-loop-actions */
.woocommerce ul.products li.product .wc-wpd-loop-btn-wrap {
    display: inline-flex;
    align-items: center;
}

/* WC default "Add to Cart" button — structural overrides; colours come from inline CSS */
.wc-wpd-loop-btn-wrap .button,
.wc-wpd-loop-btn-wrap a.button {
    border-radius: 0 !important;
    border: none !important;
    padding: 5px 12px !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
    display: inline-block !important;
    white-space: nowrap !important;
    transition: opacity 0.15s ease !important;
    box-shadow: none !important;
}

/* Solid "Select Options" button — background/color set by inline CSS from admin */
.wc-wpd-select-btn {
    display: inline-block;
    padding: 5px 12px;
    border: none;
    text-decoration: none;
    font-size: 12px;
    line-height: 1.5;
    cursor: pointer;
    transition: opacity 0.15s ease;
    white-space: nowrap;
    border-radius: 0; /* Sharp corners */
    /* background-color, color: set by inline CSS from admin */
}

.wc-wpd-select-btn:hover {
    opacity: 0.85;
    text-decoration: none;
}

/* YITH wishlist inside our flex row — ensure it doesn't stretch full width */
.wc-wpd-loop-actions .yith-wcwl-add-to-wishlist {
    display: flex !important;
    align-items: center;
    flex-shrink: 0;
}

.wc-wpd-loop-actions .yith-wcwl-add-button {
    display: flex !important;
    align-items: center;
}

/* YITH wishlist — text + heart icon inline */
.woocommerce ul.products li.product .yith-wcwl-add-button a.add_to_wishlist {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
    text-decoration: none;
}

.woocommerce ul.products li.product .yith-wcwl-add-button a.add_to_wishlist svg,
.woocommerce ul.products li.product .yith-wcwl-add-button a.add_to_wishlist .yith-wcwl-icon-svg {
    display: block;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ── Extreme narrow (≤ 320 px) — stack into a single column ──────────── */
@media ( max-width: 320px ) {
    .wc-wpd-items {
        flex-direction: column;
        gap: 4px;
    }

    .wc-wpd-item {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }

    .wc-wpd-item + .wc-wpd-item {
        border-left: none !important;
        border-top: 1px solid rgba( 0, 0, 0, 0.1 );
    }

    .wc-wpd-label {
        margin-bottom: 0;
        margin-right: 8px;
        white-space: normal;
    }
}
