/* ================= МАГАЗИН: строки покупки и корзина =================
   Подключается только на странице магазина (shop.html). */

/* ---- Строка товара с кнопкой «В корзину» ---- */
.buy-list { margin: 12px 0 4px; }
.buy-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px dashed rgba(138, 104, 44, 0.28);
  font-size: 0.92rem;
}
.buy-row:last-child { border-bottom: 0; }
.buy-row .name { color: var(--text-600); }
.buy-row .price { font-weight: 700; color: var(--text-900); white-space: nowrap; }

.btn-add {
  border: 1.5px solid var(--gold-500);
  background: transparent;
  color: var(--gold-700);
  border-radius: 999px;
  padding: 7px 16px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.btn-add:hover { background: var(--gold-500); color: var(--ink-950); }
.btn-add:active { transform: translateY(1px); }
.section--dark .buy-row, .section--darker .buy-row { border-bottom-color: rgba(208, 160, 75, 0.24); }
.section--dark .buy-row .name, .section--darker .buy-row .name { color: var(--cream-dim); }
.section--dark .buy-row .price, .section--darker .buy-row .price { color: var(--cream); }
.section--dark .btn-add, .section--darker .btn-add { color: var(--gold-300); }
.section--dark .btn-add:hover, .section--darker .btn-add:hover { color: var(--ink-950); }

/* ---- Плавающая кнопка корзины (слева, чтобы не спорить с блоком связи) ---- */
.cart-fab {
  position: fixed;
  left: 22px; bottom: 22px;
  z-index: 95;
  width: 58px; height: 58px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink-800);
  border: var(--border-gold);
  color: var(--gold-300);
  cursor: pointer;
  box-shadow: 0 10px 30px -10px rgba(14, 18, 38, 0.7);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.cart-fab:hover { background: var(--gold-500); color: var(--ink-950); border-color: var(--gold-500); }
.cart-fab.has-items { background: var(--gold-500); color: var(--ink-950); border-color: var(--gold-500); }
.cart-fab svg { width: 25px; height: 25px; }
.cart-badge {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 23px; height: 23px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ink-950);
  color: var(--gold-300);
  border: 1px solid var(--gold-500);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Затемнение и панель ---- */
.cart-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 13, 28, 0.6);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 104;
}
.cart-overlay.is-open { opacity: 1; pointer-events: auto; }

.cart-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(430px, 100%);
  background: var(--ink-950);
  color: var(--cream);
  z-index: 105;
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.3s ease;
  box-shadow: -24px 0 60px rgba(14, 18, 38, 0.55);
}
.cart-panel.is-open { transform: translateX(0); }
body.cart-locked { overflow: hidden; }

.cart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px;
  border-bottom: 1px solid rgba(208, 160, 75, 0.2);
  flex-shrink: 0;
}
.cart-head h3 { font-size: 1.5rem; }
.cart-close {
  background: none; border: 0;
  color: var(--cream-dim);
  font-size: 2rem; line-height: 1;
  cursor: pointer; padding: 0 4px;
  transition: color 0.2s ease;
}
.cart-close:hover { color: var(--gold-300); }

.cart-body { padding: 22px 26px 32px; overflow-y: auto; flex: 1; }
.cart-empty { color: var(--cream-dim); text-align: center; padding: 48px 0; }

/* ---- Позиции ---- */
.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(248, 243, 233, 0.1);
}
.cart-item-main { display: flex; flex-direction: column; gap: 3px; }
.cart-item-title { font-size: 0.92rem; line-height: 1.4; }
.cart-item-price { font-size: 0.8rem; color: rgba(248, 243, 233, 0.5); }
.cart-item-sum { font-weight: 700; color: var(--gold-300); white-space: nowrap; text-align: right; }

.cart-qty { display: flex; align-items: center; gap: 4px; grid-column: 1; }
.cart-qty button {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(208, 160, 75, 0.35);
  background: transparent;
  color: var(--gold-300);
  font-size: 1.05rem; line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.cart-qty button:hover { background: var(--gold-500); color: var(--ink-950); }
.cart-qty span { min-width: 30px; text-align: center; font-weight: 700; font-size: 0.92rem; }

.cart-total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 20px 0 6px;
  font-size: 1.05rem;
}
.cart-total strong { font-family: var(--font-display); font-size: 1.7rem; color: var(--gold-300); }
.cart-note { font-size: 0.82rem; color: rgba(248, 243, 233, 0.55); line-height: 1.5; margin-bottom: 22px; }

/* ---- Форма заказа ---- */
.cart-form { display: flex; flex-direction: column; gap: 12px; }
.cart-form input, .cart-form textarea {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(248, 243, 233, 0.18);
  background: rgba(248, 243, 233, 0.06);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: vertical;
}
.cart-form input::placeholder, .cart-form textarea::placeholder { color: rgba(248, 243, 233, 0.45); }
.cart-form input:focus, .cart-form textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  background: rgba(248, 243, 233, 0.1);
}
.cart-form .btn-primary { margin-top: 6px; border: none; width: 100%; }
.cart-privacy { font-size: 0.78rem; color: rgba(248, 243, 233, 0.45); line-height: 1.5; }
.cart-privacy a { color: inherit; }
.cart-error { color: var(--gold-300); }

.cart-done { text-align: center; padding: 40px 0; }
.cart-done-title { font-size: 1.2rem; color: var(--gold-300); margin-bottom: 12px; }
.cart-done p { color: var(--cream-dim); }

/* ---- Окно быстрой оплаты (тарифы курса) ---- */
.buy-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -46%) scale(0.98);
  width: min(430px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--ink-950);
  color: var(--cream);
  border: var(--border-gold);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(10, 13, 28, 0.6);
  z-index: 106;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.buy-modal.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
.buy-body { padding: 22px 26px 28px; }
.buy-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding-bottom: 18px; margin-bottom: 20px;
  border-bottom: 1px solid rgba(248, 243, 233, 0.12);
}
.buy-item span { font-size: 0.95rem; line-height: 1.4; }
.buy-item strong {
  font-family: var(--font-display); font-size: 1.6rem;
  color: var(--gold-300); white-space: nowrap;
}
.buy-error { color: var(--gold-300); }

/* Кнопка «Оплатить» внутри карточки тарифа */
.tariff-card .btn-buy { width: 100%; margin-top: 20px; }

@media (prefers-reduced-motion: reduce) {
  .buy-modal { transition: none; }
}

@media (max-width: 560px) {
  .buy-body { padding: 18px 20px 24px; }
  .cart-fab { left: 16px; bottom: 16px; width: 52px; height: 52px; }
  .cart-body { padding: 18px 20px 28px; }
  .cart-head { padding: 18px 20px; }
  .buy-row { grid-template-columns: 1fr auto; row-gap: 8px; }
  .buy-row .btn-add { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .cart-panel, .cart-overlay, .cart-fab { transition: none; }
}
