/**
 * PharmEtrade — Cart Page Styles
 */

/* ── Empty State ──────────────────────────────────── */
.cart-empty {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  max-width: 480px;
  margin: 0 auto;
}

.cart-empty__icon {
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
  opacity: 0.4;
}

.cart-empty__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
}

.cart-empty__sub {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-base);
  margin-bottom: var(--space-xl);
}

/* ── Cart Layout ──────────────────────────────────── */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-xl);
  align-items: start;
}

/* ── Cart Items ───────────────────────────────────── */
.cart-items {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.cart-items__header {
  display: grid;
  grid-template-columns: 1fr 100px 130px 100px 44px;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-lg);
  background: var(--color-bg-section);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-family: var(--font-mono);
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr 100px 130px 100px 44px;
  gap: var(--space-4);
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
  align-items: center;
  transition: background var(--transition-fast);
}

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

.cart-item:hover {
  background: var(--color-bg-raised);
}

/* Product Cell */
.cart-item__product {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.cart-item__img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--color-bg-canvas);
  flex-shrink: 0;
  border: 1px solid var(--color-border-light);
}

.cart-item__details {
  min-width: 0;
}

.cart-item__name {
  font-size: 14px;
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  line-height: 1.3;
  margin-bottom: 2px;
  text-decoration: none;
  display: block;
}

.cart-item__name:hover {
  color: var(--color-navy);
}

.cart-item__meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Price Cell */
.cart-item__price {
  font-size: 14px;
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  font-family: var(--font-mono);
}

/* Quantity Cell */
.cart-item__qty {
  display: flex;
  align-items: center;
  gap: 0;
}

.cart-item__qty-btn {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--color-border);
  background: var(--color-bg-white);
  color: var(--color-text-primary);
  font-size: 16px;
  font-weight: var(--weight-semibold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.cart-item__qty-btn:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  border-right: none;
}

.cart-item__qty-btn:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  border-left: none;
}

.cart-item__qty-btn:hover {
  background: var(--color-navy);
  border-color: var(--color-navy);
  color: #fff;
}

.cart-item__qty-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.cart-item__qty-val {
  width: 44px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--color-border);
  background: var(--color-bg-white);
  font-size: 14px;
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  font-family: var(--font-mono);
}

/* Total Cell */
.cart-item__total {
  font-size: 15px;
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  font-family: var(--font-mono);
}

/* Remove Button */
.cart-item__remove {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast), color var(--transition-fast);
  font-size: 18px;
}

.cart-item__remove:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* ── Order Summary ────────────────────────────────── */
.cart-summary {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  position: sticky;
  top: calc(var(--nav-height) + var(--space-lg));
}

.cart-summary__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text-primary);
  margin-bottom: var(--space-lg);
}

.cart-summary__rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.cart-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.cart-summary__row span:last-child {
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  font-family: var(--font-mono);
}

.cart-summary__shipping {
  font-size: var(--text-xs) !important;
  color: var(--color-text-muted) !important;
  font-family: var(--font-body) !important;
}

.cart-summary__divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-lg) 0;
}

.cart-summary__row--total {
  font-size: 17px;
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-lg);
}

.cart-summary__row--total span:last-child {
  font-size: 22px;
  font-weight: var(--weight-bold);
  color: var(--color-navy);
}

.cart-summary__checkout {
  height: 52px;
  border-radius: var(--radius-md);
  font-size: 16px;
  margin-bottom: var(--space-lg);
}

.cart-summary__trust {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-light);
}

/* ── Continue Shopping ────────────────────────────── */
.cart-continue {
  margin-top: var(--space-xl);
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 1024px) {
  .cart-layout {
    grid-template-columns: 1fr;
  }

  .cart-summary {
    position: static;
  }
}

@media (max-width: 768px) {
  .cart-items__header {
    display: none;
  }

  .cart-item {
    grid-template-columns: 1fr;
    gap: var(--space-3);
    padding: var(--space-4);
    position: relative;
  }

  .cart-item__product {
    padding-right: 44px;
  }

  .cart-item__price {
    display: none;
  }

  .cart-item__qty {
    justify-self: start;
  }

  .cart-item__total::before {
    content: 'Total: ';
    font-weight: var(--weight-regular);
    color: var(--color-text-secondary);
    font-family: var(--font-body);
    font-size: var(--text-sm);
  }

  .cart-item__remove {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
  }
}
