/* ════════════════════════════════════════════════════
   MINI CART DRAWER (mc-*)
   New design from redesign mockup. RTL site → drawer
   slides in from the LEFT (inset-inline-start).
   ════════════════════════════════════════════════════ */

:root {
    --mc-ink: #0F0F10;
    --mc-ink-50: #FAFAFA;
    --mc-ink-100: #F3F4F6;
    --mc-ink-200: #E5E7EB;
    --mc-ink-300: #D1D5DB;
    --mc-ink-500: #6B7280;
    --mc-ink-700: #374151;
    --mc-blue: #4DAAD5;
    --mc-r-sm: 8px;
    --mc-r-pill: 999px;
    --mc-ease: cubic-bezier(.2,.7,.2,1);
}

/* ─── Backdrop ─── */
.mc-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,15,16,.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s var(--mc-ease), visibility .25s;
}
.mc-backdrop.is-open,
.mc-backdrop.is-active {
    opacity: 1;
    visibility: visible;
}

/* ─── Drawer (slides from start side; RTL → left, LTR → right) ─── */
.mc-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    width: min(420px, 92vw);
    background: #fff;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform .3s var(--mc-ease);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(15,15,16,.12);
    visibility: hidden;
    font-family: 'Noto Sans Hebrew', sans-serif;
    direction: rtl;
}
[dir="ltr"] .mc-drawer {
    transform: translateX(-100%);
}
.mc-drawer.is-open,
.mc-drawer.is-active {
    transform: translateX(0);
    visibility: visible;
}

/* ─── Header ─── */
.mc-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--mc-ink-100);
}
.mc-drawer__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 800;
    color: var(--mc-ink);
}
.mc-drawer__count {
    background: var(--mc-ink);
    color: #fff;
    font-size: 11.5px;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    border-radius: var(--mc-r-pill);
    display: grid;
    place-items: center;
    padding: 0 6px;
    font-variant-numeric: tabular-nums;
}
.mc-drawer__close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--mc-ink-50);
    color: var(--mc-ink);
    display: grid;
    place-items: center;
    transition: background .15s, color .15s, transform .15s;
    border: 0;
    cursor: pointer;
    padding: 0;
}
.mc-drawer__close:hover {
    background: var(--mc-ink);
    color: #fff;
    transform: rotate(90deg);
}
.mc-drawer__close svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* ─── Free shipping bar ─── */
.mc-free-ship {
    padding: 14px 22px;
    background: var(--mc-ink-50);
    border-bottom: 1px solid var(--mc-ink-100);
}
.mc-free-ship__text {
    font-size: 12.5px;
    color: var(--mc-ink-700);
    margin-bottom: 6px;
    line-height: 1.4;
}
.mc-free-ship__text strong {
    color: var(--mc-blue);
    font-weight: 800;
}
.mc-free-ship__bar {
    height: 4px;
    background: var(--mc-ink-200);
    border-radius: var(--mc-r-pill);
    overflow: hidden;
}
.mc-free-ship__fill {
    height: 100%;
    background: var(--mc-blue);
    border-radius: var(--mc-r-pill);
    transition: width .3s var(--mc-ease);
}

/* ─── Items ─── */
.mc-items {
    flex: 1;
    overflow-y: auto;
    padding: 14px 22px;
    list-style: none;
    margin: 0;
}
.mc-item {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--mc-ink-100);
}
.mc-item:last-child {
    border-bottom: 0;
}
.mc-item__media {
    width: 64px;
    height: 64px;
    border-radius: var(--mc-r-sm);
    overflow: hidden;
    background: var(--mc-ink-100);
    flex-shrink: 0;
}
.mc-item__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ─── Custom-crop wallpaper preview ───
   When the line item is a wallpaper crop (e.g. 44×240), the filter
   sd_cart_item_cropped_thumbnail emits an <img class="sd-cart-item__img">.
   Let the media tile flex to the actual print aspect so the customer sees
   what they chose — not a center-cropped square slice of it.

   CRITICAL: also widen the row's grid column to match the new media width,
   otherwise the image overflows its track and visually overlaps the title. */
.mc-item:has(.sd-cart-item__img) {
    grid-template-columns: 88px 1fr auto;
    align-items: start;
}
.mc-item__media:has(.sd-cart-item__img) {
    width: 88px;
    height: auto;
    aspect-ratio: auto;
    min-height: 64px;
    max-height: 160px;
    background: #fafafa;
    border: 1px solid #ececec;
    overflow: hidden;
    align-self: start;
    border-radius: var(--mc-r-sm);
}
.mc-item__media .sd-cart-item__img {
    width: 100%;
    height: 100%;
    max-height: 160px;
    object-fit: contain;
    display: block;
}
/* Ensure the title block doesn't run wider than its track or behind the image */
.mc-item:has(.sd-cart-item__img) .mc-item__info {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}
.mc-item:has(.sd-cart-item__img) .mc-item__title {
    white-space: normal;
    word-break: break-word;
}
.mc-item__info {
    min-width: 0;
}
.mc-item__title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--mc-ink);
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mc-item__title a {
    color: inherit;
    text-decoration: none;
}
.mc-item__title a:hover {
    color: var(--mc-blue);
}
.mc-item__attrs {
    font-size: 11.5px;
    color: var(--mc-ink-500);
    margin-bottom: 6px;
    line-height: 1.4;
}
.mc-item__attrs p,
.mc-item__attrs dl,
.mc-item__attrs dt,
.mc-item__attrs dd {
    margin: 0;
    padding: 0;
    font-size: inherit;
    color: inherit;
    display: inline;
}
.mc-item__attrs dt::after { content: ': '; }
.mc-item__attrs dd::after { content: ' · '; }
.mc-item__attrs dd:last-child::after { content: ''; }

