/*-----------------------------------*\
  #CART PAGE & ADD-TO-CART UI (Held Closer)
\*-----------------------------------*/

.cart-body {
  background: hsl(0, 0%, 96%);
}

.cart-shell {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* Toast (index) */
.cart-added-toast,
.cart-photo-toast {
  position: fixed;
  bottom: 24px;
  right: 20px;
  left: 20px;
  width: min(340px, calc(100% - 40px));
  margin-left: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--lp-white);
  border-radius: 12px;
  box-shadow: 0 12px 40px hsla(0, 0%, 0%, 0.18);
  z-index: 100;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  pointer-events: none;
  box-sizing: border-box;
  border: 1px solid hsl(0, 0%, 90%);
}

.cart-added-toast.is-visible,
.cart-photo-toast.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

.cart-photo-toast {
  border-color: hsl(0, 55%, 82%);
  background: hsl(0, 68%, 98%);
}

.cart-added-toast-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(152, 45%, 94%);
  border-radius: 50%;
  color: hsl(152, 45%, 32%);
  font-size: 22px;
}

.cart-added-toast-body {
  flex: 1;
  min-width: 0;
}

.cart-added-toast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.cart-added-toast-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--lp-ink);
  margin: 0;
}

.cart-added-toast-msg {
  font-size: 13px;
  color: var(--lp-muted);
  margin: 0;
  line-height: 1.4;
}

.cart-added-toast-link {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--lp-red);
  text-decoration: none;
}

.cart-added-toast-link:hover {
  text-decoration: underline;
}

[data-cart-count].has-items {
  background: var(--lp-red);
  color: var(--lp-white);
}

.add-cart-btn,
[data-add-to-cart] {
  cursor: pointer;
}

/* Product page quantity */
.lp-qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin-bottom: 16px;
}

.lp-qty-row__label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lp-muted);
}

.lp-product-qty {
  flex-shrink: 0;
}

.lp-upload.is-required-highlight .lp-upload__dropzone {
  border-color: var(--lp-red);
  box-shadow: 0 0 0 3px hsla(0, 55%, 50%, 0.2);
  animation: cart-upload-pulse 1s ease 2;
}

@keyframes cart-upload-pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.01);
  }
}

/* Cart header */
.cart-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--lp-white);
  border-bottom: 1px solid hsl(0, 0%, 90%);
  box-shadow: 0 2px 10px hsla(0, 0%, 0%, 0.04);
}

.cart-top__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
}

.cart-top__logo {
  font-family: var(--lp-font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--lp-ink);
  text-decoration: none;
}

.cart-top__back {
  font-size: 14px;
  font-weight: 500;
  color: var(--lp-muted);
  text-decoration: none;
}

.cart-top__back:hover {
  color: var(--lp-red);
}

.cart-top__bag {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--lp-ink);
  text-decoration: none;
}

.cart-top__count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 10px;
  background: var(--lp-red);
  color: var(--lp-white);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-top__count:empty,
.cart-top__count[data-cart-count='0'] {
  display: none;
}

/* Cart main */
.cart-page {
  padding: 28px 0 48px;
  min-height: 50vh;
}

.cart-page__head {
  margin-bottom: 24px;
}

.cart-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--lp-muted);
  margin-bottom: 10px;
}

.cart-breadcrumb a {
  color: var(--lp-muted);
  text-decoration: none;
}

.cart-breadcrumb a:hover {
  color: var(--lp-red);
}

.cart-page__title {
  font-family: var(--lp-font-display);
  font-size: clamp(28px, 5vw, 36px);
  font-weight: 600;
  color: var(--lp-ink);
  text-transform: capitalize;
}

.cart-page__subtitle {
  font-size: 15px;
  color: var(--lp-muted);
  margin-top: 6px;
}

/* Empty */
.cart-empty {
  text-align: center;
  padding: 48px 24px;
  background: var(--lp-white);
  border-radius: 16px;
  border: 1px solid hsl(0, 0%, 90%);
}

.cart-empty__icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.cart-empty h2 {
  font-family: var(--lp-font-display);
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--lp-ink);
}

.cart-empty p {
  color: var(--lp-muted);
  margin-bottom: 20px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.cart-empty__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  background: var(--lp-ink);
  color: var(--lp-white);
  font-weight: 600;
  font-size: 15px;
  border-radius: 100px;
  text-decoration: none;
}

.cart-empty__btn:hover {
  background: var(--lp-red);
}

/* Layout */
.cart-layout {
  display: grid;
  gap: 24px;
  align-items: start;
}

.cart-empty[hidden],
.cart-layout[hidden] {
  display: none !important;
}

.cart-items-panel {
  background: var(--lp-white);
  border: 1px solid hsl(0, 0%, 90%);
  border-radius: 16px;
  overflow: hidden;
}

.cart-items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid hsl(0, 0%, 92%);
  background: hsl(0, 0%, 98%);
}

.cart-items-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--lp-ink);
}

