/* ── Cart Page Layout ── */
.cart-page {
  padding: 1.5rem 0 3rem;
  min-height: calc(100vh - 4rem);
}

/* ── Cart Content Grid ── */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

/* ── Empty Cart ── */
.empty-cart {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60vh;
}

.empty-cart__icon {
  width: 6rem;
  height: 6rem;
  background: var(--muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.empty-cart__icon svg {
  width: 3rem;
  height: 3rem;
  color: var(--muted-foreground);
}

.empty-cart__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.empty-cart__description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  max-width: 28rem;
  margin-bottom: 2rem;
  line-height: 1.8;
}

.empty-cart__btn {
  display: inline-flex;
  height: 3rem;
  padding: 0 2rem;
  border-radius: calc(var(--radius) * 1.2);
  background: linear-gradient(to left, var(--primary), var(--secondary));
  color: white;
  font-size: 1rem;
  font-weight: 500;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.empty-cart__btn:hover {
  opacity: 0.9;
}

/* ── Cart Header ── */
.cart-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.cart-header__title {
  font-size: 1.5rem;
  font-weight: 700;
}

.cart-header__count {
  color: var(--muted-foreground);
  font-weight: 400;
}

.cart-reserve-note {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  margin: 0;
  padding: 0.625rem 0.875rem;
  border-radius: calc(var(--radius) * 0.6);
  background: color-mix(in oklab, var(--primary) 8%, transparent);
}

.cart-header__clear-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: #ef4444;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--radius) * 0.8);
}

.cart-header__clear-btn:hover {
  background: color-mix(in oklab, #ef4444 10%, transparent);
}

.cart-header__clear-btn svg {
  width: 1rem;
  height: 1rem;
}

/* ── Cart Items List ── */
.cart-items {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 2);
  padding: 0.75rem 1rem;
}

/* ── Cart Item Row ── */
.cart-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item__image {
  width: 3.75rem;
  height: 3.75rem;
  aspect-ratio: 1;
  border-radius: calc(var(--radius) * 0.8);
  overflow: hidden;
  background: var(--muted);
  flex-shrink: 0;
}

.cart-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cart-item__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.cart-item__name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
  text-decoration: none;
  transition: color 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item__name:hover {
  color: var(--primary);
  text-decoration: underline;
}

.cart-item__variant {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

.cart-item__mobile-price {
  display: none;
}

/* Delete button */
.cart-item__delete {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: calc(var(--radius) * 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.cart-item__delete:hover {
  background: color-mix(in oklab, #ef4444 10%, transparent);
}

.cart-item__delete svg {
  width: 1rem;
  height: 1rem;
}

/* Quantity controls */
.cart-item__controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.375rem;
  flex-shrink: 0;
}

.cart-item__qty {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.6);
  padding: 0.125rem;
}

.cart-item__qty-btn {
  width: 1.625rem;
  height: 1.625rem;
  border-radius: calc(var(--radius) * 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cart-item__qty-btn:hover:not(:disabled) {
  background: var(--accent);
}

.cart-item__qty-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cart-item__qty-btn svg {
  width: 0.75rem;
  height: 0.75rem;
}

.cart-item__qty-value {
  width: 1.5rem;
  text-align: center;
  font-weight: 500;
  font-size: 0.75rem;
}

.cart-item__desktop-price {
  display: block;
  font-weight: 700;
  font-size: 0.75rem;
  white-space: nowrap;
}

/* ── Cart Summary ── */
.cart-summary {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 2);
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.cart-summary__title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* Free shipping banner */
.cart-summary__shipping-banner {
  background: color-mix(in oklab, var(--primary) 10%, transparent);
  border-radius: calc(var(--radius) * 0.8);
  padding: 0.75rem;
  font-size: 0.875rem;
  color: var(--primary);
  margin-bottom: 1rem;
  text-align: center;
}

.cart-summary__rows {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 0.875rem;
}

.cart-summary__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted-foreground);
}

.cart-summary__row--free-shipping {
  color: #059669;
  font-weight: 500;
}

.cart-summary__divider {
  height: 1px;
  background: var(--border);
}

.cart-summary__total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1rem;
  font-weight: 700;
  color: var(--foreground);
}

.cart-summary__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 2rem;
}

.cart-summary__checkout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 3rem;
  border-radius: calc(var(--radius) * 1.2);
  background: linear-gradient(to left, var(--primary), var(--secondary));
  color: white;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.2s ease;
  border: none;
  cursor: pointer;
}

