/* ظرف اصلی مدال */
#nizva-cart-modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.95);
    width: 420px; max-width: 92%; z-index: 99999; visibility: hidden; opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: #ffffff; border-radius: 20px;
    padding: 0; color: #1a1a1a; direction: rtl;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.25), 0 18px 36px -18px rgba(0, 0, 0, 0.3);
    overflow: hidden; border: 1px solid #f0f0f0;
}

#nizva-cart-modal.active { visibility: visible; opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* لایه تاریک پشت */
#nizva-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(2px); display: none; z-index: 99998;
}

/* هدر مدال */
.nizva-modal-header {
    padding: 20px 25px; border-bottom: 1px solid #f5f5f5;
    display: flex; justify-content: space-between; align-items: center; background: #fff;
}
.nizva-modal-header h3 { margin: 0; font-size: 18px; font-weight: 800; color: #007cce; }
.nizva-close-btn { cursor: pointer; font-size: 28px; color: #ccc; transition: color 0.2s; line-height: 1; }
.nizva-close-btn:hover { color: #ff4d4f; }

/* باکس هشدارها */
.nizva-cart-alerts{
    background: #fff7e6;
    border-bottom: 1px solid #ffe7ba;
    color: #ad6800;
    padding: 12px 18px;
    font-size: 12.5px;
    line-height: 1.9;
}
.nizva-cart-alerts ul{
    margin: 0;
    padding: 0 18px 0 0;
}
.nizva-cart-alerts li{
    margin: 0;
}

/* محفظه آیتم‌ها */
#nizva-cart-items-container {
    max-height: 380px; overflow-y: auto; padding: 15px 25px; background: #fafafa;
}
#nizva-cart-items-container::-webkit-scrollbar { width: 4px; }
#nizva-cart-items-container::-webkit-scrollbar-thumb { background: #eee; border-radius: 10px; }

/* هر محصول */
.nizva-cart-item {
    position: relative;
    display: flex; align-items: center; background: #ffffff;
    margin-bottom: 12px; padding: 12px; border-radius: 15px;
    border: 1px solid #eee; transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.nizva-cart-item:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.05); }

.nizva-cart-item img {
    width: 65px; height: 65px; border-radius: 10px;
    margin-left: 15px; object-fit: cover; background: #f9f9f9;
}

.item-info { flex: 1; display: flex; flex-direction: column; }

.item-title {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; font-weight: 600; font-size: 14px;
    text-decoration: none; color: #333; line-height: 1.5; margin-bottom: 5px;
}
.item-title:hover { color: #007cba; }

.item-details { display: flex; justify-content: space-between; align-items: center; }
.item-price { font-size: 13px; color: #555; font-weight: 700; }
.item-qty { color: #999; font-size: 11px; background: #f0f0f0; padding: 2px 8px; border-radius: 5px; }

/* یادداشت موجودی */
.nizva-stock-note{
    margin-top: 6px;
    font-size: 11px;
    color: #b26b00;
    background: #fff7e6;
    border: 1px solid #ffe7ba;
    padding: 4px 8px;
    border-radius: 8px;
    width: fit-content;
}

/* دکمه حذف */
.nizva-remove-item {
    background: #fff; border: 1px solid #f0f0f0; color: #d9d9d9;
    width: 26px; height: 26px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; font-size: 16px; margin-right: 10px;
}
.nizva-remove-item:hover { background: #fff1f0; color: #ff4d4f; border-color: #ffccc7; }

/* فوتر */
.nizva-cart-footer { padding: 20px 25px; background: #fff; border-top: 1px solid #f5f5f5; }

.nizva-total-row {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;
}
.total-label { font-size: 15px; color: #666; }
.total-amount { font-size: 19px; font-weight: 900; color: #111; }

.nizva-checkout-btn {
    display: block; text-align: center; background: #006ba9;
    color: #fff !important; padding: 16px; border-radius: 14px;
    text-decoration: none; font-weight: 700; font-size: 15px;
    transition: background 0.3s;
}
.nizva-checkout-btn:hover { background: #004991; box-shadow: 0 10px 20px rgba(0, 55, 126, 0.1); }

.nizva-loading-placeholder { text-align: center; padding: 40px; color: #aaa; font-size: 14px; }

/* ===== وضعیت‌ها (Out of stock / Not enough) ===== */

/* برچسب وضعیت */
.nizva-stock-badge{
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 10px;
    z-index: 2;
    border: 1px solid transparent;
}
.nizva-stock-badge.out{
    background: #fff1f0;
    color: #cf1322;
    border-color: #ffccc7;
}
.nizva-stock-badge.warn{
    background: #fff7e6;
    color: #ad6800;
    border-color: #ffe7ba;
}

/* خاکستری کردن آیتم تمام‌شده */
.nizva-cart-item.is-outofstock{
    opacity: 0.65;
    filter: grayscale(1);
    background: #f6f6f6;
    border-color: #e8e8e8;
}

.nizva-cart-item.is-outofstock:hover{
    transform: none;
    box-shadow: none;
}

/* کمبود موجودی: فقط کمی تاکید رنگی */
.nizva-cart-item.is-not-enough{
    border-color: #ffe7ba;
}
/* دکمه ثبت سفارش در حالت غیرفعال */
.nizva-checkout-btn.is-disabled{
    background: #bfbfbf !important;
    cursor: not-allowed !important;
    opacity: 0.75;
    box-shadow: none !important;
    pointer-events: auto; /* کلیک را می‌گیریم ولی با JS جلوگیری می‌کنیم تا حس disabled داشته باشد */
}
.nizva-checkout-btn.is-disabled:hover{
    background: #bfbfbf !important;
}
#nizva-checkout-loading{
position:fixed;
inset:0;
background:rgba(0,0,0,0.45);
display:flex;
align-items:center;
justify-content:center;
z-index:99999;
backdrop-filter:blur(3px);
}

.nizva-loading-box{
background:#fff;
padding:30px 40px;
border-radius:14px;
text-align:center;
box-shadow:0 20px 60px rgba(0,0,0,0.2);
}

.nizva-spinner{
width:40px;
height:40px;
border:4px solid #eee;
border-top:4px solid #000;
border-radius:50%;
animation:spin .8s linear infinite;
margin:auto;
}

.nizva-loading-text{
margin-top:12px;
font-size:14px;
}

@keyframes spin{
to{transform:rotate(360deg)}
}

.nizva-checkout-btn.loading{
pointer-events:none;
opacity:.7;
}