.cart-clear-btn {
  font-size: 13px;
  font-weight: 500;
  color: var(--lp-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--lp-font-body);
}

.cart-clear-btn:hover {
  color: var(--lp-red);
}

.cart-items-list {
  display: flex;
  flex-direction: column;
}

/* Line item */
.cart-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid hsl(0, 0%, 92%);
  align-items: start;
}

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

.cart-item-thumbs {
  display: flex;
  gap: 8px;
}

.cart-item-img {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: hsl(0, 0%, 96%);
  flex-shrink: 0;
}

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

.cart-item-img--photo {
  border: 2px solid var(--lp-red);
}

.cart-item-details {
  min-width: 0;
}

.cart-item-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--lp-ink);
  margin-bottom: 4px;
  line-height: 1.35;
}

.cart-item-price {
  font-size: 14px;
  color: var(--lp-muted);
  margin-bottom: 8px;
}

.cart-item-photo-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--lp-red);
  margin-bottom: 10px;
}

.cart-item-letter {
  font-size: 13px;
  line-height: 1.45;
  color: var(--lp-ink);
  margin-bottom: 12px;
  padding: 10px 12px;
  background: hsl(40, 30%, 96%);
  border-left: 3px solid var(--lp-red);
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

.cart-item-letter span {
  display: block;
  font-style: normal;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  color: var(--lp-muted);
}

.cart-item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.cart-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid hsl(0, 0%, 88%);
  border-radius: 8px;
  overflow: hidden;
}

.cart-qty-btn {
  width: 34px;
  height: 34px;
  font-size: 18px;
  color: var(--lp-ink);
  background: hsl(0, 0%, 97%);
  border: none;
  cursor: pointer;
  font-family: var(--lp-font-body);
}

.cart-qty-btn:hover {
  background: var(--lp-ink);
  color: var(--lp-white);
}

.cart-qty-input {
  width: 40px;
  height: 34px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  border: none;
  font-family: var(--lp-font-body);
  -moz-appearance: textfield;
}

.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-remove-btn {
  font-size: 13px;
  font-weight: 500;
  color: var(--lp-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--lp-font-body);
}

.cart-remove-btn:hover {
  color: var(--lp-red);
}

.cart-item-total {
  font-size: 18px;
  font-weight: 700;
  color: var(--lp-ink);
  white-space: nowrap;
  padding-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Summary */
.cart-summary {
  background: var(--lp-white);
  border: 1px solid hsl(0, 0%, 90%);
  border-radius: 16px;
  padding: 22px;
}

.cart-summary h2 {
  font-family: var(--lp-font-display);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--lp-ink);
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  margin-bottom: 10px;
  color: var(--lp-muted);
}

.cart-summary-row span:last-child {
  color: var(--lp-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cart-summary-row--total {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid hsl(0, 0%, 90%);
  font-size: 18px;
  font-weight: 700;
  color: var(--lp-ink);
}

.cart-summary-row--total span:last-child {
  font-size: 18px;
  font-weight: 700;
}

.cart-shipping-note {
  font-size: 12px;
  color: hsl(152, 45%, 28%);
  background: hsl(152, 45%, 94%);
  padding: 10px 12px;
  border-radius: 8px;
  margin: 12px 0 18px;
  line-height: 1.5;
}

.cart-checkout-btn {
  width: 100%;
  padding: 15px 20px;
  background: var(--lp-ink);
  color: var(--lp-white);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--lp-font-body);
  border: none;
  border-radius: 100px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.cart-checkout-btn:hover:not(:disabled) {
  background: hsl(0, 0%, 15%);
}

.cart-checkout-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cart-continue-link {
  display: block;
  text-align: center;
  font-size: 14px;
  color: var(--lp-muted);
  text-decoration: none;
}

.cart-continue-link:hover {
  color: var(--lp-red);
}

/* Footer */
.cart-footer {
  padding: 28px 0 36px;
  border-top: 1px solid hsl(0, 0%, 90%);
  background: var(--lp-white);
  text-align: center;
}

.cart-footer__payments {
  max-width: 260px;
  height: auto;
  margin: 0 auto 12px;
  opacity: 0.85;
}

.cart-footer__copy {
  font-size: 13px;
  color: var(--lp-muted);
}

.cart-footer__copy a {
  color: var(--lp-ink);
  text-decoration: none;
}

@media (min-width: 768px) {
  .cart-added-toast,
  .cart-photo-toast {
    left: auto;
    width: 340px;
  }

  .cart-layout {
    grid-template-columns: 1fr minmax(280px, 320px);
    gap: 28px;
  }

  .cart-summary {
    position: sticky;
    top: 72px;
  }

  .cart-item-thumbs .cart-item-img {
    width: 80px;
    height: 80px;
  }
}

@media (max-width: 575px) {
  .cart-top__back {
    font-size: 13px;
  }

  .cart-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .cart-item-total {
    text-align: left;
  }
}
