/* CubePass side cart (assets/js/cart-ui.js), 2026-10-21. Slides in from the left (RTL page); full width on phones. */
.sc-overlay {
    --sc-bg: #10121b;
    --sc-card: rgba(255, 255, 255, .04);
    --sc-soft: rgba(255, 255, 255, .06);
    --sc-line: rgba(255, 255, 255, .09);
    --sc-line-2: rgba(255, 255, 255, .16);
    --sc-text: #f1f5f9;
    --sc-muted: #94a3b8;
    --sc-primary: #3e69fe;
    --sc-pay: #10b981;
    --sc-bad: #ef4444;
    position: fixed; inset: 0; z-index: 10050; background: rgba(2, 6, 23, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    opacity: 0; transition: opacity .25s;
}
:root[data-theme="light"] .sc-overlay {
    --sc-bg: #ffffff; --sc-card: #f8fafc; --sc-soft: #f1f5f9; --sc-line: #e5e9f2; --sc-line-2: #cfd6e4;
    --sc-text: #0f172a; --sc-muted: #64748b; --sc-primary: #3157d5; --sc-bad: #dc2626;
    background: rgba(15, 23, 42, .35);
}
.sc-overlay[hidden] { display: none !important; }
.sc-overlay.show { opacity: 1; }
.sc-overlay *, .sc-overlay *::before, .sc-overlay *::after { box-sizing: border-box; }
.sc-panel { position: absolute; top: 0; bottom: 0; left: 0; width: min(420px, 100%); display: flex; flex-direction: column; background: var(--sc-bg); color: var(--sc-text);
    border-right: 1px solid var(--sc-line); box-shadow: 20px 0 50px rgba(0, 0, 0, .35); transform: translateX(-100%); transition: transform .3s cubic-bezier(.16, 1, .3, 1); outline: none; }
.sc-overlay.show .sc-panel { transform: none; }

.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid var(--sc-line); }
.sc-head h2 { margin: 0; font-size: 1.1rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.sc-head h2 > i { color: var(--sc-primary); }
.sc-count { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--sc-primary); color: #fff; font-size: .78rem; display: inline-grid; place-items: center; }
.sc-close { width: 38px; height: 38px; border-radius: 12px; border: 0; background: var(--sc-soft); color: var(--sc-muted); cursor: pointer; font-size: 1rem; }
.sc-close:hover { color: var(--sc-text); }

.sc-body { flex: 1; overflow-y: auto; padding: 14px 16px; overscroll-behavior: contain; }
.sc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sc-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 10px; border-radius: 14px; background: var(--sc-card); border: 1px solid var(--sc-line);
    transition: border-color .2s; }
