/* Receipt printer checkout animation */

.cart-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--color-deep-cobalt);
  color: var(--color-paper-white);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.cart-badge.is-pop {
  animation: badge-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes badge-pop {
  0% {
    transform: scale(0.5);
  }
  55% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
  }
}

.nav__icon {
  position: relative;
}

.nav__icon.is-cart-pulse,
.bottom-nav__item.is-cart-pulse {
  animation: cart-icon-pulse 0.45s ease;
}

@keyframes cart-icon-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.12);
  }
}

.bottom-nav__icon-wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.bottom-nav__icon-wrap .cart-badge {
  top: -6px;
  right: -10px;
}

.product-card.is-added {
  animation: card-added 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes card-added {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(0.985);
  }
  70% {
    transform: scale(1.01);
  }
  100% {
    transform: scale(1);
  }
}

.product-card.is-added .product-card__actions {
  outline: 1.5px solid var(--color-deep-cobalt);
  outline-offset: 2px;
  border-radius: 30px;
}

.cart-flyer {
  position: fixed;
  z-index: 100;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  margin-top: -28px;
  border-radius: 10px;
  object-fit: cover;
  pointer-events: none;
  opacity: 1;
  transform: translate(0, 0) scale(1);
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.65s ease;
  box-shadow: 0 8px 20px rgba(0, 14, 31, 0.18);
}

.cart-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 95;
  transform: translate(-50%, 12px);
  max-width: min(90vw, 320px);
  padding: 10px 16px;
  border-radius: 30px;
  background: var(--color-midcurrent-navy);
  color: var(--color-paper-white);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.cart-toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 860px) {
  .cart-toast {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.cart-drawer.is-open {
  display: block;
}

.cart-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 14, 31, 0.35);
}

.cart-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(400px, 100%);
  height: 100%;
  background: var(--color-paper-white);
  border-left: 1px solid var(--color-cloud-veil);
  display: flex;
  flex-direction: column;
  animation: cart-slide 0.28s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes cart-slide {
  from {
    transform: translateX(18px);
    opacity: 0.6;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.cart-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-cloud-veil);
}

.cart-drawer__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-midcurrent-navy);
}

.cart-drawer__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--color-graphite);
}

.cart-drawer__body {
  flex: 1;
  overflow: auto;
  padding: 12px 16px 24px;
}

.cart-empty {
  padding: 48px 12px;
  text-align: center;
  color: var(--color-slate-gray);
  font-size: 14px;
}

.cart-line {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-cloud-veil);
  align-items: center;
}

.cart-line__media {
  width: 64px;
  height: 64px;
  background: #f5f5f5;
  overflow: hidden;
}

.cart-line__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-line__name {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-midcurrent-navy);
}

.cart-line__meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--color-slate-gray);
}

.cart-line__qty {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.cart-line__qty button {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--color-cloud-veil);
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--color-midcurrent-navy);
}

.cart-line__price {
  font-size: 13px;
  color: var(--color-midcurrent-navy);
  white-space: nowrap;
}

.cart-drawer__foot {
  border-top: 1px solid var(--color-cloud-veil);
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
}

.cart-drawer__total {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-midcurrent-navy);
}

.cart-drawer__purchase {
  width: 100%;
}

.product-card__actions {
  margin-top: auto;
  padding-top: 10px;
  min-height: 36px;
}

.product-card__secondary {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 8px;
  margin-top: 8px;
}

.product-card__view,
.product-card__tryon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
}

.product-card__view {
  border: 1px solid var(--color-cloud-veil);
  color: var(--color-midcurrent-navy);
  background: #fff;
}

.product-card__tryon {
  background: var(--color-deep-cobalt, #0000c5);
  color: #fff;
  border: 1px solid var(--color-deep-cobalt, #0000c5);
}

.product-card__tryon:hover {
  filter: brightness(1.08);
}

.product-card__add {
  width: 100%;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 30px;
  background: var(--color-midcurrent-navy);
  color: var(--color-paper-white);
  font-size: 13px;
  font-weight: 500;
}

.product-card__add:hover {
  background: var(--color-twilight-slate);
}

.product-qty {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--color-cloud-veil);
  border-radius: 30px;
  overflow: hidden;
  background: var(--color-paper-white);
}

.product-qty__btn {
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  color: var(--color-midcurrent-navy);
  background: var(--color-morning-mist);
  transition: background-color 0.15s ease;
}

.product-qty__btn:hover {
  background: var(--color-soft-stone);
}

.product-qty__value {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-midcurrent-navy);
}

