.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(42, 50, 54, 0.48);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* کانتینر اصلی سبد خرید (سمت راست صفحه) */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    /* خارج از صفحه به صورت پیش‌فرض */
    width: min(460px, 100vw);
    height: 100dvh;
    background-color: var(--bg-cart);
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transform: translateX(105%);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1001;
    overflow: hidden;
}

.cart-drawer.active {
    transform: translateX(0);
    /* نمایش در صفحه */
}

/* هدر سبد خرید */
.cart-header {
    flex: 0 0 auto;
    padding: 24px 24px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    margin: 0;
}

.cart-close-btn {
    background: transparent;
    border: 1px solid var(--brand-dark);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--brand-dark);
}

/* بخش اسکرول‌خور محتوای سبد */
.cart-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0 24px;
}

/* نوار پیشرفت ارسال رایگان */
.free-shipping-wrap {
    margin-bottom: 24px;
}

.free-shipping-text {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.progress-bar-bg {
    height: 6px;
    background-color: rgba(42, 50, 54, 0.16);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--progress-blue);
    width: 70%;
    /* درصد پیشرفت تستی */
}

/* آیتم سبد خرید */
.cart-item {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    padding: 20px 0;
    border-bottom: 1px solid var(--hairline);
    position: relative;
}

.cart-item-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin: 0;
    mix-blend-mode: multiply;
}

.cart-item-info {
    flex-grow: 1;
}

.cart-item-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.cart-item-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.cart-item-price {
    font-size: 13px;
    font-weight: 600;
}

/* کانتینر دربرگیرنده انتخاب‌گر تعداد و دکمه حذف */
.cart-item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

/* کادر یکپارچه انتخاب تعداد */
.quantity-selector {
    display: flex;
    align-items: center;
    width: auto;
    min-width: 0;
    height: 38px;
    border: 1px solid var(--hairline);
    background-color: transparent;
    padding: 0 5px;
    gap: 5px;
}

/* دکمه‌های مثبت و منفی */
.quantity-selector .qty-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    font-weight: 400;
    color: #2A3236;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.quantity-selector .qty-btn:hover {
    opacity: 0.6;
}

/* عدد وسط کادر */
.quantity-selector .qty-number {
    font-family: 'Dana', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #2A3236;
    user-select: none;
}

.cart-qty-input {
    width: 54px;
    padding: 5px 6px;
    border: 0;
    border-inline: 1px solid var(--hairline);
    border-radius: 0;
    background: transparent;
    color: var(--color-text-dark);
    font: inherit;
    font-size: 12px;
    text-align: center;
}

.update-btn {
    border: 0;
    border-radius: 6px;
    padding: 6px 9px;
    background: var(--color-accent);
    color: var(--color-bg-white);
    cursor: pointer;
    font: inherit;
    font-size: 11px;
}

.update-btn:disabled {
    opacity: .6;
    cursor: wait;
}

/* دکمه سطل زباله */
.remove-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #2A3236;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.remove-btn:hover {
    color: #C27A33; /* تغییر به رنگ نارنجی برند در حالت هاور */
}

/* بخش شاید بپسندید (Cross-sell) */
/* بخش شاید بپسندید (Cross-sell) */
.cross-sell-section {
    padding: 24px 0 32px;
    border-top: 1px solid #2A3236; /* خط جداکننده تیره */
    margin-top: auto; /* برای قرارگیری در پایین سبد خرید */
}

.cross-sell-title {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 32px;
    letter-spacing: 1.5px; /* افزایش فاصله حروف مشابه طرح اصلی */
    color: var(--brand-dark);
}

.cross-sell-item {
    display: flex;
    align-items: center; /* تراز عمودی مرکز بین تصویر و باکس متن/دکمه */
}

.cross-sell-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-left: 24px; /* فاصله از سمت چپ تصویر در حالت RTL */
    mix-blend-mode: multiply;
}

.cross-sell-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.cross-sell-name {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: 1px;
    color: var(--brand-dark);
}

