/* ==========================================================================
   GenZdukan — Shopping Cart Page Styles
   Cart items, summary, empty state, and responsive layout.
   Theme: Premium Modern Marketplace (Pearl bg, White cards, 12–16px radius)
   ========================================================================== */

/* ── Page Layout ──────────────────────────────────────────────────────────── */
.cart-page {
  padding-top: calc(var(--header-height) + var(--space-2xl));
  padding-bottom: var(--space-4xl);
  min-height: 80vh;
  background: var(--color-bg);
}

.cart-page__header {
  margin-bottom: var(--space-2xl);
}

.cart-page__title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--weight-extrabold);
  color: var(--color-primary-dark);
}

.cart-page__count {
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  color: var(--color-text-secondary);
  margin-left: var(--space-sm);
}

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

/* ── Cart Items List ──────────────────────────────────────────────────────── */
.cart-items {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
}

.cart-items__header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 50px;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-xl);
  background: var(--color-bg-alt);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}

.cart-items__footer {
  padding: var(--space-md) var(--space-xl);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  justify-content: flex-end;
  background: var(--color-white);
}

/* ── Individual Cart Item ─────────────────────────────────────────────────── */
.cart-item {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 50px;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  align-items: center;
  border-bottom: 1px solid var(--color-border-light);
  transition: background-color var(--transition-fast);
}

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

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

/* Product info cell */
.cart-item__product {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.cart-item__image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg);
  flex-shrink: 0;
  border: 1px solid var(--color-border-light);
}

.cart-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-base);
}

.cart-item__image:hover img {
  transform: scale(1.05);
}

.cart-item__details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cart-item__name {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-primary-dark);
  transition: color var(--transition-fast);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.cart-item__price-mobile {
  display: none;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

/* Price cell */
.cart-item__price {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
}

/* Quantity cell */
.cart-item__qty {
  display: flex;
  justify-content: center;
}

.qty-selector--sm {
  transform: scale(0.85);
}

/* Total cell */
.cart-item__total {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-primary-dark);
}

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

.cart-item__remove:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
}

/* ── Cart Summary ─────────────────────────────────────────────────────────── */
.cart-summary {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border-light);
  padding: var(--space-xl);
  position: sticky;
  top: calc(var(--header-height) + var(--space-xl));
}

.cart-summary__title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-primary-dark);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
}

/* Free shipping progress */
.cart-summary__shipping-progress {
  background: var(--color-secondary-light);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  border: 1px solid rgba(2, 132, 199, 0.15);
}

.cart-summary__shipping-progress--free {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
}

.cart-summary__shipping-msg {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.cart-summary__shipping-progress--free .cart-summary__shipping-msg {
  color: var(--color-success);
  font-weight: var(--weight-semibold);
}

.cart-summary__progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.cart-summary__progress-fill {
  height: 100%;
  background: var(--color-secondary);
  border-radius: var(--radius-pill);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-summary__shipping-progress--free .cart-summary__progress-fill {
  background: var(--color-success);
}

/* Summary lines */
.cart-summary__lines {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

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

.cart-summary__line--total {
  font-size: var(--text-lg);
  font-weight: var(--weight-extrabold);
  color: var(--color-primary-dark);
  padding-top: var(--space-sm);
}

.text-success {
  color: var(--color-success) !important;
  font-weight: var(--weight-semibold);
}

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

/* Buttons */
.cart-summary__checkout {
  width: 100%;
  margin-bottom: var(--space-sm);
}

.cart-summary__continue {
  width: 100%;
  margin-bottom: var(--space-lg);
}

/* Trust badges */
.cart-summary__trust {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-light);
}

.cart-summary__trust-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.cart-summary__trust-item svg {
  color: var(--color-success);
}

/* ── Empty Cart State ─────────────────────────────────────────────────────── */
.cart-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-4xl) var(--space-xl);
  min-height: 50vh;
}

.cart-empty__illustration {
  width: 180px;
  height: 180px;
  margin-bottom: var(--space-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  position: relative;
  box-shadow: var(--shadow-md);
}

.cart-empty__illustration svg {
  opacity: 0.4;
  color: var(--color-primary-dark);
}

.cart-empty__illustration::before {
  content: '';
  position: absolute;
  inset: -15px;
  border-radius: var(--radius-full);
  border: 2px dashed var(--color-border);
  animation: spin 30s linear infinite;
}

.cart-empty__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-primary-dark);
  margin-bottom: var(--space-sm);
}

.cart-empty__message {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  max-width: 400px;
  margin-bottom: var(--space-2xl);
  line-height: var(--leading-relaxed);
}

.cart-empty__cta {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Error State ──────────────────────────────────────────────────────────── */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-4xl) var(--space-xl);
  min-height: 50vh;
}

.error-state__icon {
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
  opacity: 0.5;
}

.error-state__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-primary-dark);
  margin-bottom: var(--space-sm);
}

.error-state__message {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  max-width: 450px;
  margin-bottom: var(--space-2xl);
  line-height: var(--leading-relaxed);
}

.error-state__actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Responsive Cart ──────────────────────────────────────────────────────── */
@media (max-width: 992px) {
  .cart-content {
    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-sm);
    padding: var(--space-lg);
    position: relative;
  }

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

  .cart-item__price {
    display: none;
  }

  .cart-item__price-mobile {
    display: block;
  }

  .cart-item__qty {
    justify-content: flex-start;
  }

  .qty-selector--sm {
    transform: scale(1);
  }

  .cart-item__total {
    font-size: var(--text-lg);
  }

  .cart-item__action {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
  }

  .cart-empty__illustration {
    width: 140px;
    height: 140px;
  }

  .cart-empty__illustration svg {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 576px) {
  .cart-page__title {
    font-size: var(--text-2xl);
  }

  .cart-summary__trust {
    flex-direction: column;
    align-items: center;
  }

  .cart-empty__cta {
    flex-direction: column;
    width: 100%;
  }

  .cart-empty__cta .btn {
    width: 100%;
    justify-content: center;
  }

  .error-state__actions {
    flex-direction: column;
    width: 100%;
  }

  .error-state__actions .btn {
    width: 100%;
    justify-content: center;
  }
}
