/* استایل پرلودر */
.pym-mini-cart-wrapper .preloader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 5px;
    z-index: 9999;
}
.pym-mini-cart-wrapper .preloader .dot {
    width: 10px;
    height: 10px;
    background: #0C673B;
    border-radius: 50%;
    animation: bounce 0.4s infinite alternate;
}
.pym-mini-cart-wrapper .preloader .dot:nth-child(2) {
    animation-delay: 0.2s;
}
.pym-mini-cart-wrapper .preloader .dot:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes bounce {
    to {
        transform: translateY(-10px);
    }
}

/* استایل‌های مینی‌سبد خرید */
.pym-mini-cart-wrapper {
    position: relative;
}

.pym-mini-cart-wrapper .pym-mini-cart-toggle {
    position: relative;
    background: #0C673B;
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    transition: background-color 0.3s ease;
    z-index: 16; /* زیر مگامنو در موبایل */
}

.pym-mini-cart-wrapper .pym-mini-cart-toggle:hover {
    background: #094d2e;
}

.pym-mini-cart-wrapper .pym-mini-cart-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: var(--pym-mini-cart-z-index);
    padding: 24px;
    padding-bottom: 5px !important;
    min-height: 300px;
    max-height: 600px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 4px 60px rgba(0, 0, 0, 0.1);
    flex-direction: column;
    overflow: hidden;
    width: 465px;
    transform: translateZ(0); /* بهبود عملکرد در مرورگرهای دسکتاپ */
    will-change: transform; /* بهینه‌سازی برای انیمیشن */
}

.pym-mini-cart-wrapper .pym-mini-cart-content.open {
    display: flex;
}

.pym-mini-cart-wrapper .pym-mini-cart-content::before {
    content: 'سبد خرید';
    font-size: 18px;
    font-weight: 500;
    color: #333;
    display: inline-block;
    right: 24px;
    top: 24px;
    margin-bottom: 5px;
    position: absolute;
    z-index: 10;
}

.pym-mini-cart-wrapper .cart-items-count {
    position: absolute;
    right: 110px;
    top: 22px;
    font-size: 12px;
    font-weight: 400;
    background: #008071;
    color: #FFF;
    padding: 2px 6px;
    border-radius: 8px;
    z-index: 10;
}

/* استایل پیام خالی بودن سبد خرید */
.pym-mini-cart-wrapper .woocommerce-mini-cart__empty-message {
    text-align: center;
    color: #666;
    font-size: 16px;
    margin: 50px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 12px;
    border: 2px dashed #ddd;
}

.woocommerce-mini-cart__empty-message::after {
  display: none;
}

/* بهبود استایل برای حالت خالی بودن سبد خرید */
.pym-mini-cart-wrapper .pym-mini-cart-content:has(.woocommerce-mini-cart__empty-message) {
    min-height: 200px;
    justify-content: center;
    align-items: center;
}

