/* ════════════════════════════════════════════════════════════════
   CART.CSS — Cart Page Styles
   Prefixes: ci- (cart item)  cs- (cart summary)
             ce- (empty state)  cp- (mobile sticky bar)
   AJAX hooks preserved: .qty-field, .btn-remove-item,
   data-variant, #cart-subtotal, #cart-total,
   #line-{id}, #cart-items-wrapper
════════════════════════════════════════════════════════════════ */

/* ── Items card ─────────────────────────────────────────────── */
#cart-items-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.ci-thead {
    display: grid;
    grid-template-columns: 96px 1fr 100px;
    gap: 16px;
    padding: 12px 24px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    position: relative;
}
.ci-thead::after {
    content: '';
    position: absolute;
    bottom: -1px;
    inset-inline-start: 24px;
    width: 32px;
    height: 2px;
    background: var(--color-accent);
    border-radius: 2px;
}
.ci-thead-cell {
    font-size: var(--fs-2xs); font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-muted);
}
.ci-thead-cell:last-child { text-align: end; }

/* Item row */
.cart-item-row {
    display: grid;
    grid-template-columns: 96px 1fr 100px;
    grid-template-areas: "img body price";
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    align-items: start;
    transition: background 180ms;
}
.cart-item-row:last-child { border-bottom: none; }
.cart-item-row:hover { background: var(--surface-2); }

/* Thumbnail */
.ci-img-wrap { grid-area: img; }
.ci-img {
    width: 96px; height: 96px; object-fit: cover;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    display: block;
    transition: opacity 200ms;
}
.cart-item-row:hover .ci-img { opacity: .92; }
.ci-img-ph {
    width: 96px; height: 96px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    color: var(--border-dark);
}

/* Body */
.ci-body { grid-area: body; min-width: 0; }
.ci-name {
    font-size: .9rem; font-weight: 600; color: var(--text);
    margin: 0 0 6px; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.ci-attrs {
    display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px;
}
.ci-attr {
    display: inline-block; padding: 2px 9px;
    background: rgba(var(--color-primary-rgb), .07);
    border: 1px solid rgba(var(--color-primary-rgb), .22);
    border-radius: var(--r-full);
    font-size: var(--fs-2xs); font-weight: 500; color: var(--color-primary-hover);
    letter-spacing: .02em;
}
.ci-sku {
    font-size: var(--fs-2xs); color: var(--text-muted);
    letter-spacing: .035em; margin-bottom: 12px;
    font-family: var(--font-latin);
}

/* Controls */
.ci-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.ci-stepper {
    display: inline-flex; align-items: center;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface); overflow: hidden;
    transition: border-color 150ms;
}
.ci-stepper:focus-within { border-color: rgba(var(--color-primary-rgb), .55); }
.ci-step-btn {
    width: 38px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); flex-shrink: 0;
    transition: background 130ms, color 130ms;
    touch-action: manipulation;
}
.ci-step-btn:hover { background: rgba(var(--color-primary-rgb), .09); color: var(--color-primary); }
.ci-step-btn:active { background: rgba(var(--color-primary-rgb), .16); }
.ci-step-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.ci-qty-val {
    width: 38px; text-align: center;
    font-size: .875rem; font-weight: 600; color: var(--text);
    border: none; border-inline: 1.5px solid var(--border);
    background: transparent; padding: 0; outline: none; height: 40px;
    -moz-appearance: textfield;
}
.ci-qty-val::-webkit-inner-spin-button,
.ci-qty-val::-webkit-outer-spin-button { -webkit-appearance: none; }

.ci-remove {
    display: inline-flex; align-items: center; gap: 5px;
    background: none; border: 1px solid transparent;
    border-radius: var(--r-sm);
    padding: 6px 10px; cursor: pointer;
    font-size: var(--fs-xs); color: var(--text-muted);
    transition: color 150ms, background 150ms, border-color 150ms;
    white-space: nowrap;
}
.ci-remove:hover {
    color: #dc2626;
    background: rgba(220,38,38,.06);
    border-color: rgba(220,38,38,.16);
}
.ci-remove:focus-visible { outline: 2px solid #dc2626; outline-offset: 2px; }

/* Price column */
.ci-price-col {
    grid-area: price; text-align: end; padding-top: 2px;
}
.ci-line-total {
    font-size: 1rem; font-weight: 700;
    color: var(--color-primary); white-space: nowrap;
    font-family: var(--font-latin);
}
.ci-unit-label {
    font-size: var(--fs-2xs); color: var(--text-muted);
    margin-top: 4px; white-space: nowrap;
}

/* ── Summary card ───────────────────────────────────────────── */
.cs-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: sticky;
    top: calc(var(--nav-h, 72px) + 18px);
}

.cs-head {
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    position: relative;
}
.cs-head::after {
    content: '';
    position: absolute;
    bottom: -1px;
    inset-inline-start: 22px;
    width: 32px;
    height: 2px;
    background: var(--color-accent);
    border-radius: 2px;
}
.cs-head-title {
    font-size: var(--fs-2xs); font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-muted); margin: 0;
}

.cs-rows { padding: 18px 22px 6px; }
.cs-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 7px 0; font-size: .875rem;
}
.cs-row-label { color: var(--text-muted); }
.cs-row-val { font-weight: 600; color: var(--text); }
.cs-row-note { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 400; }

/* Delivery fee notice wrapper inside the cart summary card */
.cs-delivery-notice { padding: 4px 22px 10px; }

