/**
 * Deals Gone Wild - 4-Column Flex Layout
 *
 * Migrated from: themes/outlet/template-parts/load-deals-gone-wild-section.php
 * Used by: DEM Module -> wc-single-deals-gone-wild.php
 * Scope: Single product pages only (is_product)
 *
 * @since 2026-02-25
 * @version 1.0.0
 */

/* ======================================================
   DEALS GONE WILD - 4-COLUMN FLEX LAYOUT
   ====================================================== */

/* ---------- CONTAINER + TOKENS ---------- */
#deals_gone_wild {
    --dgw-color-header-bg: var(--contrast-2, #707070);
    --dgw-color-header-text: var(--base-3, #fff);
    --dgw-color-card-bg: var(--base-3, #fff);
    --dgw-color-card-border: var(--base-2, #eee);
    --dgw-color-title: var(--contrast, #000);
    --dgw-color-button-text: var(--base-3, #fff);
    --dgw-color-button-grad-start: #eb6528;
    --dgw-color-button-grad-end: #b93300;
    --dgw-color-button-hover-start: #a33605;
    --dgw-color-sale-bg: var(--contrast-2, #707070);
    --dgw-color-sale-text: var(--base-3, #fff);
    --dgw-color-sale-fold: var(--contrast-3, #424242);

    margin-bottom: 40px;
}

/* ---------- SECTION HEADER ---------- */
#deals_gone_wild h2 {
    text-align: center;
    color: var(--dgw-color-header-text);
    background: var(--dgw-color-header-bg);
    padding: 15px;
    margin: 0 0 20px;
}

#deals_gone_wild ul.products {
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 20px;
}

/* ---------- PRODUCT CARDS ---------- */
#deals_gone_wild ul.products li.product {
    position: relative;
    background: var(--dgw-color-card-bg);
    border: 1px solid var(--dgw-color-card-border);
    transition: transform .2s ease;

    /* Force 4-column layout */
    width: calc((100% - 60px) / 4);
    float: none;
    margin: 0;

    /* Flex column for vertical alignment */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 1em 0 1.5em;
}

#deals_gone_wild ul.products li.product:hover {
    transform: translateY(-1em);
}

/* ---------- PRODUCT IMAGE ---------- */
#deals_gone_wild ul.products li.product img {
    height: 243px;
    transform: scale(.7);
    margin: -36px 0 0;
    object-fit: contain;
}

/* ---------- PRODUCT TITLE ---------- */
#deals_gone_wild ul.products li.product .woocommerce-loop-product__title {
    font-size: 1em;
    font-family: inherit;
    color: var(--dgw-color-title);
    text-align: center;
    margin: 0 0 .7em;
    background: none;

    /* Fixed height for 1-2 lines */
    min-height: 3.8em;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* ---------- PRICING ---------- */
#deals_gone_wild ul.products li.product .price {
    display: block;
    text-align: center;
    position: static;
    margin: auto 0 16px;
    line-height: 1.4em;
}

#deals_gone_wild ul.products li.product .price del {
    display: block;
    opacity: 0.5;
    margin-bottom: 4px;
}

#deals_gone_wild ul.products li.product .price ins {
    display: block;
    font-weight: 700;
    background: transparent;
}

/* ---------- STAR RATING ALIGNMENT ---------- */
#deals_gone_wild ul.products li.product .star-rating {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* ---------- ADD TO CART BUTTON ---------- */
#deals_gone_wild ul.products li.product .button {
    display: block;
    position: static;
    margin: auto 0 0 0;
    width: 80%;
    padding: 12px 15px;
    color: var(--dgw-color-button-text);
    background-image: linear-gradient(var(--dgw-color-button-grad-start) 0%, var(--dgw-color-button-grad-end) 100%);
    border-radius: 3px;
    font-weight: 400;
    font-size: 14px;
    text-align: center;
    white-space: nowrap;
}

#deals_gone_wild ul.products li.product .button:hover {
    background-image: linear-gradient(var(--dgw-color-button-hover-start) 0%, var(--dgw-color-button-grad-end) 100%);
}

/* DGW check-deal icon + label spacing */
#deals_gone_wild ul.products li.product a.button.dealarious-check-deal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

#deals_gone_wild .dealarious-check-deal .ds-check-deal-icon {
    display: inline-flex;
    align-items: center;
    line-height: 0;
    flex-shrink: 0;
    position: relative;
    top: -1px;
}

#deals_gone_wild .dealarious-check-deal .ds-check-deal-icon svg {
    display: block;
    overflow: visible;
}

/* ---------- SALE BADGE ---------- */
#deals_gone_wild .onsale,
#deals_gone_wild span.loop-onsale {
    position: absolute;
    top: 8px;
    right: -12px;
    left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 90px;
    min-height: 24px;
    padding: 0 12px;
    border-radius: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.1;
    background: #707070;
    color: #ffffff;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    text-align: center;
    z-index: 5;
}

#deals_gone_wild .onsale:after,
#deals_gone_wild span.loop-onsale:after {
    content: '';
    position: absolute;
    top: -4px;
    right: 2px;
    width: 0;
    height: 0;
    border-top: 0 solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 14px solid #424242;
    border-left: 6px solid #424242;
    background: transparent;
    transform: rotate(-158deg);
    z-index: -1;
    pointer-events: none;
}

/* ======================================================
   RESPONSIVE BREAKPOINTS
   ====================================================== */

/* ---------- TABLETS (<=1024px) ---------- */
@media (max-width: 1024px) {
    #deals_gone_wild ul.products {
        flex-wrap: wrap;
    }

    #deals_gone_wild ul.products li.product {
        width: calc((100% - 20px) / 2);
        margin-bottom: 0;
    }

    #deals_gone_wild .onsale,
    #deals_gone_wild span.loop-onsale {
        right: -4px;
        min-width: 90px;
        min-height: 24px;
        padding: 0 12px;
        font-size: 13px;
    }
}

@media (max-width: 767px) {
    #deals_gone_wild .onsale,
    #deals_gone_wild span.loop-onsale {
        right: -4px;
    }
}

/* ---------- MOBILE (<=767px) ---------- */
@media (max-width: 767px) {
    #deals_gone_wild ul.products li.product {
        width: calc((100% - 20px) / 2);
        margin-bottom: 0;
    }

    #deals_gone_wild ul.products li.product .button {
        font-size: 14px;
        padding: 12px 15px;
    }
}

@media (max-width: 540px) {
    #deals_gone_wild ul.products li.product {
        width: 100%;
    }
}
