/* ---- استایل‌های سفارشی سبد خرید ---- */

/* آیکون سبد خرید در هدر سایت (همون که تعداد رو نشون میده) */
.my-cart-icon {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 600;
    position: relative;
    margin-top: 30px;
    -webkit-tap-highlight-color: transparent; /* حذف باکس آبی در اندروید و iOS */
    outline: none; /* حذف خط دور (Focus Ring) در مرورگرهای خاص */
    user-select: none; /* جلوگیری از انتخاب شدن متن هنگام لمس سریع */
}

.cart-icon {
    font-size: 26px;
    position: relative;
}

.cart-count {
    position: absolute;
    top: -6px;
    right: -10px;
    background: #e11d48; /* قرمز */
    color: #fff;
    border-radius: 50px;
    padding: 2px 6px;
    font-size: 12px;
    line-height: 1;
    min-width: 18px;
    text-align: center;
    z-index: 1;
}

.cart-total {
    font-size: 14px;
    color: #333;
}

/* موبایل آیکون */
@media (max-width:768px) {
    
    /* تنظیم فاصله آیکون در موبایل */
    .my-cart-icon {
        margin-top: 10px;
        margin-bottom: -20px;
        padding-left: 12px;
    }
    
    /* تنظیم فاصله تعداد در موبایل */
    .cart-count {
        top: 0px;
        right: -10px;
    }
    
    /* حذف قیمت در موبایل */
    .cart-total {
        display: none;
    }
}


/* */
/* ساید بار سبد خرید - کانتینر اصلی */
.custom-cart-sidebar {
    position: fixed;
    top: 0;
    right: 0; /* این قسمت دست نخورده چون سایدبار سمت چپ باز میشه */
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none; /* اولش غیرفعال */
}
.custom-cart-sidebar.open {
    pointer-events: auto; /* وقتی بازه فعال میشه */
}

/* لایه سیاه یا خاکستری روی صفحه */
.cart-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity .3s ease; /* انیمیشن برای ظاهر شدن */
    z-index: 99998; /* زیر درور ولی بالای بقیه محتوا */
}
.custom-cart-sidebar.open .cart-overlay {
    opacity: 1;
}

/* درور (کشوی) سایدبار */
.mycart-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 380px;
    height: 100vh;
    background: #fff;
    z-index: 99999;
    transform: translateX(-100%);
    transition: transform .35s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.mycart-drawer.open {
    transform: translateX(0);
}


/* موبایل: فول اسکرین واقعی */
@media (max-width:768px){

    .mycart-drawer{
        left:0;
        right:0;
        width:auto;
        max-width:none;
    }

}

/* ----------- محتوای سایدبار ----------- */

/* هدر سایدبار */
.mycart-header {
    position: relative;
    padding: 20px;
    border-bottom: 1px solid #eee;
    background-color: #f9f9f9;
    text-align: center; /* متن عنوان وسط باشه */
}
.mycart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

/* دکمه بستن سایدبار (تغییر موقعیت به راست) */
.mycart-close {
    position: absolute;
    top: 30%; /* وسط عمودی */
    right: 7px; /* چسبیده به راست */
    transform: translateY(-50%); /* تنظیم دقیق وسط */
    font-size: 26px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .2s ease;
    color: #777;
}
.mycart-close:hover {
    background: #f3f3f3;
    color: #333;
}

/* بدنه اصلی سبد خرید */
.mycart-body {
    padding: 20px;
    overflow-y: auto; /* اسکرول در صورت نیاز */
    flex: 1; /* بدنه به اندازه کافی بزرگ میشه */
}

/* آیتم‌های سبد خرید */
.mycart-item {
    display: flex; /* استفاده از فلکس برای چیدمان */
    align-items: center; /* وسط‌چین عمودی */
    margin-bottom: 18px; /* فاصله بیشتر بین آیتم‌ها */
    padding-bottom: 18px; /* کمی padding */
    border-bottom: 1px solid #f0f0f0; /* خط جداکننده روشن‌تر */
    position: relative; /* برای موقعیت‌دهی دکمه حذف */
    text-align: right; /* همه متن‌ها راست‌چین */
}
.mycart-item:last-child {
    border-bottom: none; /* آخرین آیتم خط جداکننده نداره */
    margin-bottom: 0;
    padding-bottom: 0;
}

/* تصویر محصول */
.mycart-image {
    margin-left: 12px; /* فاصله از سمت راست */
    flex-shrink: 0; /* تصویر کوچک نشود */
}
.mycart-image img {
    width: 60px; /* اندازه کمی بزرگتر */
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
}

/* اطلاعات محصول */
.mycart-info {
    flex-grow: 1; /* فضای خالی رو پر می‌کنه */
}
.mycart-title {
    display: block;
    margin-bottom: 6px; /* فاصله کمی بیشتر */
    color: #222; /* رنگ تیره‌تر */
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding-left: 100px;
    line-height: 2;
}
.mycart-title:hover {
    color: #007bff; /* رنگ موقع هاور */
}
.mycart-qty {
    font-size: 13px;
    color: #666;
}