.btn-outline-add {
    width: 100%;
    padding: 10px 0; /* ارتفاع دکمه مشابه عکس */
    background: transparent;
    border: 1px solid #2A3236;
    color: #2A3236;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline-add:hover {
    background: #2A3236;
    color: #f6f6f3;
}

/* صفحه‌بندی بخش پیشنهاد */
.cross-sell-pagination {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 40px;
    font-size: 12px;
    font-weight: 600;
    color: #8A857E; /* رنگ کمرنگ‌تر برای اعداد غیرفعال */
    letter-spacing: 1px;
}

.cross-sell-pagination span {
    cursor: pointer;
    transition: color 0.2s;
}

.cross-sell-pagination span:hover {
    color: #687176;
}

.cross-sell-pagination span.active {
    color: #2A3236; /* رنگ تیره برای عدد فعال */
    font-weight: 700;
}


/* فوتر سبد خرید (تخفیف، جمع کل و پرداخت) */
.cart-footer {
    padding: 24px 32px 32px; /* فاصله‌های دقیق‌تر مطابق عکس */
    border-top: 1px solid #2A3236; /* خط تیره بالای فوتر */
    background-color: var(--bg-cart, #f6f6f3);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.discount-row {
    color: #27813b; /* رنگ سبز دقیقاً مشابه تصویر */
    font-size: 13px;
    font-weight: 500;
}

.total-row {
    color: #2A3236;
    font-weight: 700;
    font-size: 12px; /* کمی کوچکتر و برجسته‌تر */
    margin-bottom: 24px;
    letter-spacing: 1.5px; /* فاصله حروف مشابه طرح اصلی */
}

.btn-checkout {
    width: 100%;
    background-color: #2A3236; /* رنگ تیره برند شما که مشابه عکس است */
    color: #f6f6f3 ;
    border: none;
    padding: 18px 0; /* ارتفاع بیشتر دکمه */
    font-family: inherit;
    font-size: 14px;
    font-weight: 500; /* وزن فونت نرمال‌تر برای دکمه */
    cursor: pointer;
    margin-bottom: 24px;
    transition: opacity 0.2s ease;
}

.btn-checkout:hover {
    opacity: 0.85; /* افکت هاور ملایم‌تر بدون تغییر رنگ کامل */
}

.cart-footer-links {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px; /* فاصله بین دو لینک */
}

.cart-footer-links a {
    color: #2A3236;
    font-size: 13px;
    text-decoration: underline;
    text-decoration-thickness: 1px; /* ضخامت خط زیرین */
    text-underline-offset: 3px; /* فاصله خط زیرین از متن مشابه عکس */
    transition: color 0.2s;
}

.cart-footer-links a:hover {
    color: #555; /* کمی روشن‌تر در حالت هاور */
}

/* ====== FLOATING CART DRAWER — POLISHED LAYOUT ====== */
.cart-drawer,
.cart-drawer * {
    box-sizing: border-box;
}

.cart-drawer {
    width: min(488px, 100vw);
    max-width: 100vw;
    background: #f8f8f6;
    color: #11181c;
    border-left: 1px solid rgba(17, 24, 28, .1);
}

.cart-drawer .cart-header {
    min-height: 92px;
    padding: 26px 28px 18px;
    border-bottom: 0;
}

.cart-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cart-kicker,
.cross-sell-kicker {
    color: #11181c;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .18em;
    line-height: 1.2;
    text-transform: uppercase;
}

.cart-drawer .cart-title {
    color: #11181c;
    font-size: 23px;
    font-weight: 500;
    letter-spacing: .08em;
    line-height: 1.2;
}

.cart-drawer .cart-close-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #1b252a;
    color: #1b252a;
    transition: background-color .2s ease, color .2s ease;
}

.cart-drawer .cart-close-btn:hover {
    background: #1b252a;
    color: #f8f8f6;
}

.cart-drawer .cart-body {
    padding: 0 28px;
    scrollbar-width: thin;
    scrollbar-color: rgba(17, 24, 28, .28) transparent;
}