.mc-item__qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--mc-ink-200);
    border-radius: var(--mc-r-pill);
    height: 26px;
}
.mc-item__qty button {
    width: 26px;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--mc-ink);
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0;
    transition: background .15s;
}
.mc-item__qty button:hover:not(:disabled) {
    background: var(--mc-ink-50);
}
.mc-item__qty button:disabled {
    color: var(--mc-ink-300);
    cursor: not-allowed;
}
.mc-item__qty button svg {
    width: 10px;
    height: 10px;
    display: block;
}
.mc-item__qty span {
    min-width: 22px;
    text-align: center;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--mc-ink);
    font-variant-numeric: tabular-nums;
}

.mc-item__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.mc-item__price {
    font-size: 14px;
    font-weight: 800;
    color: var(--mc-ink);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
}
.mc-item__price ins,
.mc-item__price .amount {
    text-decoration: none;
    color: inherit;
}
/* WooCommerce adds .remove and .remove_from_cart_button which have huge red font.
   Override with high specificity (no !important needed when we beat WC selectors). */
.mc-item a.mc-item__remove,
.mc-item a.mc-item__remove.remove,
.mc-item .mc-item__remove.remove_from_cart_button,
a.mc-item__remove.remove.remove_from_cart_button {
    font-size: 11px;
    font-weight: 400;
    color: var(--mc-ink-500);
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    width: auto;
    height: auto;
    line-height: 1.2;
    text-align: end;
    border-radius: 0;
    text-transform: none;
}
.mc-item a.mc-item__remove:hover,
.mc-item a.mc-item__remove.remove:hover {
    color: var(--mc-ink);
    background: none;
}
.mc-item .mc-item__remove svg {
    width: 11px;
    height: 11px;
    display: inline-block;
    flex-shrink: 0;
}

/* ─── Footer ─── */
.mc-foot {
    padding: 18px 22px;
    border-top: 1px solid var(--mc-ink-100);
    background: var(--mc-ink-50);
}
.mc-foot__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 14px;
    font-variant-numeric: tabular-nums;
}
.mc-foot__label {
    font-size: 13.5px;
    color: var(--mc-ink-500);
}
.mc-foot__total {
    font-size: 22px;
    font-weight: 900;
    color: var(--mc-ink);
    letter-spacing: -.02em;
}
.mc-foot__total .amount,
.mc-foot__total bdi {
    color: inherit;
}
.mc-foot__btns {
    display: flex;
    gap: 8px;
}
.mc-foot__cart {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 13px;
    background: #fff;
    border: 1.5px solid var(--mc-ink);
    color: var(--mc-ink);
    border-radius: var(--mc-r-pill);
    font-size: 13.5px;
    font-weight: 700;
    transition: all .2s;
    text-decoration: none;
    cursor: pointer;
}
.mc-foot__cart:hover {
    background: var(--mc-ink);
    color: #fff;
}
.mc-foot__checkout {
    flex: 1.3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 13px;
    background: var(--mc-ink);
    color: #fff;
    border-radius: var(--mc-r-pill);
    font-size: 13.5px;
    font-weight: 800;
    transition: background .2s;
    text-decoration: none;
    cursor: pointer;
    border: 0;
}
.mc-foot__checkout:hover {
    background: var(--mc-blue);
    color: #fff;
}
.mc-foot__checkout svg,
.mc-foot__cart svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* ─── Empty state ─── */
.mc-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
    gap: 14px;
}
.mc-empty__icon {
    color: var(--mc-ink-300);
}
.mc-empty__icon svg {
    width: 56px;
    height: 56px;
}
.mc-empty__msg {
    font-size: 14px;
    color: var(--mc-ink-500);
    margin: 0;
}
.mc-empty__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: var(--mc-ink);
    color: #fff;
    border-radius: var(--mc-r-pill);
    font-size: 13.5px;
    font-weight: 800;
    text-decoration: none;
    transition: background .2s;
}
.mc-empty__cta:hover {
    background: var(--mc-blue);
    color: #fff;
}

/* ─── Hide legacy side-cart styles that interfere ─── */
.side-cart .side-cart__overlay,
.side-cart .side-cart__content,
.side-cart .side-cart__header,
.side-cart .side-cart__title,
.side-cart .side-cart__close,
.side-cart .side-cart__body,
.side-cart .side-cart__footer,
.side-cart .side-cart__list,
.side-cart .side-cart__item,
.side-cart .side-cart__qty-control {
    /* Inherits new design via mc-* classes; no legacy chrome */
}

/* RTL: drawer slides from right (start side in RTL) */
[dir="rtl"] .mc-drawer {
    transform: translateX(100%);
    inset-inline-start: auto;
    inset-inline-end: 0;
    box-shadow: -4px 0 24px rgba(15,15,16,.12);
}
[dir="rtl"] .mc-drawer.is-open,
[dir="rtl"] .mc-drawer.is-active {
    transform: translateX(0);
}