/* ---------- دکمه حذف محصول (درون آیتم) - استایل کلی ----------- */
.mycart-item .remove_from_cart_button {
    position: absolute !important;
    left: 15px !important; /* انتقال دکمه به دورترین نقطه سمت چپ (استاندارد RTL) */
    right: auto !important; /* خنثی کردن راست */
    top: 50% !important; /* تراز دقیق ۵۰ درصد ارتفاع کارت */
    transform: translateY(-50%) !important; /* وسط‌چین کردن عمودی */
    -webkit-tap-highlight-color: transparent; /* حذف باکس آبی در اندروید و iOS */
    outline: none; /* حذف خط دور (Focus Ring) در مرورگرهای خاص */
    user-select: none; /* جلوگیری از انتخاب شدن متن هنگام لمس سریع */

    /* ساخت دایره کاملاً گرد */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    
    /* حذف تمام خطوط زیرین، حاشیه‌ها و کادرهای مزاحم قالب (مثل خط آبی) */
    text-decoration: none !important;
    border: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    outline: none !important;

    /* رنگ‌بندی دایره */
    background: #f1f1f1 !important;
    color: #888 !important;
    font-size: 18px !important;
    font-family: inherit !important;
    line-height: 1 !important;
    
    cursor: pointer;
    transition: all 0.2s ease-in-out !important;
    z-index: 10;
}

/* افکت هاور دکمه حذف */
.mycart-item .remove_from_cart_button:hover {
    background: #e11d48 !important; /* قرمز شدن در حالت هاور */
    color: #fff !important; /* سفید شدن ضربدر در حالت هاور */
    border-bottom: none !important;
    text-decoration: none !important;
}

/* جلوگیری از تأثیر استایل‌های لینک آسترا روی ضربدر */
.mycart-item a.remove_from_cart_button,
.mycart-item a.remove_from_cart_button:focus,
.mycart-item a.remove_from_cart_button:active {
    border-bottom: none !important;
    text-decoration: none !important;
    box-shadow: none !important;
}

/* ----- تنظیم دقیق موقعیت ضربدر ----- */
/*.mycart-item .remove_from_cart_button {
/*    /* اضافه کردن padding-top برای تنظیم موقعیت */
/*    padding-top: 2px; /* این مقدار را می‌توانی کم و زیاد کنی */
/*    /* اگر padding-top جواب نداد، line-height را تنظیم کن */
/*    /* line-height: 28px; /* این عدد را با width/height مقایسه کن */
}*/

.mycart-item .remove_from_cart_button {
    -webkit-tap-highlight-color: transparent; /* حذف باکس آبی در اندروید و iOS */
    outline: none; /* حذف خط دور (Focus Ring) در مرورگرهای خاص */
    user-select: none; /* جلوگیری از انتخاب شدن متن هنگام لمس سریع */
}

/* برای اطمینان بیشتر، اگر از کلاس mycart-remove استفاده شد */
.mycart-item .mycart-remove {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: #aaa;
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .2s ease-in-out;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    line-height: 1;
    box-shadow: 0 0 0 2px #eee;
}
.mycart-item .mycart-remove:hover {
    color: #fff;
    background: #e74c3c;
    box-shadow: 0 0 0 2px #e74c3c;
}

/* فوتر سایدبار */
.mycart-footer {
    width: 100%;
    margin-top: 20px; /* فوتر رو به پایین میکشه */
    margin-right: 0px;
    margin-left: 0px;
    border-top: 1px solid #eee;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 20px;
}

.mycart-total {
    display: flex;
    justify-content: space-between; /* چپ و راست */
    font-weight: 700;
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
}
.mycart-total span:first-child { /* "جمع کل:" */
    color: #555;
}

/* دکمه‌های پایین سایدبار (تغییرات برای full width) */
.mycart-btn {
    display: block; /* باعث میشه full width بشه */
    width: 100%; /* عرض کامل */
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 10px; /* فاصله بین دکمه‌ها */
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
    border: 1px solid transparent;
}
.mycart-btn:last-child {
    margin-bottom: 0; /* آخرین دکمه فاصله نداشته باشه */
}

/* دکمه مشاهده سبد */
.cart-btn {
    background: #f3f4f6;
    color: #111;
    border-color: #ddd;
}
.cart-btn:hover {
    background: #e0e2e5;
}

/* دکمه تسویه حساب */
.checkout-btn {
    background: #111;
    color: #fff;
    border-color: #111;
}
.checkout-btn:hover {
    background: #333;
    border-color: #333;
}

/* --- انیمیشن حذف --- */
.mycart-item.hidden {
    opacity: 0;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    transform: translateX(-20px);
}