.cart-summary__checkout-btn:hover {
  opacity: 0.9;
}

.cart-summary__back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 3rem;
  border-radius: calc(var(--radius) * 1.2);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.cart-summary__back-btn:hover {
  border-color: var(--primary);
}

/* Discount code */
.cart-summary__discount {
  margin-top: 1.5rem;
}

.cart-summary__discount-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}

.cart-summary__discount-input {
  display: flex;
  gap: 0.5rem;
}

.cart-summary__discount-field {
  flex: 1;
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.8);
  font-size: 0.875rem;
  background: var(--background);
}

.cart-summary__discount-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 10%, transparent);
}

.cart-summary__discount-btn {
  height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.8);
  background: var(--background);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cart-summary__discount-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Delivery Form ── */
.cart-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cart-delivery {
  margin-top: 0;
}

.cart-delivery__note {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.8;
  padding: 0.875rem 1rem;
  background: color-mix(in oklab, var(--primary) 6%, transparent);
  border-radius: calc(var(--radius) * 1.2);
}

/* ── Mobile Fixed Checkout Bar ── */
.mobile-checkout-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--background);
  border-top: 1px solid var(--border);
  padding: 1rem;
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.mobile-checkout-bar__info {
  display: flex;
  flex-direction: column;
}

.mobile-checkout-bar__label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.mobile-checkout-bar__amount {
  font-size: 1.125rem;
  font-weight: 700;
}

.mobile-checkout-bar__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3rem;
  padding: 0 1.5rem;
  border-radius: calc(var(--radius) * 1.2);
  background: linear-gradient(to left, var(--primary), var(--secondary));
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.mobile-checkout-bar__btn:hover {
  opacity: 0.9;
}

.mobile-spacer {
  height: 6rem;
}

/* ── Confirm Modal ── */
.modal--confirm {
  max-width: 24rem;
}

.modal__description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.modal__actions {
  display: flex;
  gap: 0.75rem;
}

.modal__actions .btn {
  flex: 1;
  height: 2.75rem;
  border-radius: calc(var(--radius) * 1.2);
  font-size: 0.875rem;
}

.btn--danger {
  background: #ef4444;
  color: white;
}

.btn--danger:hover {
  background: #dc2626;
}

/* ── Responsive ── */
@media (min-width: 640px) {
  .cart-item {
    gap: 1.5rem;
    padding: 1.25rem 0;
  }

  .cart-item__image {
    width: 7rem;
    height: 7rem;
    border-radius: calc(var(--radius) * 1.2);
  }

  .cart-item__name {
    font-size: 1rem;
    white-space: normal;
  }

  .cart-item__variant {
    font-size: 0.875rem;
  }

  .cart-item__delete {
    width: 2rem;
    height: 2rem;
  }

  .cart-item__controls {
    gap: 0.5rem;
  }

  .cart-item__qty {
    padding: 0.25rem;
    border-radius: calc(var(--radius) * 0.8);
  }

  .cart-item__qty-btn {
    width: 2rem;
    height: 2rem;
  }

  .cart-item__qty-value {
    width: 2rem;
    font-size: 0.875rem;
  }

  .cart-item__desktop-price {
    font-size: 1rem;
  }

  .cart-items {
    padding: 1rem 1.25rem;
  }

  .cart-header {
    flex-direction: row;
    align-items: center;
  }
}

@media (max-width: 1023px) {
  .cart-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "items"
      "delivery"
      "summary";
    gap: 1.25rem;
  }

  .cart-main {
    display: contents;
  }

  .cart-items {
    grid-area: items;
  }

  .cart-summary {
    grid-area: summary;
  }

  .cart-delivery {
    grid-area: delivery;
  }

  .cart-summary__actions .cart-summary__checkout-btn {
    display: flex;
  }
}

@media (min-width: 1024px) {
  .cart-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
  }

  .cart-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .cart-summary {
    position: sticky;
    top: 6rem;
  }
}
