/* Wrapper کلی */
.awh-cart-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0;
    position: relative;
    overflow: hidden;
}

/* =========================================
   DESKTOP STYLES (Min-width updated to 1025px)
   ========================================= */
@media (min-width: 1025px) {
    .awh-cart-wrapper {
        flex-direction: row;
        align-items: stretch; /* تغییر: برای هم‌اندازه شدن ارتفاع ستون‌ها */
        padding: 0 10px;
        gap: 20px;
        overflow: visible;
    }

    .awh-cart-slider-area {
        order: 1; 
        flex-grow: 1;
        position: relative;
        overflow: hidden;
        padding: 5px 55px; 
        min-width: 0;
        /* فلکس برای وسط چین کردن محتوا در صورت نیاز */
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .awh-cart-summary {
        order: 2;
        flex: 0 0 250px;
        border-right: 1px solid #eee;
        padding-right: 20px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        height: 100%;
    }

    .awh-cart-items-container {
        display: flex;
        gap: 15px; 
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        padding: 5px 2px;
        width: 100%;
        /* بازگرداندن تراز عمودی آیتم‌ها به بالا */
        align-items: flex-start;
        height: 100%;
    }
    .awh-cart-items-container::-webkit-scrollbar { display: none; }

    .awh-cart-item {
        flex: 0 0 calc((100% - 30px) / 3 - 0.5px);
        min-width: calc((100% - 30px) / 3 - 0.5px);
        scroll-snap-align: start;
        scroll-snap-stop: always;
        border: 1px solid #eee;
        border-radius: 8px;
        padding: 15px;
        background: #fff;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
        transition: border-color 0.3s;
    }
    .awh-cart-item:hover { border-color: #fb743e; }

    .awh-item-image { order: 1; }
    .awh-item-image img { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; }
    .awh-product-name-wrapper { order: 2; width: 100%; margin: 5px 0; }
    .awh-mobile-details-wrapper { order: 3; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
    .awh-item-price { font-weight: bold; color: #555; }
    .awh-quantity-control { display: flex; gap: 5px; justify-content: center; }

    /* Navigation Buttons */
    .awh-slider-nav {
        position: absolute; top: 50%; transform: translateY(-50%);
        width: 30px; height: 30px; min-width: 30px; min-height: 30px;
        background: #fff; border: 1px solid #eee; border-radius: 50%;
        cursor: pointer; z-index: 99999; display: flex; align-items: center; justify-content: center;
        color: #333; box-shadow: 0 2px 5px rgba(0,0,0,0.1); padding: 0; line-height: 1;
        transition: all 0.3s ease; opacity: 1;
    }
    .awh-nav-prev { right: 10px; }
    .awh-nav-next { left: 10px; }
    .awh-slider-nav:hover { background: #fb743e; color: #fff; border-color: #fb743e; }
    .awh-slider-nav.disabled { opacity: 0.3; cursor: default; pointer-events: none; }
}

/* =========================================
   MOBILE & TABLET STYLES (Max-width updated to 1024px)
   ========================================= */
@media (max-width: 1024px) {
    .awh-cart-wrapper { 
        display: flex; 
        flex-direction: column; 
        height: 100%; /* ارتفاع کامل */
        padding: 0; 
    }
    
    .awh-cart-count-row { display: none !important; }

    /* اسلایدر: پر کردن فضای خالی */
    .awh-cart-slider-area {
        order: 1; 
        width: 100%; 
        padding: 10px 15px;
        flex-grow: 1; /* این خط مهم است */
        overflow-y: auto; /* اسکرول داخلی */
        padding-bottom: 20px !important; /* فاصله نرمال */
        min-height: 0; /* جلوگیری از سرریز فلکس */
        
        /* فلکس برای وسط چین کردن پیام خالی در موبایل */
        display: flex;
        flex-direction: column;
    }

    /* خلاصه وضعیت: چسبیدن به پایین فلکس */
    .awh-cart-summary {
        order: 2;
        flex-shrink: 0; /* جلوگیری از جمع شدن */
        width: 100%;
        z-index: 10;
        border-top: 1px solid #eee; 
        background: #fff; 
        padding: 15px 20px;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.05); 
        margin: 0;
        /* پدینگ امن برای آیفون/اندروید */
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
        position: static; /* حذف پوزیشن فیکس */
    }

    .awh-slider-nav { display: none; }
    .awh-cart-items-container { 
        display: flex; 
        flex-direction: column; 
        gap: 0; 
        /* در حالت موبایل اگر آیتم بود بالا باشه */
        justify-content: flex-start; 
    }

    .awh-cart-item {
        display: flex; flex-wrap: wrap; border-bottom: 1px solid #f0f0f0;
        padding-bottom: 15px; margin-bottom: 15px; background: transparent;
        flex-shrink: 0;
    }
    .awh-cart-item:last-child { border-bottom: none; }
    
    .awh-product-name-wrapper { width: 100%; margin-bottom: 10px; order: 1; }
    .awh-item-title { text-align: right; }
    .awh-item-image { order: 2; flex-shrink: 0; margin-left: 15px; }
    .awh-item-image img { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; }
    .awh-mobile-details-wrapper { order: 3; flex: 1; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; min-width: 0; }
    .awh-item-price { font-size: 14px; color: #666; margin-bottom: 5px; width: 100%; text-align: left; }
    .awh-quantity-control { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
    .awh-quantity-control button { margin: 0; }
}

/* =========================================
   GENERAL STYLES 
   ========================================= */
.awh-product-name-wrapper { position: relative; }
.awh-product-name-wrapper::before, .awh-product-name-wrapper::after { content: ''; position: absolute; top: 0; width: 15px; height: 100%; pointer-events: none; z-index: 2; opacity: 0; transition: opacity 0.3s ease; }
.awh-product-name-wrapper::before { right: 0; background: linear-gradient(to left, white, transparent); }
.awh-product-name-wrapper::after { left: 0; background: linear-gradient(to right, white, transparent); }
.awh-product-name-wrapper.awh-has-overflow::before, .awh-product-name-wrapper.awh-has-overflow::after { opacity: 1; }
.awh-item-title { margin: 0; font-size: 14px; line-height: 1.4; white-space: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.awh-item-title::-webkit-scrollbar { display: none; }
.awh-item-title a { text-decoration: none; color: #333; display: inline-block; }
.awh-item-title a:hover { color: #fb743e; }

.awh-quantity-btn { width: 26px !important; height: 26px !important; min-width: 26px !important; background-color: #fb743e; color: #fff; border: none; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 10px; transition: all 0.3s ease; padding: 0; box-shadow: none; margin: 0; }
.awh-quantity-btn:hover { background-color: #e05d28; transform: scale(1.1); }

.awh-qty-input { width: 35px; height: 26px !important; text-align: center; border: none !important; background: #f5f5f5 !important; font-weight: 800; font-size: 14px; color: #000000 !important; padding: 0 !important; margin: 0; line-height: 26px !important; opacity: 1 !important; -webkit-text-fill-color: #000000 !important; border-radius: 4px; display: inline-block; vertical-align: middle; box-sizing: border-box; appearance: none; -moz-appearance: textfield; }
.awh-qty-input:focus { outline: none; box-shadow: none; }
.awh-qty-input::-webkit-outer-spin-button, .awh-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.awh-cart-total-row { display: flex; justify-content: space-between; align-items: center; font-weight: bold; margin-bottom: 15px; font-size: 16px; }
.awh-total-amount { color: #fb743e; }
.awh-cart-actions { display: flex; flex-direction: column; gap: 10px; }
.awh-btn { display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 20px; border-radius: 6px; text-decoration: none; font-weight: bold; font-size: 14px; transition: all 0.3s; height: 44px; }
.awh-btn-checkout { background: #fb743e; color: #fff; }
.awh-btn-checkout:hover { background: #e05d28; transform: translateY(-2px); }
.awh-btn-view-cart { background: rgba(251, 116, 62, 0.15); color: #fb743e; }
.awh-btn-view-cart:hover { background: rgba(251, 116, 62, 0.25); transform: translateY(-2px); }

/* --- استایل جدید برای وسط چین کردن پیام خالی --- */
.awh-cart-empty { 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: #aaa;
    width: 100%;
    margin: auto; /* مهم برای وسط چین شدن در فلکس */
    min-height: 200px;
}
.awh-cart-empty i { font-size: 40px; margin-bottom: 10px; display: block; }

/* Stock Modal Styles */
.awh-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 100010;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}
.awh-modal-box {
    background: #fff; padding: 25px 20px; border-radius: 10px;
    width: 85%; max-width: 320px; text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: awhModalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes awhModalPop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}