.cart-drawer .free-shipping-wrap {
    margin: 0;
    padding: 0 0 15px;
    border-bottom: 1px solid rgba(17, 24, 28, .24);
}

.free-shipping-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
    color: #11181c;
    font-size: 11px;
    letter-spacing: .13em;
    line-height: 1.5;
    text-transform: uppercase;
}

.free-shipping-row strong {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .05em;
    white-space: nowrap;
}

.cart-drawer .progress-bar-bg {
    height: 7px;
    border: 1px solid rgba(17, 24, 28, .16);
    border-radius: 999px;
    background: transparent;
}

.cart-drawer .progress-bar-fill {
    display: block;
    height: 100%;
    min-width: 3px;
    border-radius: inherit;
    background: #9ddbea;
    transition: width .45s ease;
}

.cart-drawer .cart-items-container {
    display: flex;
    flex-direction: column;
}

.cart-drawer .cart-item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    padding: 18px 0 19px;
    border-bottom: 1px solid #11181c;
    direction: ltr;
    transition: opacity .28s ease, transform .28s ease;
}

.cart-drawer .cart-item.is-updating {
    opacity: .62;
}

.cart-drawer .cart-item.is-removing {
    opacity: 0;
    pointer-events: none;
    transform: translateX(18px);
}

.cart-drawer .cart-item-media {
    display: grid;
    width: 76px;
    height: 76px;
    place-items: center;
}

.cart-drawer .cart-item-img {
    width: 76px;
    height: 76px;
    margin: 0;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.cart-drawer .cart-item-info {
    min-width: 0;
    direction: rtl;
}

.cart-drawer .cart-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
}

.cart-item-copy {
    min-width: 0;
}

.cart-drawer .cart-item-title {
    display: block;
    overflow: hidden;
    color: #11181c;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .13em;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-item-variant {
    display: block;
    margin-top: 3px;
    color: #697277;
    font-size: 10px;
    line-height: 1.5;
}

.cart-drawer .cart-item-price {
    flex: 0 0 auto;
    color: #11181c;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.cart-drawer .cart-item-price small {
    font-size: 9px;
    font-weight: 400;
}

.cart-drawer .cart-item-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 17px;
    direction: ltr;
}

.cart-drawer .quantity-selector {
    display: inline-flex;
    width: 80px;
    height: 27px;
    min-width: 80px;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0;
    border: 1px solid #11181c;
}

.cart-drawer .quantity-selector .qty-btn {
    width: 24px;
    height: 25px;
    color: #11181c;
    font-size: 15px;
    line-height: 1;
}

.cart-drawer .quantity-selector .qty-btn:hover {
    background: #11181c;
    color: #f8f8f6;
    opacity: 1;
}

.cart-drawer .cart-qty-input {
    width: 30px;
    height: 25px;
    padding: 0;
    border-inline: 1px solid rgba(17, 24, 28, .25);
    color: #11181c;
    font-size: 11px;
    line-height: 25px;
}

.cart-drawer .cart-item-unit {
    color: #697277;
    font-size: 10px;
    white-space: nowrap;
}

.cart-drawer .remove-btn {
    width: 26px;
    height: 27px;
    margin-left: auto;
    padding: 0;
    color: #697277;
}

.cart-drawer .remove-btn:hover {
    color: #b46d2c;
}

.cart-drawer .cart-empty-msg {
    display: flex;
    min-height: 220px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    padding: 34px 10px;
    color: #697277;
    text-align: center;
}

.cart-drawer .cart-empty-msg svg {
    margin-bottom: 6px;
}

.cart-drawer .cart-empty-msg strong {
    color: #11181c;
    font-size: 14px;
}

.cart-drawer .cart-empty-msg span {
    font-size: 11px;
}