/* Receipt printer modal */
.receipt-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.receipt-modal.is-open {
  display: flex;
}

.receipt-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 14, 31, 0.45);
}

.receipt-modal__inner {
  position: relative;
  z-index: 1;
  width: min(100%, 380px);
}

.receipt-printer {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 24rem;
  flex-direction: column;
  align-items: center;
}

.receipt-printer__machine {
  position: relative;
  isolation: isolate;
  width: 100%;
  overflow: hidden;
  border-radius: 1.5rem;
  border: 1px solid #1a1a1a;
  background: linear-gradient(180deg, #2a2a2a 0%, #141414 100%);
  padding: 0.75rem;
  padding-bottom: 2rem;
  box-shadow:
    0 20px 36px -20px rgba(0, 0, 0, 0.55),
    0 6px 14px -8px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.55);
}

.receipt-printer__machine::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  opacity: 0.18;
  background-image: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.25), transparent 40%),
    radial-gradient(circle at 80% 60%, rgba(255, 255, 255, 0.08), transparent 35%);
  pointer-events: none;
}

.receipt-printer__slot {
  position: absolute;
  inset-inline: 1.5rem;
  bottom: 0.75rem;
  z-index: 40;
  height: 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid #0a0a0a;
  background: #0a0a0a;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
}

.receipt-printer__header {
  position: relative;
  z-index: 10;
  display: flex;
  height: 2.75rem;
  align-items: flex-start;
  justify-content: space-between;
}

.receipt-printer__brand {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.receipt-printer__close {
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}

.receipt-printer__screen {
  position: relative;
  z-index: 10;
  isolation: isolate;
  overflow: hidden;
  border-radius: calc(1.5rem - 0.75rem);
  border: 1px solid #0a0a0a;
  background: #0f0f0f;
  padding: 1rem;
  color: #f4f4f4;
  box-shadow: inset 0 0 24px 4px rgba(0, 0, 0, 0.52);
}

.receipt-printer__status {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.5rem;
}

.receipt-printer__indicator {
  position: relative;
  display: grid;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  place-items: center;
}

.receipt-printer__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #c8c8c8;
  border-radius: 50%;
  animation: receipt-spin 0.75s linear infinite;
}

.receipt-printer__check {
  display: none;
  color: #3dd68c;
  font-size: 16px;
  line-height: 1;
}

.receipt-printer[data-stage="complete"] .receipt-printer__spinner {
  display: none;
}

.receipt-printer[data-stage="complete"] .receipt-printer__check {
  display: block;
}

@keyframes receipt-spin {
  to {
    transform: rotate(360deg);
  }
}

.receipt-printer__label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: #b0b0b0;
}

.receipt-printer__output {
  position: relative;
  z-index: 50;
  margin-top: -1rem;
  height: 28rem;
  width: calc(80% + 3rem);
  max-width: 100%;
  overflow: hidden;
  padding-inline: 1.5rem;
  pointer-events: none;
}

.receipt-printer[data-stage="complete"] .receipt-printer__output {
  pointer-events: auto;
}

.receipt-printer__feed {
  position: relative;
  isolation: isolate;
  opacity: 0;
  transform: translateY(calc(-100% + 2px));
}

.receipt-printer[data-stage="printing"] .receipt-printer__feed,
.receipt-printer[data-stage="complete"] .receipt-printer__feed {
  opacity: 1;
}

.receipt-printer[data-stage="printing"] .receipt-printer__feed {
  animation: receipt-feed-stepped 1.75s linear forwards;
}

.receipt-printer[data-stage="complete"] .receipt-printer__feed {
  transform: translateY(0%);
}

