/* ── cart-ui.css — общий стиль корзины-модалки (index + product) ──
   Канон: «ящик» справа с qty +/- и remove. Использует общие токены
   (--cp/--tx/--tx2/--bd/--cp-dk/--fb/--fd/--bg-s) с fallback-значениями
   на случай страниц без полного :root. */

.proto-modal { display: none; position: fixed; inset: 0; z-index: 1000; }
.proto-modal.open { display: block; }

.proto-modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
}

.proto-modal-cart .proto-modal-content {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 100%; max-width: 450px;
  background: #fff;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  transform: translateX(100%);
  transition: transform 0.3s ease-out;
}
.proto-modal-cart.open .proto-modal-content { transform: translateX(0); }

.proto-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--bd, #E5E5E5);
}
.proto-modal-header h3 {
  font-family: var(--fd, 'Unbounded', system-ui, sans-serif);
  font-size: 20px; font-weight: 700;
  color: var(--tx, #1A1A1A); margin: 0;
}

.proto-modal-close {
  width: 40px; height: 40px;
  border: none; background: none; cursor: pointer;
  font-size: 28px; line-height: 1;
  color: var(--tx2, #6B6B6B);
  transition: color 0.2s;
}
.proto-modal-close:hover { color: var(--cp, #FF6B35); }

.proto-modal-body { flex: 1; overflow-y: auto; padding: 24px; }

.proto-empty { text-align: center; color: var(--tx2, #6B6B6B); font-size: 16px; margin-top: 60px; }

/* ── cart item (qty +/- + remove) ── */
.proto-cart-item {
  display: flex; gap: 16px; padding: 16px 0;
  border-bottom: 1px solid var(--bd, #E5E5E5);
}
.proto-cart-item:last-child { border-bottom: none; }
.proto-cart-item img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; }
.proto-cart-item-details { flex: 1; min-width: 0; }
.proto-cart-item-name { font-weight: 600; margin-bottom: 4px; }
.proto-cart-item-price { color: var(--tx2, #6B6B6B); font-size: 14px; }
.proto-cart-item-controls { display: flex; align-items: center; gap: 12px; }
.proto-cart-qty { display: flex; align-items: center; gap: 8px; }
.proto-cart-qty button {
  width: 28px; height: 28px;
  border: 1px solid var(--bd, #E5E5E5); background: #fff;
  border-radius: 4px; cursor: pointer; transition: all 0.15s;
}
.proto-cart-qty button:hover { background: var(--bg-s, #F7F5F2); border-color: var(--cp, #FF6B35); }
.proto-cart-qty span { font-weight: 600; }
.proto-cart-item-remove {
  width: 28px; height: 28px;
  border: none; background: #FFE5E5; color: #D32F2F;
  border-radius: 4px; cursor: pointer; font-size: 16px; transition: all 0.15s;
}
.proto-cart-item-remove:hover { background: #FFCDD2; }

/* ── footer + checkout ── */
.proto-modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--bd, #E5E5E5);
  background: #fafafa;
}
.proto-btn-checkout {
  width: 100%; height: 52px;
  padding: 0 20px; box-sizing: border-box;
  background: var(--cp, #FF6B35); color: #fff;
  border: none; border-radius: 12px;
  font-size: 16px; font-weight: 600;
  font-family: var(--fb, 'Inter', system-ui, sans-serif);
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.proto-btn-checkout:hover:not(:disabled) {
  background: var(--cp-dk, #E55520);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255,107,53,0.4);
}
.proto-btn-checkout:disabled { opacity: 0.5; cursor: not-allowed; }

/* checkout button layout (label слева, сумма справа) */
.checkout-label { margin-right: auto; }
.checkout-amount { display: flex; align-items: center; }

/* loading state + spinner */
.proto-btn-checkout.loading { pointer-events: none; opacity: 0.8; }
.proto-btn-checkout.loading .checkout-label::after {
  content: ''; display: inline-block;
  width: 16px; height: 16px; margin-left: 8px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  border-radius: 50%;
  animation: checkout-spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes checkout-spin { to { transform: rotate(360deg); } }

/* mobile */
@media (max-width: 768px) {
  .proto-modal-cart .proto-modal-content { max-width: 100%; }
  .proto-modal-header,
  .proto-modal-body,
  .proto-modal-footer { padding: 16px 20px; }
  .proto-btn-checkout { height: 48px; font-size: 15px; }
}

/* ── Centered modal (composition / «Состав») ── */
.proto-modal-center .proto-modal-content {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(.96);
  width: calc(100% - 32px); max-width: 460px;
  max-height: 88vh;
  background: #fff; border-radius: 18px;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
  opacity: 0; transition: opacity .2s ease, transform .2s ease;
  overflow: hidden;
}
.proto-modal-center.open .proto-modal-content { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.comp-lead { font-size: 15px; color: var(--tx, #1A1A1A); line-height: 1.5; margin: 0 0 16px; }
.comp-lead strong { color: var(--cp, #FF6B35); }
.comp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.comp-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 500; color: var(--tx, #1A1A1A);
  background: var(--bg-s, #F7F5F2); border-radius: 10px; padding: 11px 14px;
}
.comp-item svg { color: var(--cp, #FF6B35); flex-shrink: 0; }
.comp-note { font-size: 12px; color: var(--tx2, #6B6B6B); line-height: 1.5; margin: 16px 0 0; }

.comp-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 24px; border-top: 1px solid var(--bd, #E5E5E5);
}
.comp-price { display: flex; flex-direction: column; line-height: 1.1; }
.comp-price__main { font-family: var(--fd, 'Unbounded', sans-serif); font-size: 22px; font-weight: 700; color: var(--tx, #1A1A1A); }
.comp-price__old { font-size: 13px; color: var(--tx2, #6B6B6B); text-decoration: line-through; opacity: .6; }
.comp-actions { display: flex; align-items: center; gap: 8px; }
.comp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 46px; padding: 0 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  border: none; transition: background .2s, transform .2s, border-color .2s;
}
.comp-btn--ghost { background: #fff; color: var(--cs, #3D2B8E); border: 1.5px solid var(--bd, #E5E5E5); }
.comp-btn--ghost:hover { border-color: var(--cs, #3D2B8E); }
.comp-btn--primary { background: var(--cp, #FF6B35); color: #fff; }
.comp-btn--primary:hover { background: var(--cp-dk, #e55a26); transform: translateY(-1px); }

@media (max-width: 480px) {
  .comp-footer { flex-direction: column; align-items: stretch; gap: 12px; }
  .comp-price { flex-direction: row; align-items: baseline; gap: 8px; justify-content: center; }
  .comp-actions { width: 100%; }
  .comp-btn { flex: 1; }
}
