/* ============================================
   MugShop — Cart
   Sidebar cart, overlay, items, summary
   ============================================ */

/* ══════════════════════════════════════════════
   CART OVERLAY
   ══════════════════════════════════════════════ */

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal) var(--ease-default);
}

.cart-overlay.active {
  opacity: 1;
  visibility: visible;
}


/* ══════════════════════════════════════════════
   CART SIDEBAR
   ══════════════════════════════════════════════ */

.cart {
  position: fixed;
  top: 0;
  /* In RTL, slides from left (inset-inline-start). In LTR, right. */
  inset-inline-start: 0;
  width: var(--cart-width);
  height: 100vh;
  background: var(--color-bg-2);
  border-inline-end: 1px solid var(--color-border);
  z-index: var(--z-overlay);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--duration-slow) var(--ease-out);
  box-shadow: var(--shadow-2xl);
}

[dir="rtl"] .cart {
  transform: translateX(100%);
}

.cart.active {
  transform: translateX(0);
}

/* LTR: slide from right */
[dir="ltr"] .cart {
  inset-inline-start: auto;
  inset-inline-end: 0;
  transform: translateX(100%);
  border-inline-end: none;
  border-inline-start: 1px solid var(--color-border);
}


/* ── Cart Header ────────────────────────────── */
.cart__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.cart__title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-white);
}

.cart__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: var(--color-gold-dim);
  color: var(--color-gold);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--weight-bold);
}

.cart__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--duration-fast);
}

.cart__close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-white);
}


/* ── Cart Items List ────────────────────────── */
.cart__items {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-6);
}

.cart__item {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
  animation: cart-item-in var(--duration-normal) var(--ease-out) both;
}

.cart__item:last-child {
  border-bottom: none;
}

@keyframes cart-item-in {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.cart__item-thumb {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-3);
  flex-shrink: 0;
}

.cart__item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart__item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cart__item-name {
  font-size: var(--font-size-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-white);
  margin-bottom: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart__item-variant {
  font-size: var(--font-size-xs);
  color: var(--color-text-dim);
  margin-bottom: var(--space-2);
}

.cart__item-price {
  font-size: var(--font-size-sm);
  font-weight: var(--weight-bold);
  color: var(--color-gold);
  font-feature-settings: 'tnum';
}

.cart__item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.cart__item-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  color: var(--color-text-dim);
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--duration-fast);
  flex-shrink: 0;
}

.cart__item-remove:hover {
  background: rgba(248, 113, 113, 0.1);
  color: var(--color-danger);
}

/* Quantity in cart item */
.cart__item .quantity {
  border-color: var(--color-bg-4);
}

.cart__item .quantity__btn {
  width: 28px;
  height: 28px;
  font-size: var(--font-size-sm);
}

.cart__item .quantity__value {
  width: 36px;
  font-size: var(--font-size-sm);
  border-color: var(--color-bg-4);
}


/* ── Cart Summary ───────────────────────────── */
.cart__footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-5) var(--space-6);
  flex-shrink: 0;
}

.cart__summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.cart__summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-size-sm);
}

.cart__summary-label {
  color: var(--color-text-muted);
}

.cart__summary-value {
  color: var(--color-white);
  font-weight: var(--weight-medium);
  font-feature-settings: 'tnum';
}

.cart__summary-value--discount {
  color: var(--color-success);
}

.cart__summary-divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-1) 0;
}

.cart__summary-total {
  font-size: var(--font-size-lg);
}

.cart__summary-total .cart__summary-value {
  color: var(--color-gold);
  font-weight: var(--weight-bold);
  font-size: var(--font-size-xl);
}

/* Free shipping progress */
.cart__shipping-progress {
  margin-bottom: var(--space-4);
}

.cart__shipping-text {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  text-align: center;
}

.cart__shipping-text strong {
  color: var(--color-gold);
}

.cart__shipping-bar {
  width: 100%;
  height: 4px;
  background: var(--color-bg-4);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.cart__shipping-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-gold), var(--color-gold-light));
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
}

/* Checkout button */
.cart__checkout {
  width: 100%;
  padding: var(--space-4);
  font-size: var(--font-size-md);
}

/* Secure badge */
.cart__secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: var(--font-size-xs);
  color: var(--color-text-dim);
}


/* ── Empty Cart State ───────────────────────── */
.cart__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  text-align: center;
}

.cart__empty-icon {
  width: 120px;
  height: 120px;
  margin-bottom: var(--space-6);
  opacity: 0.3;
  color: var(--color-text-dim);
}

.cart__empty-title {
  font-size: var(--font-size-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-white);
  margin-bottom: var(--space-2);
}

.cart__empty-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-dim);
  margin-bottom: var(--space-6);
  max-width: 260px;
  line-height: var(--leading-relaxed);
}


/* ══════════════════════════════════════════════
   FULL CART PAGE
   ══════════════════════════════════════════════ */

.cart-page {
  padding-top: calc(var(--nav-height) + var(--space-8));
}

.cart-page__layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-8);
  align-items: start;
}

/* Cart Table (full page) */
.cart-table {
  width: 100%;
  background: var(--color-bg-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.cart-table__head {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 1fr auto;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-3);
  font-size: var(--font-size-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  align-items: center;
}

.cart-table__row {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 1fr auto;
  gap: var(--space-4);
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-border);
  align-items: center;
}

.cart-table__row:last-child {
  border-bottom: none;
}

.cart-table__product {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.cart-table__product-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-3);
  flex-shrink: 0;
}

.cart-table__product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-table__product-name {
  font-weight: var(--weight-semibold);
  color: var(--color-white);
  margin-bottom: var(--space-1);
}

.cart-table__product-variant {
  font-size: var(--font-size-xs);
  color: var(--color-text-dim);
}

.cart-table__price {
  font-weight: var(--weight-semibold);
  color: var(--color-white);
  font-feature-settings: 'tnum';
}

.cart-table__subtotal {
  font-weight: var(--weight-bold);
  color: var(--color-gold);
  font-feature-settings: 'tnum';
}

.cart-table__remove {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-text-dim);
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--duration-fast);
}

.cart-table__remove:hover {
  background: rgba(248, 113, 113, 0.1);
  color: var(--color-danger);
}

/* Cart Page Summary (right column) */
.cart-page__summary {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-6));
  background: var(--color-bg-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

.cart-page__summary-title {
  font-size: var(--font-size-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-white);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.cart-page__coupon {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.cart-page__coupon .input {
  flex: 1;
}

/* Cart page continue shopping */
.cart-page__continue {
  margin-top: var(--space-4);
  text-align: center;
}

.cart-page__continue a {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.cart-page__continue a:hover {
  color: var(--color-gold);
}
