/* =====================================================================
   StakeAlix UI refresh - product card partial + quick view (global layer)
   Markup: resources/views/frontEnd/layouts/partials/product_card.blade.php
           resources/views/frontEnd/layouts/ajax/quickview.blade.php
   Uses tokens and .sa-stage / .sa-btn / .sa-deal / .sa-price / .sa-was from sa-theme.css.
   Everything is scoped to .sa-card / .sa-qv. The legacy .product_item, .wist_item and
   .product_item_inner rules in style.css + responsive.css (orange border, 5px padding,
   30px bottom margin, !important hover border) are neutralised here.
   ===================================================================== */

/* ---------- card shell ---------- */

.product_item.sa-card {
    container: sa-card / inline-size;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    background: var(--sa-card);
    border: 1px solid var(--sa-line);
    border-radius: var(--sa-r-lg);
    box-shadow: var(--sa-shadow-1);
    font-family: var(--sa-font);
    color: var(--sa-ink);
    text-align: left;
    transition: transform 0.22s var(--sa-ease), box-shadow 0.22s var(--sa-ease);
}

/* legacy: .product_item:hover { border-color: #ff6700 !important } */
.product_item.sa-card:hover,
.product_item.sa-card:focus-within {
    border-color: var(--sa-line) !important;
}

.product_item.sa-card:focus-within {
    box-shadow: var(--sa-shadow-2);
}

@media (hover: hover) {
    .product_item.sa-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--sa-shadow-2);
    }

    .product_item.sa-card:hover .sa-card__stage img {
        transform: scale(1.03);
    }
}

.product_item.sa-card .product_item_inner {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    border: 0;
    transition: none;
}

/* ---------- image stage + deal chip ---------- */

.product_item.sa-card .sa-card__media {
    position: relative;
    padding: 8px 8px 0;
}

.product_item.sa-card .sa-card__stage {
    display: block;
    height: auto;
    border-radius: var(--sa-r-md);
}

.product_item.sa-card .sa-card__stage img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
}

.product_item.sa-card .sa-card__deal {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 2;
    padding: 3px 8px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
    box-shadow: 0 6px 14px -6px rgba(220, 39, 80, 0.7);
    pointer-events: none;
}

/* ---------- name + price ---------- */

.product_item.sa-card .sa-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 6px;
    padding: 12px 12px 0;
}

.product_item.sa-card .sa-card__name {
    height: auto;
    min-height: 2.9em;
    margin: 0;
    padding: 0;
    color: var(--sa-ink-2);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
}

/* the two-line clamp sits on the link itself, so its keyboard focus ring is not clipped */
.product_item.sa-card .sa-card__name a {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    border-radius: 4px;
    color: inherit;
    font: inherit;
    text-decoration: none;
    text-transform: none;
    overflow-wrap: anywhere;
}

