/**
 * engine-ui.css — универсальный структурный слой движка (ВСЕ магазины).
 * Грузится ДО theme.css: тема переопределяет цвета/бренд, структура едина.
 *
 * Причина появления (26.08.2026): классы тем дрейфовали от общих шаблонов
 * (theme.css стилил .checkout-section h3, шаблон рендерит .checkout-section__title;
 * .cart-layout vs .cart-page__layout) → «расползание» корзины/чекаута/списков.
 * Структура общих шаблонов стилится ЗДЕСЬ и только здесь.
 */

/* ── Кнопки: лейбл внутри .btn наследует цвет кнопки ──
   Generic .btn-text (текст-кнопка темы) красил лейбл в фирменный цвет →
   бирюзовый текст на бирюзовой кнопке = «пустая» кнопка Esita tellimus. */
.btn .btn-text {
  background: none; border: none; padding: 0;
  color: inherit; font: inherit; letter-spacing: inherit;
  text-transform: inherit; border-bottom: none;
}
.btn .btn-spinner { margin-left: .5em; }

/* ── Чекаут: сетка ── */
.checkout-page__title { margin: 2rem 0 1.5rem; }
.checkout-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px;
  gap: 2.5rem; align-items: start;
}
.checkout-summary { position: sticky; top: 90px; }
@media (max-width: 900px) {
  .checkout-layout { grid-template-columns: 1fr; gap: 1.25rem; }
  /* сводка заказа на мобильном — СНАЧАЛА (клиент видит, что оплачивает) */
  .checkout-summary { position: static; order: -1; }
}

/* ── Чекаут: нумерованные шаги (1 Kontakt → 2 Tarne → 3 Makse) ── */
.checkout-form { counter-reset: checkout-step; }
.checkout-section { margin-bottom: 2rem; }
.checkout-section__title {
  counter-increment: checkout-step;
  display: flex; align-items: center; gap: .6rem;
  font-size: .8rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--c-text, #111);
  padding-bottom: .55rem; margin-bottom: 1.1rem;
  border-bottom: 2px solid var(--c-border, #e5e7eb);
}
.checkout-section__title::before {
  content: counter(checkout-step);
  flex: 0 0 auto; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-primary, #0891b2); color: #fff;
  font-size: .85rem; font-weight: 800; letter-spacing: 0;
}
@media (max-width: 640px) {
  .checkout-section__title { font-size: .85rem; }
  .checkout-section__title::before { width: 2rem; height: 2rem; font-size: 1rem; }
}

/* ── Чекаут: submit и ошибки ── */
.btn-checkout { min-height: 3.25rem; }
.checkout-error {
  margin-top: 1rem; padding: .8rem 1rem; border-radius: 8px;
  background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
  font-size: .9rem;
}
.checkout-saved-note {
  margin: 1rem 0; padding: .7rem .9rem; border-radius: 8px;
  background: #ecfdf5; border-left: 3px solid #10b981;
  color: #065f46; font-size: .85rem;
}
.checkout-terms { display: flex; flex-direction: column; gap: .45rem; margin: 1rem 0; }
.checkout-terms label { display: flex; align-items: flex-start; gap: .55rem; cursor: pointer; font-size: .9rem; line-height: 1.45; }
.checkout-terms input[type="checkbox"] { flex: 0 0 auto; width: 1.05rem; height: 1.05rem; margin-top: .15rem; }

/* ── Корзина: сетка страницы ── */
.cart-page__title { margin: 2rem 0 1.5rem; }
.cart-page__layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  gap: 2.5rem; align-items: start;
}
.cart-page__summary { position: sticky; top: 90px; }
@media (max-width: 768px) {
  .cart-page__layout { grid-template-columns: 1fr; gap: 1.25rem; }
  .cart-page__summary { position: static; }
}

/* ── Корзина: таблица → карточки на мобильном ── */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th {
  text-align: left; font-size: .7rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--c-muted, #6b7280);
  padding: .6rem .5rem; border-bottom: 2px solid var(--c-border, #e5e7eb);
}
.cart-table td { padding: .9rem .5rem; border-bottom: 1px solid var(--c-border, #e5e7eb); vertical-align: middle; }
@media (max-width: 640px) {
  .cart-table thead { display: none; }
  .cart-table, .cart-table tbody, .cart-table tr, .cart-table td { display: block; width: 100%; }
  .cart-table tr {
    position: relative; padding: .9rem 0 .9rem 0;
    border-bottom: 1px solid var(--c-border, #e5e7eb);
  }
  .cart-table td { padding: .2rem 0; border: none; }
}

/* ── Списки товаров: гарантия что грид не «уезжает» ── */
.products-grid { display: grid; gap: 1.25rem; }
.products-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.products-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .products-grid--4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 768px)  { .products-grid--4, .products-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px)  { .products-grid--4, .products-grid--3 { grid-template-columns: 1fr; } }
.product-card { min-width: 0; } /* грид-переполнение длинными названиями */
.product-card img { max-width: 100%; height: auto; }

/* ── Страница не скроллится вбок никогда ── */
html, body { overflow-x: hidden; }
