/* ── page grid ── */
.cart-page { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; margin-top: 12px; max-width: 100%; min-width: 0; }
.cart-items, .cart-sidebar { min-width: 0; }

.cart-page__empty { text-align: center; padding: 60px 20px; color: var(--muted); grid-column: 1 / -1; background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.cart-page__empty svg { width: 56px; height: 56px; color: var(--line); margin: 0 auto 12px; display: block; }
.cart-page__empty p { font-size: 15px; margin-bottom: 16px; }

/* ── product cards list ── */
.cart-items { display: flex; flex-direction: column; gap: 10px; }

/* ── single product card (shopeiva style) ── */
.cart-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 12px 14px; box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.cart-card:hover { box-shadow: var(--shadow-md); }

.cart-card__main { display: flex; gap: 12px; }

.cart-card__img {
    width: 80px; height: 80px; border-radius: var(--radius-sm); overflow: hidden;
    background: var(--surface-2); flex-shrink: 0; border: 1px solid var(--line-2);
    position: relative;
}
.cart-card__img img { width: 100%; height: 100%; object-fit: cover; }
.cart-card__badge {
    position: absolute; top: 4px; right: 4px;
    display: inline-flex; align-items: center; padding: 1px 5px;
    background: var(--danger); color: #fff;
    font-size: 9px; font-weight: 700; border-radius: var(--radius-sm);
}

.cart-card__body { flex: 1; min-width: 0; }

/* top row: name */
.cart-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cart-card__name {
    font-size: 13px; font-weight: 700; line-height: 1.5; display: -webkit-box;
    -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
    color: var(--text);
}
.cart-card__meta { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* middle row: qty + price */
.cart-card__mid {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
    gap: 8px; margin-top: 10px;
}

.cart-card__qty {
    display: flex; align-items: center; border: 1px solid var(--line);
    border-radius: var(--radius-sm); overflow: hidden;
    position: relative; display: inline-flex; align-items: center; justify-content: center;
}
.cart-card__qty button {
    width: 30px; height: 30px; display: grid; place-items: center;
    background: none; border: none; color: var(--muted); cursor: pointer;
    transition: all var(--transition);
}
.cart-card__qty button:hover:not(:disabled) { background: var(--surface-2); color: var(--danger); }
.cart-card__qty button:disabled { opacity: .3; cursor: not-allowed; }
.cart-card__qty button svg { width: 12px; height: 12px; }
.cart-card__qty span {
    width: 34px; height: 30px; display: grid; place-items: center;
    font-size: 12px; font-weight: 700; color: var(--text);
    border-inline: 1px solid var(--line);
}

.cart-card__prices { text-align: left; }
.cart-card__price--new { font-size: 14px; font-weight: 900; color: var(--brand); }
.cart-card__price--new small { font-size: 10px; font-weight: 400; color: var(--muted); }
.cart-card__price--old { font-size: 10px; color: var(--muted); text-decoration: line-through; margin-top: 1px; }
.cart-card__price--single { font-size: 14px; font-weight: 900; color: var(--text); }
.cart-card__price--single small { font-size: 10px; font-weight: 400; color: var(--muted); }

/* bottom row: wishlist + delete */
.cart-card__bottom {
    display: flex; align-items: center; gap: 8px; margin-top: 10px;
    padding-top: 8px; border-top: 1px solid var(--line-2);
}
.cart-card__action {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px; color: var(--muted); background: none; border: none; cursor: pointer;
    transition: color var(--transition); padding: 0;
}
.cart-card__action:hover { color: var(--danger); }
.cart-card__action svg { width: 12px; height: 12px; }
.cart-card__divider { color: var(--line); font-size: 11px; }

/* ── sidebar ── */
.cart-sidebar { align-self: start; }
.cart-sidebar__inner { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 12px; }

.cart-sidebar__card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: 16px 18px;
}
.cart-sidebar__card--shadow { box-shadow: var(--shadow-md); }
.cart-sidebar__title {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 14px;
}
.cart-sidebar__title svg { width: 16px; height: 16px; color: var(--brand); }

/* itemized per-product totals */
.cart-sidebar__items {
    display: flex; flex-direction: column; gap: 8px;
    border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 12px;
}
.cart-sidebar__item { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; font-size: 12px; }
.cart-sidebar__item-name { color: var(--muted); flex: 1; min-width: 0; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-sidebar__item-total { font-weight: 700; color: var(--text); white-space: nowrap; }

/* summary rows */
.cart-sidebar__rows { display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.cart-sidebar__row { display: flex; justify-content: space-between; align-items: center; }
.cart-sidebar__row-label { color: var(--muted); }
.cart-sidebar__row-val { font-weight: 700; color: var(--text); }
.cart-sidebar__row-val--discount { color: var(--warning, #e6a817); }
.cart-sidebar__row-val--free { color: var(--success, #22c55e); }
.cart-sidebar__row--total { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.cart-sidebar__row--total .cart-sidebar__row-label { font-weight: 800; color: var(--text); font-size: 13px; }
.cart-sidebar__row--total .cart-sidebar__row-val { font-size: 16px; font-weight: 900; color: var(--brand); }

.cart-sidebar__btn {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    width: 100%; padding: 10px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 800; border: none; cursor: pointer;
    transition: all var(--transition); text-decoration: none;
}
.cart-sidebar__btn--primary { background: var(--brand); color: #fff; }
.cart-sidebar__btn--primary:hover { background: var(--brand-dark); }
.cart-sidebar__btn--primary svg { width: 14px; height: 14px; }

.cart-sidebar__trust { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 10px; color: var(--muted); margin-top: 8px; }
.cart-sidebar__trust span { display: inline-flex; align-items: center; gap: 3px; }
.cart-sidebar__trust svg { width: 11px; height: 11px; }

/* coupon */
.cart-sidebar__coupon-row { display: flex; gap: 6px; }
.cart-sidebar__coupon-input {
    flex: 1; min-width: 0; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 12px;
    border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
    outline: none; transition: box-shadow var(--transition);
}
.cart-sidebar__coupon-input:focus { box-shadow: 0 0 0 2px var(--brand-soft); border-color: var(--brand); }
.cart-sidebar__coupon-btn {
    padding: 8px 14px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700;
    background: var(--brand); color: #fff; border: none; cursor: pointer;
    transition: background var(--transition);
}
.cart-sidebar__coupon-btn:hover { background: var(--brand-dark); }

/* ── qty spinner (digikala/google style ring fill) ── */
.cart-card__spinner {
    display: none;
    width: 14px; height: 14px; border-radius: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2; pointer-events: none;
    background: conic-gradient(var(--brand) 0deg, var(--line) 0deg);
}
.cart-card__spinner::after {
    content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--surface);
}
.cart-card__qty.is-loading .cart-card__spinner { display: block; }
.cart-card__qty.is-loading span[data-qty-val] { opacity: 0; }

/* ── tablet / collapsed (single column) ── */
@media (max-width: 991.98px) {
    .cart-page { grid-template-columns: minmax(0, 1fr); }
    .cart-sidebar__inner { position: static; }
    .cart-card__img { width: 76px; height: 76px; }
    .cart-card__name { font-size: 13px; }
    .cart-sidebar__card { max-width: 100%; }
}

/* ── mobile ── */
@media (max-width: 575.98px) {
    .section--sm { padding-block: 8px !important; }
    .container { padding-inline: 12px !important; }
    .cart-card { padding: 8px 10px; }
    .cart-card__main { gap: 8px; }
    .cart-card__img { width: 56px; height: 56px; }
    .cart-card__name { font-size: 11px; -webkit-line-clamp: 2; }
    .cart-card__mid { margin-top: 6px; gap: 6px; }
.cart-card__prices { text-align: left; min-width: 0; }
    .cart-card__price--new, .cart-card__price--single { font-size: 11px; }
    .cart-card__price--old { font-size: 9px; }
    .cart-card__qty button { width: 24px; height: 24px; }
    .cart-card__qty button svg { width: 9px; height: 9px; }
    .cart-card__qty span { width: 26px; height: 24px; font-size: 11px; }
    .cart-card__bottom { margin-top: 6px; padding-top: 6px; flex-wrap: wrap; }
    .cart-card__action { font-size: 9px; }
    .cart-sidebar__card { padding: 12px 14px; }
    .cart-sidebar__title { font-size: 13px; margin-bottom: 10px; }
    .cart-sidebar__items { gap: 6px; padding-bottom: 10px; margin-bottom: 10px; }
    .cart-sidebar__item { font-size: 11px; line-height: 1.3; }
    .cart-sidebar__item-name { font-size: 11px; }
    .cart-sidebar__item-total { font-size: 11px; }
    .cart-sidebar__rows { font-size: 12px; gap: 8px; }
    .cart-sidebar__row--total .cart-sidebar__row-val { font-size: 14px; }
    .cart-sidebar__btn { padding: 9px; font-size: 12px; }
}

/* ── small phones ── */
@media (max-width: 380px) {
    .cart-card__main { gap: 6px; }
    .cart-card__img { width: 50px; height: 50px; }
    .cart-card__name { font-size: 10px; }
    .cart-card__price--new, .cart-card__price--single { font-size: 10px; }
    .cart-card__qty button { width: 22px; height: 22px; }
    .cart-card__qty span { width: 24px; height: 22px; font-size: 10px; }
}
