/* Shared cart UI (Westplast + backend API) */

html {
  scrollbar-gutter: stable;
}

.products-overlay.active,
.search-panel.active {
  overscroll-behavior: contain;
}

.header-cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
}

.menu-button.header-cart-btn:hover,
.menu-button.header-cart-btn:focus-visible {
  text-decoration: none;
}

.header-cart-btn .cart-icon {
  position: relative;
  display: flex;
  color: var(--ink);
}

.header-cart-btn .cart-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 0;
  height: 1px;
  background: rgba(17, 17, 17, 0.7);
  transform: translateX(-50%);
  transition: width 160ms ease;
  pointer-events: none;
}

.header-cart-btn:hover .cart-icon::after,
.header-cart-btn:focus-visible .cart-icon::after {
  width: 22px;
}

.header-cart-btn .cart-icon svg {
  display: block;
}

.header-cart-btn .cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-cart-btn .cart-badge[hidden] {
  display: none;
}

.products-overlay--cart {
  z-index: 27;
}

.products-panel--cart {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.products-panel--cart .products-panel-header {
  justify-content: center;
  position: relative;
}

.products-panel--cart .products-panel-header .menu-close {
  position: absolute;
  right: 18px;
}

#cartTitle {
  font-size: 1rem;
  letter-spacing: 0.22em;
}

.cart-panel-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  -webkit-overflow-scrolling: touch;
}

.cart-foot {
  padding: 18px 18px 28px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

.cart-empty {
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
  padding: 24px 12px;
}

.cart-line {
  display: flex;
  gap: 34px;
  align-items: center;
  justify-content: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  max-width: 620px;
  margin: 0 auto;
}

.cart-line-img {
  width: 168px;
  height: 168px;
  object-fit: contain;
  flex: 0 0 auto;
}

.cart-line-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

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

.cart-line-title {
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cart-line-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}

.cart-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cart-qty button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.cart-qty button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.cart-qty span {
  min-width: 24px;
  text-align: center;
  font-weight: 600;
}

.cart-total {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 14px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.cart-total strong {
  font-size: 1.2rem;
  letter-spacing: 0.06em;
}

.cart-field label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 6px;
}

.cart-field input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
}

.cart-checkout {
  width: 100%;
  border: none;
  cursor: pointer;
  padding: 14px 12px;
  border-radius: 0;
  background: var(--ink);
  color: #fff;
  margin-top: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.95rem;
  transition: background-color 160ms ease;
}

.cart-checkout:hover,
.cart-checkout:active {
  background: #2b2b2b;
}

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

.cart-hint {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 560px) {
  .cart-line {
    flex-wrap: wrap;
    gap: 12px 16px;
    justify-content: flex-start;
    padding: 16px 0;
  }

  .cart-line-img {
    width: min(120px, 32vw);
    height: min(120px, 32vw);
  }

  .cart-line-info {
    flex: 1 1 140px;
    min-width: 0;
  }

  .cart-line-title {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .cart-qty {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
  }
}

@media (max-width: 380px) {
  .cart-panel-scroll,
  .cart-foot {
    padding-inline: 12px;
  }

  .cart-line-img {
    width: min(96px, 28vw);
    height: min(96px, 28vw);
  }
}