@keyframes receipt-feed-stepped {
  0% {
    transform: translateY(calc(-100% + 2px));
  }
  7.5%,
  10.5% {
    transform: translateY(-91%);
  }
  18%,
  21% {
    transform: translateY(-81%);
  }
  28.5%,
  31.5% {
    transform: translateY(-70%);
  }
  39%,
  42% {
    transform: translateY(-58%);
  }
  49.5%,
  52.5% {
    transform: translateY(-45%);
  }
  60%,
  63% {
    transform: translateY(-32%);
  }
  70.5%,
  73.5% {
    transform: translateY(-20%);
  }
  81%,
  84% {
    transform: translateY(-10%);
  }
  91.5%,
  94.5% {
    transform: translateY(-3%);
  }
  100% {
    transform: translateY(0%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .receipt-printer__spinner {
    animation: none;
  }

  .receipt-printer[data-stage="printing"] .receipt-printer__feed {
    animation: none;
    transform: translateY(0%);
  }
}

.receipt-paper {
  position: relative;
  z-index: 10;
  min-height: 20rem;
  background: #f7f4ea;
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.35),
    rgba(0, 0, 0, 0.03)
  );
  padding: 1.75rem 1.5rem 2rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  color: #111;
  clip-path: polygon(
    0 0,
    100% 0,
    100% calc(100% - 4px),
    98.75% 100%,
    97.5% calc(100% - 4px),
    96.25% 100%,
    95% calc(100% - 4px),
    93.75% 100%,
    92.5% calc(100% - 4px),
    91.25% 100%,
    90% calc(100% - 4px),
    88.75% 100%,
    87.5% calc(100% - 4px),
    86.25% 100%,
    85% calc(100% - 4px),
    83.75% 100%,
    82.5% calc(100% - 4px),
    81.25% 100%,
    80% calc(100% - 4px),
    78.75% 100%,
    77.5% calc(100% - 4px),
    76.25% 100%,
    75% calc(100% - 4px),
    73.75% 100%,
    72.5% calc(100% - 4px),
    71.25% 100%,
    70% calc(100% - 4px),
    68.75% 100%,
    67.5% calc(100% - 4px),
    66.25% 100%,
    65% calc(100% - 4px),
    63.75% 100%,
    62.5% calc(100% - 4px),
    61.25% 100%,
    60% calc(100% - 4px),
    58.75% 100%,
    57.5% calc(100% - 4px),
    56.25% 100%,
    55% calc(100% - 4px),
    53.75% 100%,
    52.5% calc(100% - 4px),
    51.25% 100%,
    50% calc(100% - 4px),
    48.75% 100%,
    47.5% calc(100% - 4px),
    46.25% 100%,
    45% calc(100% - 4px),
    43.75% 100%,
    42.5% calc(100% - 4px),
    41.25% 100%,
    40% calc(100% - 4px),
    38.75% 100%,
    37.5% calc(100% - 4px),
    36.25% 100%,
    35% calc(100% - 4px),
    33.75% 100%,
    32.5% calc(100% - 4px),
    31.25% 100%,
    30% calc(100% - 4px),
    28.75% 100%,
    27.5% calc(100% - 4px),
    26.25% 100%,
    25% calc(100% - 4px),
    23.75% 100%,
    22.5% calc(100% - 4px),
    21.25% 100%,
    20% calc(100% - 4px),
    18.75% 100%,
    17.5% calc(100% - 4px),
    16.25% 100%,
    15% calc(100% - 4px),
    13.75% 100%,
    12.5% calc(100% - 4px),
    11.25% 100%,
    10% calc(100% - 4px),
    8.75% 100%,
    7.5% calc(100% - 4px),
    6.25% 100%,
    5% calc(100% - 4px),
    3.75% 100%,
    2.5% calc(100% - 4px),
    1.25% 100%,
    0 calc(100% - 4px)
  );
}

.receipt-paper__store {
  margin: 0 0 4px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

.receipt-paper__meta {
  margin: 0 0 16px;
  text-align: center;
  font-size: 10px;
  color: #444;
}

.receipt-paper__line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  font-size: 11px;
  line-height: 1.35;
}

.receipt-paper__line span:first-child {
  flex: 1;
  min-width: 0;
}

.receipt-paper__divider {
  border: none;
  border-top: 1px dashed #999;
  margin: 12px 0;
}

.receipt-paper__total {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
}

.receipt-paper__thanks {
  margin: 16px 0 0;
  text-align: center;
  font-size: 11px;
}

@media (max-width: 860px) {
  .cart-drawer__panel {
    width: 100%;
  }

  .cart-drawer__foot {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
}
