﻿.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}

.cart-drawer.is-open {
  display: block;
}

.cart-page {
  display: grid;
  gap: 22px;
  min-height: calc(100vh - 110px);
  padding: 34px 0 56px;
}

.cart-page[hidden] {
  display: none;
}

.cart-page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 88% 20%, rgba(34, 58, 94, 0.12), transparent 28%),
    #fff;
  box-shadow: 0 14px 34px rgba(26, 55, 92, 0.08);
  animation: cartPanelIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cart-page-head h2 {
  margin: 4px 0 6px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

.cart-page-head span {
  color: var(--muted);
}

.cart-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 18px;
  align-items: start;
}

.cart-drawer .drawer-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(23, 50, 77, 0.28);
}

.drawer-panel {
  position: absolute;
  inset: 0 0 0 auto;
  z-index: 2;
  width: min(440px, 100%);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 20px;
  background: #ffffff;
  box-shadow: -18px 0 48px rgba(23, 50, 77, 0.18);
}

.cart-items {
  display: grid;
  align-content: start;
  gap: 12px;
  padding-right: 3px;
}

.cart-empty {
  display: grid;
  gap: 12px;
  place-items: center;
  min-height: 220px;
  padding: 26px;
  border: 1px dashed #b7ddf6;
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.cart-empty strong {
  color: var(--ink);
  font-size: 1.1rem;
}

.cart-empty span {
  max-width: 420px;
  line-height: 1.45;
}

.cart-auth-gate {
  border-style: solid;
  background:
    radial-gradient(circle at 86% 18%, rgba(255, 238, 92, 0.28), transparent 24%),
    linear-gradient(135deg, #ffffff, #eefaff);
}

.cart-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fcff;
  animation: cartItemIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.cart-item:hover {
  transform: translateY(-2px);
  border-color: rgba(34, 58, 94, 0.2);
  box-shadow: 0 12px 24px rgba(34, 58, 94, 0.1);
}

.cart-item img,
.cart-placeholder {
  width: 96px;
  height: 76px;
  border-radius: var(--radius);
  background: #fff;
}

.cart-placeholder {
  min-height: 76px;
  padding: 8px;
  align-content: center;
}

.cart-placeholder .placeholder-section,
.cart-placeholder .placeholder-line,
.cart-placeholder i {
  display: none;
}

.cart-placeholder strong {
  font-size: 0.78rem;
  line-height: 1.1;
  -webkit-line-clamp: 3;
}

.cart-item-body {
  min-width: 0;
  display: grid;
  gap: 9px;
}

.cart-item-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.cart-item-title strong {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.22;
}

.remove-button {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.quantity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quantity-control {
  display: grid;
  grid-template-columns: 30px 34px 30px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.quantity-control button {
  width: 30px;
  height: 30px;
  border: 0;
  background: #fff;
  color: var(--blue-deep);
  font-weight: 900;
}

.quantity-control span {
  display: grid;
  place-items: center;
  min-height: 30px;
  border-inline: 1px solid var(--line);
  font-weight: 800;
}

.cart-item-price {
  color: #f03565;
  font-weight: 900;
}

.cart-summary {
  position: sticky;
  top: 110px;
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(26, 55, 92, 0.08);
  animation: cartPanelIn 0.48s cubic-bezier(0.22, 1, 0.36, 1) both 80ms;
}

@keyframes cartPanelIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cartItemIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.cart-item:nth-child(2n) { animation-delay: 45ms; }
.cart-item:nth-child(3n) { animation-delay: 90ms; }

@media (prefers-reduced-motion: reduce) {
  .cart-page-head,
  .cart-summary,
  .cart-item {
    animation: none !important;
  }
}

.summary-line,
.summary-total {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.summary-line {
  color: var(--muted);
}

.summary-total {
  align-items: center;
  font-size: 1.2rem;
}

.secure-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.cart-recommendations {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.cart-recommendations .section-head {
  align-items: end;
}

@media (max-width: 460px) {
  .drawer-panel {
    padding: 14px;
  }

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

  .cart-item img,
  .cart-placeholder {
    width: 78px;
    height: 68px;
  }
}

@media (max-width: 820px) {
  .cart-page-head,
  .cart-page-layout {
    grid-template-columns: 1fr;
  }

  .cart-page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .cart-summary {
    position: static;
  }
}