/* انیمیشن برای اضافه شدن محصولات جدید */
.pym-mini-cart-wrapper .woocommerce-mini-cart-item {
    animation: slideInFromTop 0.3s ease-out;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* انیمیشن برای حذف محصولات */
.pym-mini-cart-wrapper .woocommerce-mini-cart-item.removing {
    animation: slideOutToTop 0.3s ease-in forwards;
}

@keyframes slideOutToTop {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.pym-mini-cart-wrapper .woocommerce-mini-cart {
    flex: 0 1 auto !important;
    height: auto;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 2px;
    margin-top: 30px;
    -webkit-overflow-scrolling: touch;
    background: transparent;
    list-style: none;
    padding: 0;
    touch-action: pan-y;
    /* بهبود عملکرد اسکرول در مرورگرهای دسکتاپ */
    scrollbar-width: thin;
    scrollbar-color: #888 #f5f5f5;
}

.pym-mini-cart-wrapper .woocommerce-mini-cart::-webkit-scrollbar {
    width: 5px;
}

.pym-mini-cart-wrapper .woocommerce-mini-cart::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.pym-mini-cart-wrapper .woocommerce-mini-cart::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.pym-mini-cart-wrapper .woocommerce-mini-cart-item {
    padding: 2px 2px !important;
    border-bottom: 1px solid #eee;
    position: relative;
    display: flex;
    align-items: flex-start;
    transition: background-color 0.2s ease, opacity 0.3s ease, transform 0.3s ease;
}

.pym-mini-cart-wrapper .woocommerce-mini-cart-item:first-child {
    margin-top: 10px;
}

.pym-mini-cart-wrapper .woocommerce-mini-cart-item:not(:first-child) {
    margin-top: 6px !important;
    border-bottom:none !important;
}

.pym-mini-cart-wrapper .woocommerce-mini-cart-item:hover {
    background-color: #f9f9f9;
}

.pym-mini-cart-wrapper .mini-cart-product-image {
    width: 100px;
    height: 104px;
    background: #f7f7f7;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pym-mini-cart-wrapper .mini-cart-product-image img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.pym-mini-cart-wrapper .mini-cart-product-details {
    display: block;
    margin-right: 11px;
    flex: 1;
}

.pym-mini-cart-wrapper .mini-cart-product-info {
    display: block;
    gap: 5px;
}

.pym-mini-cart-wrapper .mini-cart-product-category {
    font-size: 12px;
    font-weight: 500;
    color: #828282;
    margin-bottom: 5px;
    display: block;
}

.pym-mini-cart-wrapper .mini-cart-product-name a {
    font-size: 14px;
    color: #333;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    max-height: 2.8em;
    word-break: break-word;
}

.pym-mini-cart-wrapper .mini-cart-product-price-quantity {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
}

.pym-mini-cart-wrapper .mini-cart-product-price {
    order: 2;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

.pym-mini-cart-wrapper .mini-cart-product-quantity {
    order: 1;
}

.pym-mini-cart-wrapper .mini-cart-product-price .woocommerce-Price-amount {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-top: 24px;
}

.pym-mini-cart-wrapper .mini-cart-product-price .woocommerce-Price-currencySymbol {
    font-size: 12px;
    font-weight: 400;
    color: #828282;
    margin-right: 0px;
    margin-left: 2px;
}

.pym-mini-cart-wrapper .mini-cart-product-price del {
    filter: blur(1px);
    text-decoration: none;
    display: block;
    font-size: 12px;
    color: #828282;
}

.pym-mini-cart-wrapper .mini-cart-product-price del .woocommerce-Price-amount {
    font-size: 12px;
    color: #828282;
    font-weight: 400;
}

.pym-mini-cart-wrapper .mini-cart-product-price del .woocommerce-Price-currencySymbol {
    display: none;
}

.pym-mini-cart-wrapper .mini-cart-product-price ins {
    text-decoration: none;
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.pym-mini-cart-wrapper .mini-cart-product-price ins .woocommerce-Price-amount {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.pym-mini-cart-wrapper .mini-cart-product-quantity .quantity-buttons {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pym-mini-cart-wrapper .mini-cart-product-quantity .quantity {
    width: 27px;
    text-align: center;
    font-size: 13px;
    color: #333;
    margin: 0 5px;
    border: 0.7px solid #f5f5f5;
    border-radius: 4px;
    padding: 2px 0;
    background: transparent;
    height: 27px;
    line-height: 23px;
    user-select: none; /* جلوگیری از انتخاب متن در مرورگرهای دسکتاپ */
}

.pym-mini-cart-wrapper .mini-cart-product-quantity .qnt-btn {
    width: 27px;
    height: 27px;
    line-height: 15px;
    text-align: center;
    background: #f7f7f7;
    color: #010D0A;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
    user-select: none; /* جلوگیری از انتخاب متن در مرورگرهای دسکتاپ */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.pym-mini-cart-wrapper .mini-cart-product-quantity .qnt-btn:hover {
    border-color: #0C673B;
    background: #0C673B;
    color: #fff;
    transform: scale(1.05); /* افکت hover بهتر */
}

.pym-mini-cart-wrapper .mini-cart-product-quantity .qnt-btn:active {
    transform: scale(0.95); /* افکت کلیک */
}

.pym-mini-cart-wrapper .mini-cart-product-quantity .minus.qnt-btn.trash::before {
    content: '';
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="17" viewBox="0 0 16 17" fill="none"><path d="M2 4.49998H3.33333M3.33333 4.49998H14M3.33333 4.49998V13.8333C3.33333 14.1869 3.47381 14.5261 3.72386 14.7761C3.97391 15.0262 4.31304 15.1666 4.66667 15.1666H11.3333C11.687 15.1666 12.0261 15.0262 12.2761 14.7761C12.5262 14.5261 12.6667 14.1869 12.6667 13.8333V4.49998M5.33333 4.49998V3.16665C5.33333 2.81302 5.47381 2.47389 5.72386 2.22384C3.97391 1.97379 6.31304 1.83331 6.66667 1.83331H9.33333C9.68696 1.83331 10.0261 1.97379 10.2761 2.22384C10.5262 2.47389 10.6667 2.81302 10.6667 3.16665V4.49998M6.66667 7.83331V11.8333M9.33333 7.83331V11.8333" stroke="%23CF2E2E" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    display: block;
    width: 16px;
    height: 16px;
    line-height: 27px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.pym-mini-cart-wrapper .mini-cart-product-quantity .minus.qnt-btn.trash:hover::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="17" viewBox="0 0 16 17" fill="none"><path d="M2 4.49998H3.33333M3.33333 4.49998H14M3.33333 4.49998V13.8333C3.33333 14.1869 3.47381 14.5261 3.72386 14.7761C3.97391 15.0262 4.31304 15.1666 4.66667 15.1666H11.3333C11.687 15.1666 12.0261 15.0262 12.2761 14.7761C12.5262 14.5261 12.6667 14.1869 12.6667 13.8333V4.49998M5.33333 4.49998V3.16665C5.33333 2.81302 5.47381 2.47389 5.72386 2.22384C3.97391 1.97379 6.31304 1.83331 6.66667 1.83331H9.33333C9.68696 1.83331 10.0261 1.97379 10.2761 2.22384C10.5262 2.47389 10.6667 2.81302 10.6667 3.16665V4.49998M6.66667 7.83331V11.8333M9.33333 7.83331V11.8333" stroke="%23FFFFFF" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}

.pym-mini-cart-wrapper .custom-cart-footer {
    position: sticky;
    bottom: 0;
    background: transparent;
    z-index: 10;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    box-shadow: none;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pym-mini-cart-wrapper .custom-cart-footer .cart-total {
    font-size: 14px;
    text-align: right;
    display: grid;
    gap: 5px;
    padding-top: 10px;
}

.pym-mini-cart-wrapper .custom-cart-footer .cart-total strong {
    font-weight: 500;
    margin-left: 5px;
}

.pym-mini-cart-wrapper .custom-cart-footer .cart-total .woocommerce-Price-amount {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.pym-mini-cart-wrapper .custom-cart-footer .cart-total .woocommerce-Price-currencySymbol {
    font-size: 12px;
    font-weight: 400;
    color: #828282;
}

.pym-mini-cart-wrapper .custom-cart-footer .button.checkout {
    background: var( --e-global-color-primary );;
    color: #fff;
    border: none;
    padding: 16px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 12px;
    text-decoration: none;
    text-align: center;
    max-width: 200px;
    line-height: 16px;
    transition: background-color 0.3s ease;
    cursor: pointer;
}

.pym-mini-cart-wrapper .custom-cart-footer .button.checkout:hover {
    background: var( --e-global-color-accent );
}

/* مخفی کردن فوتر وقتی سبد خرید خالی است */
.pym-mini-cart-wrapper .woocommerce-mini-cart:empty + .woocommerce-mini-cart__total,
.pym-mini-cart-wrapper .woocommerce-mini-cart__empty-message + .woocommerce-mini-cart__total {
    display: none !important;
}

/* 
 * متغیرهای پایه - Z-Index Hierarchy (تنظیم شده برای همکاری با مگامنو)
 * 
 * Z-Index values تنظیم شده برای همکاری با مگامنو:
 * - Mini-cart toggle: z-index: 14 (پایین تا زیر مگامنو باشد)
 * - Mini-cart content: z-index: 520 (حالت عادی)
 * - Blur overlay: z-index: 518 (زیر مینی‌کارت)
 * 
 * Mega menu z-index: 1000+ (همیشه بالاتر از مینی‌کارت)
 * 
 * وقتی مگامنو باز است:
 * - Mega menu: z-index: 99999 !important (بالاترین اولویت)
 * - تمام عناصر مینی‌کارت: z-index: 10 !important (زیر مگامنو)
 * - pointer-events: none برای دکمه مینی‌کارت
 */
:root {
    --pym-mini-cart-z-index: 20;
    --pym-blur-z-index: calc(var(--pym-mini-cart-z-index) - 2); /* همیشه زیر مینی‌سبد خرید */
}

/* افکت بلر پس‌زمینه */
.pym-mini-cart-blur {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: var(--pym-blur-z-index); /* استفاده از متغیر */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
}

.pym-mini-cart-blur.active {
    opacity: 1;
    visibility: visible;
}

/* اطمینان از اینکه مینی‌سبد خرید بالای بلر باشه */
.pym-mini-cart-wrapper {
    position: relative;
    z-index: auto !important;
}

.pym-mini-cart-wrapper:has(.pym-mini-cart-content.open) {
    z-index: var(--pym-mini-cart-z-index) !important;
}

/* جلوگیری از اسکرول پس‌زمینه هنگام فعال بودن بلر */
body.pym-no-scroll {
    overflow: hidden;
    touch-action: none;
}

/* استایل برای موبایل */
@media (max-width: 767px) {
    .pym-mini-cart-wrapper {
        z-index: auto !important;
    }
    .pym-mini-cart-content {
        z-index: var(--pym-mini-cart-z-index) !important;
    }
    
    /* دکمه toggle در موبایل زیر مگامنو باشد */
    .pym-mini-cart-wrapper .pym-mini-cart-toggle {
        z-index: 14; /* z-index پایین تا زیر مگامنو باشد */
    }
    
    /* وقتی مگامنو باز است، همه عناصر مینی‌کارت پایین بروند */
    body.mega-open .pym-mini-cart-wrapper .pym-mini-cart-toggle,
    body.nav-open .pym-mini-cart-wrapper .pym-mini-cart-toggle,
    body.mega-open .pym-mini-cart-wrapper .pym-mini-cart-content,
    body.nav-open .pym-mini-cart-wrapper .pym-mini-cart-content,
    body.mega-open .pym-mini-cart-wrapper,
    body.nav-open .pym-mini-cart-wrapper {
        z-index: 10 !important; /* زیر مگامنو */
    }
}

/* استایل برای تبلت و دسکتاپ کوچک */
@media (min-width: 768px) {
    .pym-mini-cart-wrapper .pym-mini-cart-content {
        transform: none;
        width: 100%;
        min-width: 465px;
        max-width: 480px;
        margin: 0 auto;
        height: auto;
        min-height: 300px;
        max-height: 600px;
        /* محاسبه دقیق‌تر برای جایگاه مینی کارت */
        right: calc(-12vw + 20px) !important;
    }

    .pym-mini-cart-wrapper .woocommerce-mini-cart {
        max-height: 400px;
        margin-bottom: 2px;
        margin-top: 30px;
    }

    .pym-mini-cart-wrapper .woocommerce-mini-cart-item {
        padding: 2px 2px;
        margin-top: 10px;
    }
}

.pym-mini-cart-wrapper .woocommerce ul.cart_list, .pym-mini-cart-wrapper .woocommerce ul.product_list_widget {
  margin: 0 !important;
}

/* تبلت کوچک (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .pym-mini-cart-wrapper .pym-mini-cart-content {
        width: 100%;
        max-width: 100%;
        left: 0;
        /* محاسبه دقیق‌تر برای تبلت */
        right: calc(-18vw + -165px) !important;
        padding: 15px;
        height: auto;
        min-height: 250px;
        max-height: 600px;
        width: 320px !important;
        min-width: 320px;
        max-width: 380px;
    }

    .pym-mini-cart-wrapper .mini-cart-product-details {
        margin-right: 13px;
    }

    .pym-mini-cart-wrapper .woocommerce-mini-cart {
        height: auto;
        max-height: 400px;
        margin-bottom: 2px;
        margin-top: 30px;
    }

    .pym-mini-cart-wrapper .woocommerce-mini-cart__empty-message {
        max-height: 350px;
    }

    .pym-mini-cart-wrapper .custom-cart-footer {
        padding-top: 0;
        padding-bottom: 0;
        background: transparent;
    }

    .pym-mini-cart-wrapper .custom-cart-footer .cart-total {
        margin-right: 15px;
    }
}

/* تبلت بزرگ (1025px - 1366px) */
@media (min-width: 1025px) and (max-width: 1366px) {
    .pym-mini-cart-wrapper .pym-mini-cart-content {
        width: 100%;
        min-width: 465px;
        max-width: 480px;
        /* محاسبه دقیق‌تر برای تبلت بزرگ */
        right: calc(-15vw + -245px) !important;
        padding: 20px;
        height: auto;
        min-height: 300px;
        max-height: 600px;
    }
}

/* دسکتاپ کوچک (1367px - 1440px) */
@media (min-width: 1367px) and (max-width: 1440px) {
    .pym-mini-cart-wrapper .pym-mini-cart-content {
        width: 100%;
        min-width: 465px;
        max-width: 480px;
        /* محاسبه دقیق‌تر برای دسکتاپ کوچک */
        right: calc(-12vw + -80px) !important;
        padding: 24px;
        height: auto;
        min-height: 300px;
        max-height: 600px;
    }
}

/* دسکتاپ متوسط (1441px - 1920px) */
@media (min-width: 1441px) and (max-width: 1920px) {
    .pym-mini-cart-wrapper .pym-mini-cart-content {
        width: 100%;
        min-width: 465px;
        max-width: 480px;
        /* محاسبه دقیق‌تر برای دسکتاپ متوسط */
        right: calc(-8vw + -280px) !important;
        padding: 24px;
        height: auto;
        min-height: 300px;
        max-height: 600px;
    }
}

/* دسکتاپ بزرگ (1921px+) */
@media (min-width: 1921px) {
    .pym-mini-cart-wrapper .pym-mini-cart-content {
        width: 100%;
        min-width: 465px;
        max-width: 480px;
        /* محاسبه دقیق‌تر برای دسکتاپ بزرگ */
        right: calc(-5vw + 20px) !important;
        padding: 24px;
        height: auto;
        min-height: 300px;
        max-height: 600px;
    }
}

/* استایل برای موبایل */
@media (max-width: 767px) {
    .pym-mini-cart-wrapper .pym-mini-cart-content {
        /* روی موبایل، کانتینر را تمام‌عرض و ایمن نسبت به ناچ/گوشه‌ها نمایش بده */
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        /* عرض کامل ویوپورت بدون تداخل */
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: calc(10px + env(safe-area-inset-top, 0px)) calc(10px + env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) calc(10px + env(safe-area-inset-left, 0px));
        padding-top: calc(10px + env(safe-area-inset-top, 0px));
        height: auto;
        min-height: 205px;
        max-height: 80vh;
        border-radius: 0 0 16px 16px;
        box-sizing: border-box;
        /* جلوگیری از مشکلات position: fixed با transform */
        transform: none !important;
        -webkit-transform: none !important;
        -ms-transform: none !important;
        will-change: auto !important;
        -webkit-backface-visibility: visible !important;
        backface-visibility: visible !important;
        -webkit-perspective: none !important;
        perspective: none !important;
    }

    .pym-mini-cart-wrapper .mini-cart-product-details {
        margin-right: 13px;
    }

    .pym-mini-cart-wrapper .woocommerce-mini-cart {
        height: auto;
        max-height: 400px;
        margin-bottom: 2px;
        margin-top: 30px;
    }

    .pym-mini-cart-wrapper .woocommerce-mini-cart-item {
        margin-top: 20px !important;
        padding: 2px 2px !important;
    }

    .pym-mini-cart-wrapper .custom-cart-footer {
        padding-top: 0;
        padding-bottom: 0;
        background: transparent;
    }
    }

/* بهینه‌سازی ویژه برای موبایل‌های خیلی کوچک (<= 360px) */
@media (max-width: 360px) {
    .pym-mini-cart-wrapper .pym-mini-cart-content {
        padding: calc(8px + env(safe-area-inset-top, 0px)) calc(8px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(8px + env(safe-area-inset-left, 0px));
        max-height: 78vh;
        border-radius: 0 0 12px 12px;
    }

    .pym-mini-cart-wrapper .mini-cart-product-image {
        width: 84px;
        height: 88px;
    }

    .pym-mini-cart-wrapper .mini-cart-product-image img {
        width: 68px;
        height: 68px;
    }
}

/* فیکس مشکلات فایرفاکس */
@-moz-document url-prefix() {
    .pym-mini-cart-wrapper {
        -moz-user-select: none;
        -moz-transition: all 0.3s ease;
    }
    
    .pym-mini-cart-content {
        -moz-box-sizing: border-box;
        -moz-transform: translateZ(0);
    }
    
    .pym-mini-cart-wrapper .mini-cart-product-quantity .qnt-btn {
        -moz-user-select: none;
        -moz-transition: all 0.2s ease;
    }
    
    .pym-mini-cart-wrapper .woocommerce-mini-cart {
        scrollbar-width: thin;
        scrollbar-color: #888 #f5f5f5;
    }
}

/* بهبود preloader برای فایرفاکس */
.preloader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    gap: 3px;
}

.preloader .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #333;
    animation: preloader-bounce 1.4s infinite ease-in-out both;
}

.preloader .dot:nth-child(1) { animation-delay: -0.32s; }
.preloader .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes preloader-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Fallback notification styles */
.pym-fallback-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 5px;
    z-index: 9999;
    font-size: 14px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.pym-fallback-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.pym-fallback-notification.error {
    background: #e74c3c;
}

.pym-fallback-notification.warning {
    background: #f39c12;
}

.pym-fallback-notification.success {
    background: #27ae60;
}

/* بهبود عملکرد در مرورگرهای دسکتاپ */
@media (min-width: 768px) {
    .pym-mini-cart-wrapper .mini-cart-product-quantity .qnt-btn {
        transition: all 0.15s ease; /* انیمیشن سریع‌تر برای دسکتاپ */
    }
    
    .pym-mini-cart-wrapper .mini-cart-product-quantity .qnt-btn:hover {
        transform: scale(1.1);
    }
    
    .pym-mini-cart-wrapper .mini-cart-product-quantity .qnt-btn:active {
        transform: scale(0.9);
    }
}

/* بهبود عملکرد در کروم */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .pym-mini-cart-wrapper .pym-mini-cart-content {
        -webkit-transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        -webkit-perspective: 1000px;
    }
    
    .pym-mini-cart-wrapper .mini-cart-product-quantity .qnt-btn {
        -webkit-transform: translateZ(0);
        -webkit-backface-visibility: hidden;
    }
}

/* استایل سفارشی SweetAlert2 برای نمایش بهتر پیام‌های موجودی */
.pym-swal-container {
    z-index: 10000 !important;
}

/* تنظیم خودکار ارتفاع کانتینر بر اساس تعداد آیتم‌ها با استفاده از :has */
/* پیش‌فرض‌ها در بالا تعریف شده‌اند (min-height و max-height). 
   اگر فقط یک آیتم وجود داشته باشد (آیتم دوم وجود ندارد)، ارتفاع حداقلی کمتر شود تا فاصله اضافی نداشته باشیم. */
.pym-mini-cart-wrapper .pym-mini-cart-content:not(:has(.woocommerce-mini-cart .woocommerce-mini-cart-item:nth-of-type(2))) {
    min-height: 220px;
    max-height: 480px;
}

@media (min-width: 768px) and (max-width: 1024px) {
    .pym-mini-cart-wrapper .pym-mini-cart-content:not(:has(.woocommerce-mini-cart .woocommerce-mini-cart-item:nth-of-type(2))) {
        min-height: 220px;
        max-height: 520px;
    }
}

@media (max-width: 767px) {
    .pym-mini-cart-wrapper .pym-mini-cart-content:not(:has(.woocommerce-mini-cart .woocommerce-mini-cart-item:nth-of-type(2))) {
        min-height: 180px;
        max-height: 70vh;
    }
}

.pym-swal-container .swal2-popup {
    font-family: 'IRANSans', Arial, sans-serif !important;
    border-radius: 15px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
}

.pym-swal-container .swal2-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #333 !important;
}

.pym-swal-container .swal2-content {
    font-size: 14px !important;
    color: #666 !important;
    line-height: 1.5 !important;
}

.pym-swal-container .swal2-confirm {
    background-color: #d33 !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
}

.pym-swal-container .swal2-confirm:hover {
    background-color: #b32929 !important;
    transform: translateY(-1px) !important;
}

.pym-swal-container .swal2-timer-progress-bar {
    background-color: #d33 !important;
}

/* استایل حرفه‌ای‌تر برای Notyf */
.notyf__toast {
  border-radius: 16px !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10) !important;
  font-family: inherit !important;
  font-size: 15px !important;
  padding: 14px 24px !important;
}
.notyf__toast--success {
  background: #035d53 !important;
  color: #fff !important;
}
.notyf__toast--error {
  background: #e74c3c !important;
  color: #fff !important;
}
.notyf__icon {
  margin-left: 10px !important;
}

/* ===== PYM Mini-Cart Z-Layers — تنظیم شده برای همکاری با مگامنو ===== */
:root{
  --pym-mini-cart-z-index: 520;  /* محتوای مینی‌کارت */
  --pym-blur-z-index:     518;   /* همیشه زیر خود مینی‌کارت */
  --pym-mega-menu-priority: 99999; /* اولویت مگامنو */
}

/* دکمه مینی‌کارت - z-index پایین */
.pym-mini-cart-wrapper .pym-mini-cart-toggle{
  position: relative;
  z-index: 14; /* z-index پایین تا زیر مگامنو باشد */
}

/* وقتی مگامنو باز است، دکمه مینی‌کارت به زیر برود */
body.mega-open .pym-mini-cart-wrapper .pym-mini-cart-toggle,
body.nav-open .pym-mini-cart-wrapper .pym-mini-cart-toggle {
  z-index: 10 !important; /* زیر مگامنو */
  pointer-events: none; /* غیرفعال کردن کلیک */
}

/* وقتی مینی‌کارت باز است، کل رَپر بالا برود - اما نه بالاتر از مگامنو */
.pym-mini-cart-wrapper:has(.pym-mini-cart-content.open){
  z-index: var(--pym-mini-cart-z-index) !important; /* 520 */
}

/* اما اگر مگامنو باز باشد، مینی‌کارت به زیر برود */
body.mega-open .pym-mini-cart-wrapper:has(.pym-mini-cart-content.open),
body.nav-open .pym-mini-cart-wrapper:has(.pym-mini-cart-content.open),
body.mega-open .pym-mini-cart-wrapper,
body.nav-open .pym-mini-cart-wrapper {
  z-index: 10 !important; /* زیر مگامنو */
}

/* اختیاری: برای فرار از stacking-context روی دسکتاپ */
@media (min-width: 768px){
  .pym-mini-cart-wrapper .pym-mini-cart-content.open{
    /* اگر هنوز مشکلی بود این را فعال کن و موقعیت را تنظیم کن */
    /* position: fixed !important;
    right: 20px !important;
    top: 72px !important;
    left: auto !important; */
  }
}