.cart-drawer .cart-empty-msg a {
    margin-top: 8px;
    color: #b46d2c;
    font-size: 11px;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.cart-drawer .cross-sell-section {
    margin: 0;
    padding: 18px 0 28px;
    border-top: 0;
}

.cross-sell-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.cart-drawer .cross-sell-header h3 {
    margin: 5px 0 0;
    color: #11181c;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.cross-sell-count {
    color: #697277;
    font-size: 10px;
    letter-spacing: .12em;
}

.cart-drawer .cross-sell-track {
    display: flex;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    direction: ltr;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.cart-drawer .cross-sell-track::-webkit-scrollbar {
    display: none;
}

.cart-drawer .cross-sell-item {
    flex: 0 0 100%;
    scroll-snap-align: start;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    direction: ltr;
}

.cart-drawer .cross-sell-image-link {
    display: grid;
    width: 96px;
    height: 96px;
    place-items: center;
    background: #efefec;
}

.cart-drawer .cross-sell-img {
    width: 88px;
    height: 88px;
    margin: 0;
}

.cart-drawer .cross-sell-info {
    min-width: 0;
    direction: rtl;
}

.cart-drawer .cross-sell-name {
    display: block;
    overflow: hidden;
    color: #11181c;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .13em;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-drawer .cross-sell-meta {
    display: block;
    margin: 4px 0 12px;
    color: #697277;
    font-size: 10px;
}

.cart-drawer .btn-outline-add {
    display: flex;
    width: 100%;
    min-height: 27px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 10px;
    border: 1px solid #11181c;
    color: #11181c;
    font-size: 11px;
    line-height: 1.2;
}

.cart-drawer .btn-outline-add strong {
    font-weight: 500;
    white-space: nowrap;
}

.cart-drawer .btn-outline-add:hover {
    background: #11181c;
    color: #f8f8f6;
}

.cart-drawer .cross-sell-pagination {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 20px;
    color: #697277;
    font-size: 10px;
    letter-spacing: .1em;
}

.cart-drawer .cross-sell-pagination span {
    cursor: pointer;
}

.cart-drawer .cross-sell-pagination span.active {
    color: #11181c;
    font-weight: 700;
}

.cart-drawer .cart-footer {
    flex: 0 0 auto;
    padding: 18px 28px 24px;
    border-top: 0;
    background: #f8f8f6;
}

.cart-summary-rule {
    height: 1px;
    margin-bottom: 20px;
    background: #11181c;
}

.cart-drawer .cart-promo-row {
    margin-bottom: 9px;
    color: #27813b;
    font-size: 11px;
}

.cart-drawer .cart-promo-row strong {
    font-weight: 500;
    text-align: left;
}

.cart-drawer .total-row {
    margin-bottom: 17px;
    color: #11181c;
    font-size: 11px;
    letter-spacing: .13em;
}

.cart-drawer .total-row small {
    font-size: 9px;
    font-weight: 400;
}

.cart-drawer .total-row strong {
    font-size: 12px;
    letter-spacing: .04em;
}

.cart-drawer .btn-checkout {
    display: flex !important;
    min-height: 43px;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    padding: 0;
    background: #303030;
    color: #fff;
    font-size: 12px;
    letter-spacing: .02em;
}

.cart-drawer .cart-footer-links {
    gap: 5px;
}

.cart-drawer .cart-footer-links a {
    color: #11181c;
    font-size: 11px;
}

@media (max-width: 520px) {
    .cart-drawer .cart-header,
    .cart-drawer .cart-footer {
        padding-inline: 20px;
    }

    .cart-drawer .cart-body {
        padding-inline: 20px;
    }

    .cart-drawer .cart-item {
        grid-template-columns: 64px minmax(0, 1fr);
        gap: 12px;
    }

    .cart-drawer .cart-item-media,
    .cart-drawer .cart-item-img {
        width: 64px;
        height: 64px;
    }

    .cart-drawer .cart-item-title,
    .cart-drawer .cross-sell-name {
        letter-spacing: .08em;
    }

    .cart-drawer .cross-sell-item {
        grid-template-columns: 84px minmax(0, 1fr);
        gap: 12px;
    }

    .cart-drawer .cross-sell-image-link,
    .cart-drawer .cross-sell-img {
        width: 84px;
        height: 84px;
    }
}