.cs-sep {
    border: none; border-top: 1px solid var(--border);
    margin: 8px 22px;
}
.cs-total-block { padding: 8px 22px 14px; }
.cs-total-row {
    display: flex; justify-content: space-between; align-items: center;
}
.cs-total-label {
    font-size: .9rem; font-weight: 700; color: var(--text);
}
.cs-total-val {
    font-size: 1.5rem; font-weight: 700;
    color: var(--color-primary);
    font-family: var(--font-latin); letter-spacing: -.02em;
}
.cs-actions { padding: 0 22px 18px; display: flex; flex-direction: column; gap: 9px; }
.cs-btn-checkout {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 15px 20px;
    background: var(--color-primary); color: #fff;
    border: none; border-radius: var(--r-sm);
    font-size: .9rem; font-weight: 700; letter-spacing: .03em;
    text-decoration: none; text-align: center;
    box-shadow: 0 4px 14px rgba(var(--color-primary-rgb), .28);
    transition: background 200ms, box-shadow 200ms, transform 140ms;
    cursor: pointer;
    position: relative; overflow: hidden;
}
.cs-btn-checkout::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.10) 0%, transparent 55%);
    pointer-events: none;
}
.cs-btn-checkout:hover {
    background: var(--color-primary); color: #fff;
    box-shadow: 0 6px 24px rgba(var(--color-primary-rgb), .28);
    transform: translateY(-1px);
}
.cs-btn-checkout:active { transform: translateY(0) scale(.98); }
.cs-btn-checkout:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.cs-btn-checkout-arrow { transition: transform 180ms; }
.cs-btn-checkout:hover .cs-btn-checkout-arrow { transform: translateX(3px); }
html[dir="rtl"] .cs-btn-checkout:hover .cs-btn-checkout-arrow { transform: translateX(-3px); }
html[dir="rtl"] .cs-btn-checkout-arrow { transform: scaleX(-1); }

.cs-btn-continue {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px;
    background: transparent; color: var(--text-muted);
    border: 1.5px solid var(--border); border-radius: var(--r-sm);
    font-size: .875rem; font-weight: 500;
    text-decoration: none; text-align: center;
    transition: color 160ms, border-color 160ms, background 160ms;
}
.cs-btn-continue:hover {
    color: var(--color-primary-hover);
    border-color: rgba(var(--color-primary-rgb), .4);
    background: rgba(var(--color-primary-rgb), .04);
}
html[dir="rtl"] .cs-btn-continue-arrow { transform: scaleX(-1); }

.cs-trust {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 11px 22px 14px;
    border-top: 1px solid var(--border);
    font-size: var(--fs-2xs); color: var(--text-muted);
}
.cs-trust-icon { color: var(--color-accent-dark); flex-shrink: 0; }

/* ── Empty state ─────────────────────────────────────────────── */
.ce-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: clamp(48px, 8vw, 80px) 24px;
    text-align: center;
}
.ce-icon {
    width: 88px; height: 88px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), .07) 0%, rgba(var(--color-primary-rgb), .13) 100%);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--color-primary);
}
.ce-title {
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600; color: var(--text);
    margin: 0 0 10px; line-height: 1.2;
}
.ce-sub {
    font-size: .9rem; color: var(--text-muted);
    margin: 0 auto 28px;
    max-width: 320px; line-height: 1.65;
}
.ce-cta {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 13px 32px;
    background: var(--color-primary); color: #fff;
    border-radius: var(--r-sm);
    font-size: .9rem; font-weight: 700;
    text-decoration: none;
    transition: background 200ms, box-shadow 200ms, transform 140ms;
}
.ce-cta:hover {
    background: var(--color-primary); color: #fff;
    box-shadow: 0 6px 22px rgba(var(--color-primary-rgb), .22);
    transform: translateY(-1px);
}
.ce-cta:active { transform: translateY(0) scale(.98); }

/* ── Mobile sticky checkout bar ─────────────────────────────── */
.cp-mobile-cta {
    display: none;
    position: fixed;
    bottom: 0; inset-inline: 0; z-index: 200;
    background: var(--surface);
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    box-shadow: 0 -6px 28px rgba(0,0,0,.08);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 991px) {
    .cp-mobile-cta { display: block; }
    .cp-content-area { padding-bottom: 80px; }
}
@media (max-width: 767px) {
    .ci-thead { display: none; }
    .cart-item-row {
        grid-template-columns: 80px 1fr;
        grid-template-rows: auto auto;
        grid-template-areas:
            "img  body"
            "price price";
        gap: 12px;
        padding: 16px;
    }
    .ci-img, .ci-img-ph { width: 80px; height: 80px; }
    .ci-price-col {
        text-align: start;
        display: flex; align-items: center; justify-content: space-between;
        padding-top: 0;
    }
    .ci-unit-label { margin-top: 0; }
    .ci-step-btn { width: 40px; height: 44px; }
    .ci-qty-val  { height: 44px; }
}
@media (max-width: 480px) {
    #cart-items-wrapper,
    .cs-card { border-radius: var(--r-md); }
}

@media (prefers-reduced-motion: reduce) {
    .cart-item-row, .ci-img, .ci-step-btn, .ci-remove,
    .cs-btn-checkout, .cs-btn-continue, .ce-cta,
    .cs-btn-checkout-arrow { transition: none !important; }
    .cart-item-row:hover .ci-img { opacity: 1; }
}

