/* ==========================================================
   CART DRAWER
========================================================== */

.cart-drawer[hidden] {
  display: none !important;
}

.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 20000;
}

.cart-drawer__backdrop {
  position: absolute;
  inset: 0;

  background: rgba(15, 18, 38, 0.58);
  backdrop-filter: blur(4px);

  animation: cartBackdropIn 0.22s ease;
}

.cart-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;

  width: min(460px, 100%);
  max-width: 100%;

  display: flex;
  flex-direction: column;

  background: #fff;
  color: var(--text-main);

  box-shadow: -24px 0 70px rgba(31, 25, 84, 0.22);

  animation: cartDrawerIn 0.28s ease;
}

.cart-drawer__header {
  flex: 0 0 auto;

  min-height: 96px;
  padding: 24px 26px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  border-bottom: 1px solid var(--border-soft);
}

.cart-drawer__eyebrow {
  display: block;
  margin-bottom: 5px;

  color: var(--accent);

  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cart-drawer__header h2 {
  margin: 0;

  color: var(--primary-dark);

  font-size: 26px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.cart-drawer__close {
  width: 44px;
  height: 44px;

  flex: 0 0 44px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--border-soft);
  border-radius: 14px;

  background: #f7f8fc;
  color: var(--primary-dark);

  font-size: 28px;
  line-height: 1;

  cursor: pointer;
}

.cart-drawer__close:hover {
  background: var(--accent-soft);
}

.cart-drawer__body {
  flex: 1;
  min-height: 0;

  padding: 22px 24px;

  overflow-y: auto;
  overscroll-behavior: contain;
}

.cart-drawer__footer {
  flex: 0 0 auto;

  padding: 22px 24px 26px;

  border-top: 1px solid var(--border-soft);
  background: #fff;
}

/* Prevent page scrolling while drawer is open */

body.cart-drawer-open {
  overflow: hidden;
}

/* ==========================================================
   EMPTY CART
========================================================== */

.cart-drawer-empty {
  min-height: 100%;

  padding: 44px 18px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  text-align: center;
}

.cart-drawer-empty__icon {
  width: 92px;
  height: 92px;

  margin-bottom: 22px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 28px;

  background: var(--accent-soft);
  color: var(--primary);
}

.cart-drawer-empty h3 {
  margin: 0 0 10px;

  color: var(--primary-dark);

  font-size: 26px;
  line-height: 1.15;
}

.cart-drawer-empty p {
  max-width: 310px;
  margin: 0 0 26px;

  color: #72778d;

  font-size: 15px;
  line-height: 1.7;
}

/* ==========================================================
   CART ITEMS
========================================================== */

.cart-drawer-items {
  display: grid;
  gap: 18px;
}

.cart-drawer-item {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: 16px;

  padding-bottom: 18px;

  border-bottom: 1px solid rgba(46, 47, 121, 0.09);
}

.cart-drawer-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.cart-drawer-item__media {
  width: 94px;
  height: 94px;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;

  border: 1px solid rgba(46, 47, 121, 0.10);
  border-radius: 18px;

  background:
    radial-gradient(
      circle at top right,
      rgba(77, 83, 159, 0.14),
      transparent 38%
    ),
    #f6f7fb;
}

.cart-drawer-item__media img {
  width: 100%;
  height: 100%;

  display: block;

  object-fit: contain;
  padding: 10px;
}

.cart-drawer-item__placeholder {
  color: var(--primary);
  font-size: 18px;
  font-weight: 900;
}

.cart-drawer-item__content {
  min-width: 0;

  display: flex;
  flex-direction: column;
}

.cart-drawer-item__title {
  margin-bottom: 6px;

  color: var(--primary-dark);
  text-decoration: none;

  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
}

.cart-drawer-item__title:hover {
  color: var(--primary);
}

.cart-drawer-item__price {
  margin-bottom: 14px;

  color: var(--primary);

  font-size: 15px;
  font-weight: 900;
}

.cart-drawer-item__actions {
  margin-top: auto;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-drawer-quantity {
  display: inline-grid;
  grid-template-columns: 34px 36px 34px;
  align-items: center;

  overflow: hidden;

  border: 1px solid var(--border-soft);
  border-radius: 12px;
}

.cart-drawer-quantity button {
  width: 34px;
  height: 34px;

  border: 0;

  background: #f7f8fc;
  color: var(--primary-dark);

  font-size: 18px;
  font-weight: 800;

  cursor: pointer;
}

.cart-drawer-quantity button:hover {
  background: var(--accent-soft);
}

.cart-drawer-quantity span {
  text-align: center;

  color: var(--text-main);

  font-size: 13px;
  font-weight: 900;
}

.cart-drawer-item__remove {
  padding: 0;

  border: 0;
  background: transparent;
  color: #a33a3a;

  font: inherit;
  font-size: 12px;
  font-weight: 800;

  cursor: pointer;
}

.cart-drawer-item__remove:hover {
  text-decoration: underline;
}

/* ==========================================================
   SUMMARY
========================================================== */

.cart-drawer-summary {
  display: grid;
  gap: 12px;
}

.cart-drawer-summary > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.cart-drawer-summary > div span {
  color: #62677f;

  font-size: 15px;
  font-weight: 700;
}

.cart-drawer-summary > div strong {
  color: var(--primary-dark);

  font-size: 24px;
  letter-spacing: -0.03em;
}

.cart-drawer-summary p {
  margin: 0 0 4px;

  color: #85899b;

  font-size: 12px;
  line-height: 1.55;
}

.cart-drawer-summary .btn {
  width: 100%;
}

/* ==========================================================
   ANIMATIONS
========================================================== */

@keyframes cartDrawerIn {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes cartBackdropIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ==========================================================
   MOBILE
========================================================== */

@media (max-width: 560px) {
  .cart-drawer__panel {
    width: 100%;
  }

  .cart-drawer__header {
    min-height: 82px;
    padding: 18px 20px;
  }

  .cart-drawer__body {
    padding: 20px;
  }

  .cart-drawer__footer {
    padding: 18px 20px 22px;
  }

  .cart-drawer-item {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 13px;
  }

  .cart-drawer-item__media {
    width: 78px;
    height: 78px;
  }

  .cart-drawer-item__actions {
    align-items: flex-end;
    flex-direction: column;
  }
}