.product_item.sa-card .sa-card__name a:hover {
    color: var(--sa-ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.product_item.sa-card .sa-card__price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 8px;
    row-gap: 0;
    margin: auto 0 0;
    padding: 0;
    line-height: 1.25;
}

.product_item.sa-card .sa-card__now {
    color: var(--sa-ink);
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

.product_item.sa-card .sa-card__was {
    color: var(--sa-muted);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.product_item.sa-card .sa-card__cur {
    margin-right: 1px;
    font-size: 0.82em;
    font-weight: 600;
}

/* ---------- order CTA (one charge button per card) ---------- */

.product_item.sa-card .sa-card__action {
    padding: 12px 8px 8px;
}

.product_item.sa-card .sa-card__form {
    margin: 0;
    text-align: left;
}

.product_item.sa-card .sa-card__cta,
.product_item.sa-card .sa-card__cta:hover,
.product_item.sa-card .sa-card__cta:focus {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    gap: 7px;
    border: 0;
    border-radius: var(--sa-r-pill);
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    text-decoration: none;
    /* a tighter version of --sa-shadow-cta so the glow stays inside the card's 8px bottom inset;
       !important because legacy style.css strips every button shadow with !important */
    box-shadow: 0 6px 14px -8px rgba(220, 39, 80, 0.6) !important;
}

.product_item.sa-card .sa-card__cta:hover {
    box-shadow: 0 8px 18px -8px rgba(220, 39, 80, 0.7) !important;
}

.product_item.sa-card .sa-card__cta svg {
    flex: none;
    width: 15px;
    height: 15px;
}

/* ---------- Owl carousels that hold cards: equal heights + room for the hover lift ---------- */

.owl-carousel .owl-stage-outer:has(.product_item.sa-card) {
    padding: 6px 0 22px;
    margin: -6px 0 -22px;
}

.owl-carousel .owl-stage:has(> .owl-item > .product_item.sa-card) {
    display: flex;
}

.owl-carousel .owl-stage:has(> .owl-item > .product_item.sa-card)::after {
    display: none;
}

.owl-carousel .owl-stage:has(> .owl-item > .product_item.sa-card) > .owl-item {
    display: flex;
    flex: 0 0 auto;
    float: none;
}

.owl-carousel .owl-item > .product_item.sa-card {
    width: 100%;
}

/* ---------- the card adapts to its own width (grid, carousel, 2-up phone) ---------- */

/* narrow cards (two-up on 320-360px phones): tighter insets and no icon, but type stays on the
   12/14/16/18 scale and the CTA keeps 18px bold, so white on the charge gradient is still large text */
@container sa-card (max-width: 150px) {
    .product_item.sa-card .sa-card__media {
        padding: 6px 6px 0;
    }

    .product_item.sa-card .sa-card__deal {
        top: 11px;
        left: 11px;
        padding: 2px 6px;
    }

    .product_item.sa-card .sa-card__body {
        gap: 4px;
        padding: 10px 8px 0;
    }

    .product_item.sa-card .sa-card__now {
        font-size: 16px;
    }

    .product_item.sa-card .sa-card__was {
        font-size: 12px;
    }

    .product_item.sa-card .sa-card__action {
        padding: 10px 6px 6px;
    }

    .product_item.sa-card .sa-card__cta,
    .product_item.sa-card .sa-card__cta:hover,
    .product_item.sa-card .sa-card__cta:focus {
        padding: 0 6px;
    }

    .product_item.sa-card .sa-card__cta svg {
        display: none;
    }
}

/* last resort for very narrow slots: shrink the label rather than let it spill out of the pill */
@container sa-card (max-width: 118px) {
    .product_item.sa-card .sa-card__cta,
    .product_item.sa-card .sa-card__cta:hover,
    .product_item.sa-card .sa-card__cta:focus {
        font-size: 16px;
    }
}

@container sa-card (min-width: 240px) {
    .product_item.sa-card .sa-card__media {
        padding: 10px 10px 0;
    }

    .product_item.sa-card .sa-card__deal {
        top: 20px;
        left: 20px;
    }

    .product_item.sa-card .sa-card__body {
        padding: 14px 14px 0;
    }

    .product_item.sa-card .sa-card__action {
        padding: 14px 10px 10px;
    }
}

/* =====================================================================
   Quick view - ajax/quickview.blade.php is injected into #custom-modal
   ===================================================================== */

.modal-view.sa-qv {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    z-index: 99999;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 28px;
    width: min(920px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px;
    transform: translate(-50%, -50%);
    background: var(--sa-card);
    border: 1px solid var(--sa-line);
    border-radius: var(--sa-r-xl);
    box-shadow: 0 32px 80px -24px rgba(14, 21, 48, 0.5);
    font-family: var(--sa-font);
    color: var(--sa-ink);
    text-align: left;
}

.sa-qv .sa-qv__close,
.sa-qv .sa-qv__close:focus {
    position: absolute;
    top: 14px;
    right: 14px;
    left: auto;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--sa-surface);
    color: var(--sa-ink);
    font-size: 0;
    transform: none;
    box-shadow: inset 0 0 0 1px var(--sa-line) !important;
    cursor: pointer;
    transition: background-color 0.15s;
}

.sa-qv .sa-qv__close:hover {
    background: var(--sa-surface-2);
}

.sa-qv .sa-qv__close svg {
    width: 18px;
    height: 18px;
}

.sa-qv .sa-qv__media {
    align-self: start;
    width: 100%;
    float: none;
}

.sa-qv .sa-qv__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: auto;
    float: none;
    padding: 6px 0 0;
}

.sa-qv .sa-qv__title {
    margin: 0 48px 12px 0;
    color: var(--sa-ink);
    font-size: 24px;
    font-weight: 700;
    font-stretch: 106%;
    line-height: 1.25;
    text-transform: none;
}

.sa-qv .sa-qv__price {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    margin: 0 0 16px;
}

.sa-qv .sa-qv__now {
    font-size: 30px;
    line-height: 1.1;
}

.sa-qv .sa-qv__was {
    font-size: 18px;
}

.sa-qv .sa-qv__cur {
    margin-right: 2px;
    font-size: 0.78em;
    font-weight: 600;
}

.sa-qv .sa-qv__price .sa-deal {
    padding: 4px 9px;
    font-size: 13px;
}

.sa-qv .sa-qv__desc {
    max-height: 10.2em;
    overflow: hidden;
    margin: 0 0 20px;
    color: var(--sa-ink-2);
    font-size: 15px;
    line-height: 1.7;
}

/* long descriptions end in a soft fade (class set by the quick view script only when the text
   overflows); the full text is one tap away through "বিস্তারিত দেখুন" */
.sa-qv .sa-qv__desc.is-clipped {
    -webkit-mask-image: linear-gradient(180deg, var(--sa-ink) calc(100% - 3em), transparent);
    mask-image: linear-gradient(180deg, var(--sa-ink) calc(100% - 3em), transparent);
}

.sa-qv .sa-qv__desc p,
.sa-qv .sa-qv__desc li,
.sa-qv .sa-qv__desc span {
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

.sa-qv .sa-qv__desc p {
    margin: 0 0 0.5em;
}

.sa-qv .sa-qv__desc ul,
.sa-qv .sa-qv__desc ol {
    margin: 0 0 0.5em;
    padding-left: 1.25em;
}

/* legacy style.css makes every li inline-block with no marker */
.sa-qv .sa-qv__desc li {
    display: list-item;
    margin: 0 0 0.15em;
}

.sa-qv .sa-qv__desc ul > li {
    list-style: disc outside;
}

.sa-qv .sa-qv__desc ol > li {
    list-style: decimal outside;
}

.sa-qv .sa-qv__desc li::marker {
    color: var(--sa-muted);
}

.sa-qv .sa-qv__desc > :last-child {
    margin-bottom: 0;
}

.sa-qv .sa-qv__form {
    margin: 0;
}

.sa-qv .sa-qv__buy {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sa-qv .sa-qv__qty {
    display: inline-flex;
    flex: none;
    align-items: center;
    height: 52px;
    padding: 4px;
    border-radius: var(--sa-r-pill);
    background: var(--sa-card);
    box-shadow: inset 0 0 0 1.5px var(--sa-line-strong);
}

.sa-qv .sa-qv__step,
.sa-qv .sa-qv__step:focus {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--sa-surface);
    color: var(--sa-ink);
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s;
}

.sa-qv .sa-qv__step:hover {
    background: var(--sa-surface-2);
}

.sa-qv .sa-qv__qty input {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--sa-ink);
    font-size: 17px;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.sa-qv .sa-qv__cta,
.sa-qv .sa-qv__cta:hover,
.sa-qv .sa-qv__cta:focus {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 52px;
    padding: 0 22px;
    font-size: 18px;
    text-transform: none;
    box-shadow: var(--sa-shadow-cta) !important;
}

.sa-qv .sa-qv__cta svg {
    flex: none;
    width: 17px;
    height: 17px;
}

.sa-qv .sa-qv__more {
    align-self: flex-start;
    margin-top: 14px;
    font-size: 15px;
}

.sa-qv .sa-qv__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--sa-line);
}

.sa-qv .sa-qv__meta .sa-chip {
    color: var(--sa-muted);
}

.sa-qv .sa-qv__meta .sa-chip strong {
    color: var(--sa-ink);
    font-weight: 600;
}

@media (max-width: 575.98px) {
    .modal-view.sa-qv {
        top: auto;
        bottom: 0;
        left: 0;
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
        width: 100%;
        max-height: 90vh;
        padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
        transform: none;
        border-width: 1px 0 0;
        border-radius: var(--sa-r-xl) var(--sa-r-xl) 0 0;
    }

    .sa-qv .sa-qv__media {
        justify-self: center;
        width: 56%;
        max-width: 220px;
    }

    .sa-qv .sa-qv__body {
        padding-top: 0;
    }

    .sa-qv .sa-qv__title {
        margin-right: 0;
        font-size: 20px;
    }

    .sa-qv .sa-qv__now {
        font-size: 24px;
    }

    .sa-qv .sa-qv__was {
        font-size: 16px;
    }

    .sa-qv .sa-qv__desc {
        display: none;
    }

    .sa-qv .sa-qv__qty {
        height: 48px;
    }

    .sa-qv .sa-qv__step,
    .sa-qv .sa-qv__qty input {
        width: 40px;
        height: 40px;
    }

    .sa-qv .sa-qv__cta,
    .sa-qv .sa-qv__cta:hover,
    .sa-qv .sa-qv__cta:focus {
        min-height: 48px;
        padding: 0 14px;
        font-size: 17px;
    }
}