.sc-item.is-new { animation: sc-in .28s cubic-bezier(.16, 1, .3, 1); }
.sc-item.is-leaving { opacity: 0; pointer-events: none; transition: height .3s cubic-bezier(.4, 0, .2, 1), padding .3s, margin .3s, border-width .3s, opacity .2s; }
.sc-item.is-pending { border-style: dashed; border-color: var(--sc-primary); }
.sc-item.is-out { border-color: color-mix(in srgb, var(--sc-bad) 45%, transparent); }
@keyframes sc-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.sc-img { position: relative; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: var(--sc-soft); display: block; }
/* «در حال ثبت»: a spinner over the photo, so nothing in the row moves when the server answers */
.sc-spin { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(2, 6, 23, .45); color: #fff; opacity: 0; transition: opacity .2s; pointer-events: none; }
.sc-item.is-pending .sc-spin { opacity: 1; }
.sc-q:disabled { opacity: .45; cursor: default; }
.sc-variant[hidden] { display: none; }
.sc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sc-name { color: var(--sc-text); text-decoration: none; font-weight: 700; font-size: .88rem; line-height: 1.6; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.sc-name:hover { color: var(--sc-primary); }
.sc-variant { font-size: .74rem; color: var(--sc-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-variant.sc-out { color: var(--sc-bad); font-weight: 700; }
.sc-out { font-size: .74rem; color: var(--sc-bad); font-weight: 700; }
.sc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.sc-price { font-size: .9rem; font-weight: 800; white-space: nowrap; }
.sc-price small { font-weight: 500; font-size: .7rem; color: var(--sc-muted); }
.sc-qty { display: inline-flex; align-items: center; height: 32px; border-radius: 10px; border: 1px solid var(--sc-line-2); overflow: hidden; }
.sc-q { width: 32px; height: 100%; border: 0; background: transparent; color: var(--sc-text); cursor: pointer; font-size: .74rem; }
.sc-q:hover { background: var(--sc-soft); }
.sc-q[data-act="del"] { color: var(--sc-bad); }
.sc-q-n { min-width: 26px; text-align: center; font-weight: 800; font-size: .85rem; }
.sc-pending { font-size: .75rem; color: var(--sc-primary); display: inline-flex; align-items: center; gap: 5px; }

.sc-loading { display: flex; flex-direction: column; gap: 10px; }
.sc-skel { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 10px; border-radius: 14px; background: var(--sc-card); }
.sc-skel span { display: block; height: 64px; border-radius: 12px; background: linear-gradient(90deg, var(--sc-soft), var(--sc-line), var(--sc-soft)); background-size: 200% 100%; animation: sc-sh 1.2s infinite linear; }
.sc-skel span + span { height: 14px; margin-top: 8px; width: 70%; }
@keyframes sc-sh { to { background-position: -200% 0; } }
.sc-empty { text-align: center; padding: 40px 10px; color: var(--sc-muted); }
.sc-empty-icon { width: 70px; height: 70px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center; font-size: 1.8rem; background: var(--sc-soft); color: var(--sc-primary); }
.sc-empty p { margin: 0 0 16px; font-weight: 600; color: var(--sc-text); }

.sc-foot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--sc-line); background: var(--sc-bg); }
.sc-foot[hidden] { display: none !important; }
.sc-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.sc-total span { color: var(--sc-muted); font-size: .9rem; }
.sc-total b { font-size: 1.25rem; font-weight: 900; color: var(--sc-pay); }
.sc-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
.sc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 48px; padding: 0 14px; border-radius: 13px; border: 0; font: inherit; font-weight: 800;
    font-size: .92rem; text-decoration: none; cursor: pointer; transition: background .2s, transform .15s; }
.sc-btn:active { transform: translateY(1px); }
.sc-btn-ghost { background: var(--sc-soft); color: var(--sc-text) !important; border: 1px solid var(--sc-line-2); }
.sc-btn-pay { background: var(--sc-pay); color: #fff !important; box-shadow: 0 8px 20px rgba(16, 185, 129, .25); }
.sc-btn-pay:hover { background: #059669; }
.sc-btn-warn { background: #f59e0b; color: #fff !important; }
.sc-overlay :focus-visible { outline: 2px solid var(--sc-primary); outline-offset: 2px; }

/* «برگردان» after a removal */
.sc-snack { position: fixed; z-index: 10060; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0;
    display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; background: #1e2130; color: #f1f5f9;
    font-size: .88rem; box-shadow: 0 14px 34px rgba(0, 0, 0, .35); transition: opacity .2s, transform .2s; }
.sc-snack[hidden] { display: none !important; }
.sc-snack.show { opacity: 1; transform: translate(-50%, 0); }
.sc-snack span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-snack-undo { border: 0; background: none; color: #60a5fa; font: inherit; font-weight: 800; cursor: pointer; white-space: nowrap; }
@media (min-width: 1024px) { .sc-snack { bottom: 28px; } }

/* product page button feedback */
.add-to-cart-btn.is-added { background: #10b981 !important; border-color: #10b981 !important; color: #fff !important; animation: sc-pop .35s cubic-bezier(.34, 1.56, .64, 1); }
.add-to-cart-btn.is-failed { animation: sc-shake .4s; }
@keyframes sc-pop { 50% { transform: scale(1.04); } }
@keyframes sc-shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

@media (max-width: 480px) {
    .sc-panel { width: 100%; border-right: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .sc-overlay, .sc-panel, .sc-item, .sc-snack, .add-to-cart-btn { transition: none !important; animation: none !important; }
}
