/* ================================================================
   MPES Sidebar Cart
   ================================================================ */

/* ── אייקון עגלה ──────────────────────────────────────────────── */
.mpes-cart-icon-wrap {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9998;
    width: 58px;
    height: 58px;
    background: #4CAF50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.22);
    transition: transform 0.15s, background 0.15s;
}
.mpes-cart-icon-wrap:hover { background: #43a047; transform: scale(1.07); }
.mpes-cart-svg { width: 26px; height: 26px; color: #fff; }

.mpes-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}
.mpes-cart-count[data-count="0"],
.mpes-cart-count:empty { display: none; }

/* ── Overlay ──────────────────────────────────────────────────── */
.mpes-cart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9999;
}
.mpes-cart-overlay.mpes-open { display: block; }

/* ── Panel ────────────────────────────────────────────────────── */
.mpes-sidebar-cart {
    position: fixed;
    top: 0;
    right: -380px;
    width: 360px;
    max-width: 95vw;
    height: 100vh;
    background: #fff;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    transition: right 0.28s cubic-bezier(0.4,0,0.2,1);
    direction: rtl;
}
.mpes-sidebar-cart.mpes-open { right: 0; }

/* ── Header ───────────────────────────────────────────────────── */
.mpes-sidebar-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.mpes-sidebar-cart-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #222;
}
.mpes-sidebar-cart-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #888;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s;
}
.mpes-sidebar-cart-close:hover { color: #222; }

/* ── Body ─────────────────────────────────────────────────────── */
.mpes-sidebar-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 8px;
}

.mpes-cart-empty {
    text-align: center;
    color: #888;
    padding: 48px 24px;
    font-size: 15px;
}

.mpes-cart-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ── פריט ─────────────────────────────────────────────────────── */
.mpes-cart-item {
    display: grid;
    grid-template-columns: 28px 68px 1fr;
    grid-template-rows: auto;
    gap: 0 10px;
    align-items: center;
    padding: 14px 14px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    transition: background 0.12s;
}
.mpes-cart-item:hover { background: #fafafa; }

.mpes-cart-item-remove {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: #bbb;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.mpes-cart-item-remove:hover { color: #e53935; }
.mpes-cart-item-remove svg { width: 18px; height: 18px; }

.mpes-cart-item-img {
    grid-column: 2;
    grid-row: 1 / 3;
    width: 68px;
    height: 68px;
    object-fit: contain;
    border-radius: 6px;
    background: #f5f5f5;
}

.mpes-cart-item-info {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mpes-cart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    line-height: 1.3;
    text-align: right;
}

/* ── פקדי כמות / משקל בסל ────────────────────────────────────── */
.mpes-cart-item-qty-wrap,
.mpes-cart-item-weight-wrap {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    direction: ltr;
    align-self: flex-start;
    background: #fff;
}

.mpes-cart-item-qty-wrap .mpes-btn,
.mpes-cart-item-weight-wrap .mpes-btn {
    background: #f5f5f5 !important;
    border: none !important;
    padding: 4px 10px !important;
    font-size: 16px !important;
    color: #444 !important;
    cursor: pointer;
    line-height: 1;
    min-width: 28px;
}
.mpes-cart-item-qty-wrap .mpes-btn:hover,
.mpes-cart-item-weight-wrap .mpes-btn:hover { background: #e8e8e8 !important; }

.mpes-sc-qty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    font-size: 14px;
    font-weight: 600;
    padding: 4px 6px;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    color: #222;
}

.mpes-cart-item-weight-wrap .mpes-weight-input {
    width: 52px !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    padding: 4px 2px;
    -moz-appearance: textfield;
    background: #fff;
}
.mpes-cart-item-weight-wrap .mpes-weight-input::-webkit-inner-spin-button,
.mpes-cart-item-weight-wrap .mpes-weight-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.mpes-cart-item-weight-wrap .mpes-unit-label {
    font-size: 12px;
    color: #888;
    padding: 0 5px 0 2px;
    display: flex;
    align-items: center;
    border-right: 1px solid #ddd;
}

.mpes-cart-item-price {
    font-size: 14px;
    font-weight: 700;
    color: #2c7a00;
    text-align: right;
    direction: rtl;
}

/* loading state */
.mpes-cart-item.mpes-updating {
    opacity: 0.5;
    pointer-events: none;
}

/* ── Footer ───────────────────────────────────────────────────── */
.mpes-sidebar-cart-footer {
    border-top: 2px solid #eee;
    padding: 14px 16px 18px;
    flex-shrink: 0;
    background: #fff;
}

.mpes-cart-footer-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
    direction: rtl;
}
.mpes-cart-footer-total-label { color: #555; }
.mpes-cart-footer-total-value { font-weight: 700; color: #222; font-size: 17px; }

.mpes-cart-checkout-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: #4CAF50 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px;
    padding: 13px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.mpes-cart-checkout-btn:hover { background: #43a047 !important; color: #fff !important; }

/* ── Loading spinner ──────────────────────────────────────────── */
.mpes-cart-loading {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.7);
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.mpes-sidebar-cart.mpes-loading .mpes-cart-loading { display: flex; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 420px) {
    .mpes-sidebar-cart { width: 100vw; right: -100vw; }
}
