/* ==========================================================================
   THE PHONE'S CART OVERPAGE (Components/ShoppingCartOverpage) IN THE DESKTOP FLYOUT'S DESIGN
   (flyoutCart.less, measured there), and its «جزئیات پرداخت» sheet
   (Components/ShoppingCartOverpageBottom, cart-overpage.js) - Digikala's payment details.

   The overpage keeps the theme's older rules on .vp-product-item-theme / .vp-quantity, so
   every rule here starts at `html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc`.
   ========================================================================== */

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc {
    --tc-oc-ink: #1F1F1F;
    --tc-oc-muted: #9A9A9A;
    --tc-oc-line: #F2F2F2;
    --tc-oc-green: #00B31D;
    padding: 12px 16px 0;
    background: #FFFFFF;
    font-family: yekanbakh, tahoma, sans-serif;
    color: var(--tc-oc-ink);
    text-align: right;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc .vp-cart-box {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

/* ---------------------------------------------------------------- title */

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__title {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--tc-oc-line);
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__title-text {
    font-size: 14px;
    font-weight: 700;
    line-height: 22px;
    color: var(--tc-oc-ink);
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__title-count {
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    color: var(--tc-oc-muted);
}

/* ---------------------------------------------------------------- free shipping */

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__shipping {
    display: grid;
    margin-bottom: 4px;
}

/* the two captions share one cell, so reaching the threshold cross-fades in place */
html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__shipping-caption {
    display: flex;
    grid-area: 1 / 1;
    align-items: center;
    gap: 4px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
    color: var(--tc-oc-green);
    transition: opacity .22s ease;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__shipping-caption img {
    width: 16px;
    height: 16px;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__shipping-caption--reached,
html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__shipping.is-reached .tc-oc__shipping-caption--pending,
html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__shipping.is-reached .tc-oc__shipping-note {
    opacity: 0;
    pointer-events: none;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__shipping.is-reached .tc-oc__shipping-caption--reached {
    opacity: 1;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__progress {
    grid-area: 2 / 1;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #EFEFEF;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__progress-bar {
    height: 100%;
    border-radius: 999px;
    background: var(--tc-oc-green);
    transition: width .32s cubic-bezier(.22, .61, .36, 1);
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__shipping-note {
    display: flex;
    grid-area: 3 / 1;
    align-items: center;
    gap: 4px;
    width: fit-content;
    margin-top: 8px;
    margin-right: auto;
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
    color: var(--tc-oc-muted);
    transition: opacity .22s ease;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__shipping-note [data-tc-oc-remaining] {
    font-weight: 700;
    color: #0C0C0C;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__amount {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ---------------------------------------------------------------- the currency mark
   the product card's Toman mark in place of the word, as the flyout paints it */

html body .tc-oc__unit,
html body .tc-cs__unit {
    display: inline-flex;
    align-items: center;
    font-size: 0;
    vertical-align: middle;
}

html body .tc-oc__unit::before,
html body .tc-cs__unit::before {
    content: "";
    display: inline-block;
    width: 15px;
    height: 15px;
    background: url("/lib/themes/ryan/assets/product-card/toman.svg") center / contain no-repeat;
}

html body .tc-oc__unit--lg::before {
    width: 24px;
    height: 24px;
}

/* ---------------------------------------------------------------- one line */

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc .vp-products {
    margin: 0;
    padding: 0;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc .vp-product-item-theme.tc-oc-item,
html body .tc-cp .tc-oc .km-product.tc-oc-item {
    display: grid;
    /* RTL: the first track is the right one - the photo beside the name, the stepper under it */
    grid-template-columns: 88px minmax(0, 1fr);
    grid-template-areas:
        "media body"
        "quantity prices";
    column-gap: 12px;
    row-gap: 10px;
    align-items: start;
    box-sizing: border-box;
    width: auto;
    height: auto;
    margin: 0;
    padding: 14px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc .vp-product-item-theme.tc-oc-item + .tc-oc-item,
html body .tc-cp .tc-oc .km-product.tc-oc-item + .km-product.tc-oc-item {
    border-top: 1px solid var(--tc-oc-line);
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__media {
    display: block;
    grid-area: media;
    width: 88px;
    height: 88px;
    overflow: hidden;
    border-radius: 14px;
    background: #F7F7F7;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__body {
    display: flex;
    grid-area: body;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__title {
    display: -webkit-box;
    max-height: 44px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    margin-bottom: 2px;
    font-size: 13px;
    font-weight: 600;
    line-height: 22px;
    color: var(--tc-oc-ink);
    text-decoration: none;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__facts {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__fact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    font-size: 12px;
    line-height: 18px;
    color: #8F8F8F;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__fact-text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__swatch {
    display: inline-block;
    flex: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__swatch--pattern {
    overflow: hidden;
    border-radius: 4px;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__swatch--pattern img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__fact--seller svg {
    width: 16px;
    height: 16px;
    flex: none;
    color: #62666D;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item .km-warning-container .alert {
    margin: 4px 0 0;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 18px;
}

/* the stepper: the store's own V3 control, only placed here */
html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc .vp-quantity.tc-oc-item__quantity {
    position: static;
    grid-area: quantity;
    align-self: center;
    width: auto;
    margin: 0;
    padding: 0;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__prices {
    grid-area: prices;
    align-self: center;
    min-width: 0;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__discount {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    line-height: 20px;
    color: var(--ryan-primary, #EF4056);
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc-item__price {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 18px;
    font-weight: 700;
    line-height: 26px;
    color: var(--tc-oc-ink);
}

/* ---------------------------------------------------------------- the note under the lines */

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 6px 0 24px;
    padding: 12px;
    border-radius: 12px;
    background: #F5F5F6;
    font-size: 12px;
    line-height: 20px;
    color: #62666D;
}

html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__note svg {
    width: 18px;
    height: 18px;
    flex: none;
    margin-top: 1px;
}

/* ==========================================================================
   «جزئیات پرداخت» - the sheet the summary bar's chevron (or its total) opens
   ========================================================================== */

.tc-cs {
    position: fixed;
    inset: 0;
    z-index: 10080;
    display: flex;
    align-items: flex-end;
    visibility: hidden;
    font-family: yekanbakh, tahoma, sans-serif;
    text-align: right;
    direction: rtl;
}

.tc-cs.is-open {
    visibility: visible;
}

.tc-cs__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 12, 12, .5);
    opacity: 0;
    transition: opacity .24s ease;
}

.tc-cs.is-open .tc-cs__backdrop {
    opacity: 1;
}

.tc-cs__sheet {
    /* pinned to the bottom edge itself: the theme's .justMobileTablet sets the wrapper's
       display, so its flex alignment cannot be relied on */
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    box-sizing: border-box;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 0 0 calc(16px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    background: #FFFFFF;
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.22, 1, .36, 1);
    overscroll-behavior: contain;
}

.tc-cs.is-open .tc-cs__sheet {
    transform: none;
}

.tc-cs__handle {
    display: block;
    width: 40px;
    height: 4px;
    margin: 10px auto 0;
    border-radius: 999px;
    background: #E0E0E2;
}

.tc-cs__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 16px 16px;
}

.tc-cs__title {
    flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 26px;
    color: #0C0C0C;
}

.tc-cs__close {
    display: grid;
    width: 32px;
    height: 32px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #0C0C0C;
    cursor: pointer;
}

.tc-cs__close svg {
    width: 22px;
    height: 22px;
}

.tc-cs__info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 16px 8px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #F5F5F6;
    font-size: 13px;
    line-height: 22px;
    color: #424750;
}

.tc-cs__info svg {
    width: 20px;
    height: 20px;
    flex: none;
    margin-top: 1px;
    color: #0C0C0C;
}

.tc-cs__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 4px 16px;
    font-size: 14px;
    line-height: 24px;
    color: #424750;
}

.tc-cs__row[hidden] {
    display: none;
}

.tc-cs__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tc-cs__label svg {
    width: 20px;
    height: 20px;
    flex: none;
}

.tc-cs__value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: #424750;
    white-space: nowrap;
}

.tc-cs__row--profit {
    background: #EBF7EE;
    color: #008D1E;
}

.tc-cs__row--profit .tc-cs__value {
    font-weight: 700;
    color: #008D1E;
}

.tc-cs__row--total {
    color: #0C0C0C;
}

.tc-cs__row--total .tc-cs__label {
    font-weight: 600;
}

.tc-cs__row--total .tc-cs__value {
    font-size: 15px;
    font-weight: 700;
    color: #0C0C0C;
}

.tc-cs__was {
    font-size: 12px;
    font-weight: 400;
    color: #A1A3A8;
    text-decoration: line-through;
}

.tc-cs__was[hidden] {
    display: none;
}

.tc-cs__ok {
    display: block;
    box-sizing: border-box;
    width: calc(100% - 32px);
    height: 48px;
    margin: 16px 16px 0;
    border: 1px solid #0C0C0C;
    border-radius: 12px;
    background: #FFFFFF;
    color: #0C0C0C;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* the summary bar: its total opens the sheet too */
.vp-mobile-cart-footer-bottom-sheet .vp-container-title-cart,
.vp-mobile-cart-footer-bottom-sheet .pay-btn-icon {
    cursor: pointer;
}

html.tc-cs-lock,
html.tc-cs-lock body {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .tc-cs__backdrop,
    .tc-cs__sheet,
    html body :is(.vp-over-page[vp-id="cart"], .tc-cp) .tc-oc__progress-bar {
        transition: none;
    }
}

/* ------------------------------------------------- the cart page (.tc-cp) only */

html body .tc-cp {
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
}

html body .tc-cp .tc-oc .km-cart-product-list {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

/* the line's price before its discount, struck (cart.js rewrites it with the quantity) */
html body .tc-cp .tc-oc-item__was {
    color: var(--tc-oc-muted);
    font-size: 12px;
    line-height: 18px;
    text-decoration: line-through;
}

html body .tc-cp .tc-oc-item__fact--deal {
    color: rgb(var(--ryan-primary-rgb, 239, 64, 86));
    font-weight: 600;
}

html body .tc-cp .tc-oc__note {
    margin-bottom: 16px;
}

/* the page's gutters are the over-page's: 16px to the screen's edge (the page adds 8 of them) */
html body .tc-cp .tc-oc {
    padding: 4px 8px 0 !important;
}

/* the cart step's totals live in «جزئیات پرداخت» (the bar's chevron or total opens it,
   cart-overpage.js), as in the over-page; the list that stood half under the bar goes */
@media only screen and (max-width: 959px) {
    html body.page-cart #footerCart .km-cart-content-left.cart-box {
        display: none !important;
    }
}
