/* shop.css — витрина euro-магазина (slug='eb').
   Phase 18 quick-260604-81i: визуально пересобрана под бренд antonelli.
   Наследует CSS-переменные из /css/base.css (master template уже подключил их в <head>).
   Принципы:
     - var(--primary), var(--font-body) везде — никаких хардкод-цветов
     - Poiret One на заголовках, Raleway на теле
     - Углы 0px (премиум-стиль antonelli)
     - Тонкие рамки (var(--border)), мягкие тени (var(--shadow-card))
     - Mobile-first, breakpoint 1024px (DEC-005)
*/

/* ============ Контейнер витрины ============ */
.eb-page {
  background: #fff;
  min-height: 60vh;
  max-width: 800px;
  margin: 0 auto;
  padding: 32px var(--pad-x) 64px;
}
.eb-page form { margin: 0; }

/* На /eb/ усиливаем тень под nav-меню антонелли — иначе на белом фоне страницы
   тень `.header-categories` (6% opacity, css/header.css) практически невидна и
   обрезается контентом .eb-page. Override применяется только когда в DOM есть
   .eb-page (через :has) — на других страницах остаётся бренд-дефолт. */
body:has(.eb-page) .header-categories {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
  position: relative;
  z-index: 2;
}

.eb-page__title {
  font-family: var(--font-heading);
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 400;
  color: var(--primary);
  margin: 0 0 8px;
  letter-spacing: 0.02em;
}
.eb-page__lead {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 32px;
  line-height: 1.7;
}
.eb-page__hint {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.eb-page__cart-title {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 32px 0 12px;
}
.eb-page__empty {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
}

/* ============ Поиск-инпут (id=searchopt) ============ */
.eb-page .search-wrap {
  position: relative;
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  transition: border-color var(--fast);
  margin-bottom: 24px;
}
.eb-page .search-wrap:focus-within {
  border-color: var(--accent-dark);
}
.eb-page #searchopt {
  width: 100%;
  padding: 14px 48px 14px 16px;
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 16px;
  color: var(--primary);
  outline: none;
  box-sizing: border-box;
}
.eb-page #searchopt::placeholder {
  color: var(--muted);
  font-weight: 300;
}
.eb-page #searchopt:focus::placeholder {
  color: transparent;
  transition: color 0.2s;
}
.eb-page .search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: block;
}

/* ============ Autocomplete-выпадашка (#serchres) ============
   ВАЖНО: список рендерится в общем потоке (position: static), НЕ position: fixed —
   это не модалка, страница должна свободно скроллиться. На мобильнике даём
   ограниченную высоту с внутренним скроллом, чтобы под списком оставалась
   видна корзина / кнопка чекаута. -webkit-overflow-scrolling: touch — плавный
   iOS-скролл внутри списка. body overflow НЕ блокируется (см. shop.js — там
   нет document.body.style.overflow). Task 4 quick-260604-81i. */
.eb-page #serchres {
  background: #fff;
  -webkit-overflow-scrolling: touch;
}
.eb-page #serchres:not(:empty) {
  border: 1px solid var(--border);
  border-top: 0;
  margin-top: -25px; /* визуально стыкуется с .search-wrap */
  max-height: 65vh;
  overflow-y: auto;
  overscroll-behavior: contain; /* не прокидывает скролл в body на iOS bounce */
}

/* Строка-карточка товара (опт-режим — компактнее) */
.eb-page .opt__element {
  display: flex;
  width: 100%;
  align-items: center;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  padding: 8px 16px;
  min-height: 60px;
  cursor: pointer;
  transition: background var(--fast);
}
.eb-page .opt__element:last-child {
  border-bottom: 0;
}
.eb-page .opt__element:hover {
  background: var(--accent-light);
}
.eb-page .opt__element--img {
  width: 48px;
  height: 48px;
  position: relative;
  flex-shrink: 0;
  background: #fff;
}
.eb-page .opt__element--img img {
  position: absolute;
  object-fit: contain;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
}
.eb-page .opt__element--end {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.eb-page .opt__element--name1 {
  color: var(--primary);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  /* Перенос длинных названий — до 3 строк, без ellipsis */
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.eb-page .opt__element--price {
  margin-left: auto;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  color: var(--primary);
  flex-shrink: 0;
}
.eb-page .opt__element--button {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 400;
  cursor: pointer;
  border: 0;
  outline: none;
  border-radius: 0;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  transition: background var(--fast);
}
.eb-page .opt__element--button:hover {
  background: var(--accent-dark);
}
.eb-page .opt__element--button-rounded {
  /* Совместимость со старой разметкой — в брендовом стиле углы 0 */
  border-radius: 0;
}

/* Кнопка «Показать ещё» (load more) */
.eb-page .load-more-btn {
  display: block;
  width: 100%;
  padding: 14px;
  margin: 0;
  background: #fff;
  border: 0;
  border-top: 1px solid var(--border);
  color: var(--primary);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--fast);
}
.eb-page .load-more-btn:hover {
  background: var(--accent-light);
}

/* Состояния (empty / error / loading) */
.eb-page .empty-state,
.eb-page .error-state {
  text-align: center;
  padding: 32px 16px;
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 13px;
  color: var(--muted);
}
.eb-page .error-state {
  color: var(--red);
}

/* ============ Корзина (.iitems — items list внутри #ordform) ============ */
.eb-page .iitems {
  background: #fff;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  padding: 16px;
  display: flex;
  gap: 16px;
  align-items: center;
}
.eb-page .iitemsi {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  background: #fff;
}
.eb-page .iitemsi img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.eb-page .iitemsn {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  color: var(--primary);
}
.eb-page .iitemsp {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 18px;
  color: var(--primary);
}
.eb-page .iitemsk {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  width: 50px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  outline: none;
  text-align: center;
}
.eb-page .iitemsk:focus {
  border-color: var(--accent-dark);
}
.eb-page .iitemsc {
  display: flex;
  align-items: center;
  gap: 8px;
}
.eb-page .iitems-content {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
}
.eb-page .iitems-price {
  display: flex;
  gap: clamp(12px, 2vw, 20px);
  align-items: center;
}

/* Итог + чекаут */
.eb-page .eb-total-row {
  width: 100%;
  text-align: right;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 20px 0 16px;
}
.eb-page .final-price {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 20px;
  color: var(--primary);
  letter-spacing: 0;
  text-transform: none;
  margin-left: 12px;
}

#ordform {
  display: flex;
  flex-direction: column;
}

/* ============ Кнопки антонелли (.order-btn) ============ */
.eb-page .order-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 0;
  padding: 14px 32px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  outline: none;
  transition: background var(--fast);
}
.eb-page .order-btn:hover {
  background: var(--accent-dark);
}

/* Кнопка ✕ убрать товар — отдельный класс перебивает .order-btn */
.eb-page .remove-btn {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  padding: 8px;
  font-size: 14px;
  letter-spacing: 0;
  cursor: pointer;
  width: auto;
  height: auto;
  transition: color var(--fast);
}
.eb-page .remove-btn:hover {
  background: transparent;
  color: var(--primary);
}

/* ============ Форма чекаута (input/textarea) ============ */
.eb-page .info-form input,
.eb-page .info-form textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 16px;
  background: transparent;
  color: var(--primary);
  outline: none;
  transition: border-color var(--fast);
  box-sizing: border-box;
}
.eb-page .info-form input:focus,
.eb-page .info-form textarea:focus {
  border-bottom-color: var(--accent-dark);
}
.eb-page .info-form textarea.additional-info {
  resize: none;
}
.eb-page .eb-checkout-table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
}
.eb-page .eb-checkout-table td {
  padding: 8px 0;
  vertical-align: top;
}
.eb-page .eb-checkout-table td:first-child {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  width: 110px;
  padding-top: 22px;
}
.eb-page .eb-checkout-submit {
  text-align: center;
  padding: 32px 0 8px;
}
.eb-page .eb-error-msg {
  display: none;
  color: var(--red);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 11px;
  margin-top: 6px;
}
.eb-page .eb-error-msg--visible {
  display: block;
}

/* ============ Модалки чекаута и спасибо (#bgg + #succ) ============ */
#bgg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
}
#succ {
  display: none;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 1px solid var(--border);
  padding: 48px 32px;
  max-width: 480px;
  width: calc(100vw - 32px);
  box-sizing: border-box;
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 14px;
  color: var(--primary);
  line-height: 1.7;
  text-align: center;
  z-index: 101;
}
#succ #donum {
  display: block;
  margin-top: 16px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 18px;
  color: var(--primary);
  letter-spacing: 2px;
}

/* ============ Карточка товара (EURO-03) ============ */
.eb-product {
  background: #fff;
  min-height: 60vh;
  max-width: 600px;
  margin: 0 auto;
  padding: 32px var(--pad-x) 64px;
}
.eb-product__back {
  display: inline-block;
  margin-bottom: 24px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--fast);
}
.eb-product__back:hover {
  color: var(--primary);
}
.eb-product__photos {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 24px;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.eb-product__photo {
  width: 200px;
  height: 200px;
  flex-shrink: 0;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
}
.eb-product__title {
  font-family: var(--font-heading);
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 400;
  color: var(--primary);
  margin: 0 0 8px;
  letter-spacing: 0.02em;
}
.eb-product__brand {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
}
.eb-product__price {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 24px;
  color: var(--primary);
  margin-bottom: 24px;
}
.eb-product__buy-btn {
  display: block;
  width: 100%;
  padding: 16px;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 0;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  margin-bottom: 32px;
  transition: background var(--fast);
}
.eb-product__buy-btn:hover {
  background: var(--accent-dark);
}
.eb-product__description {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.7;
  color: var(--primary);
  margin-bottom: 32px;
}
.eb-product__properties {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  border-collapse: collapse;
}
.eb-product__properties tr {
  border-bottom: 1px solid var(--border);
}
.eb-product__properties tr:last-child {
  border-bottom: 0;
}
.eb-product__properties td {
  padding: 12px 0;
  vertical-align: top;
  font-weight: 400;
  color: var(--primary);
}
.eb-product__properties td:first-child {
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  width: 40%;
  padding-right: 16px;
}

/* ============ Mobile (≤ 1023px) — компактные паддинги ============ */
@media (max-width: 1023px) {
  .eb-page {
    padding: 24px var(--pad-x) 48px;
  }
  .eb-page__lead {
    margin-bottom: 24px;
  }
  /* Поиск + автокомплит — на ВСЮ ширину viewport (выходим за паддинг .eb-page) */
  .eb-page .search-wrap {
    margin-left: calc(-1 * var(--pad-x));
    margin-right: calc(-1 * var(--pad-x));
    border-left: 0;
    border-right: 0;
  }
  .eb-page #serchres:not(:empty) {
    margin-left: calc(-1 * var(--pad-x));
    margin-right: calc(-1 * var(--pad-x));
    border-left: 0;
    border-right: 0;
  }
  /* Автокомплит-строки: компактнее, название в 2-3 строки, мельче шрифт */
  .eb-page .opt__element {
    padding: 10px 12px;
    gap: 10px;
    min-height: 56px;
    align-items: flex-start;
  }
  .eb-page .opt__element--img {
    margin-top: 2px;
  }
  .eb-page .opt__element--end {
    align-items: flex-start;
    gap: 8px;
  }
  .eb-page .opt__element--name1 {
    font-size: 12px;
    line-height: 1.3;
    -webkit-line-clamp: 3;
  }
  .eb-page .opt__element--price {
    font-size: 13px;
    margin-top: 0;
  }
  .eb-page .opt__element--button {
    margin-top: 2px;
  }
  .eb-page .iitems {
    padding: 12px;
    gap: 12px;
  }
  .eb-page .iitemsi {
    width: 60px;
    height: 60px;
  }
  .eb-page .iitemsp {
    font-size: 16px;
  }
  .eb-product {
    padding: 24px var(--pad-x) 48px;
  }
  .eb-product__photo {
    width: 160px;
    height: 160px;
  }
}

/* ============ Desktop (≥ 1024px) — шире контейнер, крупнее карточки ============ */
@media (min-width: 1024px) {
  .eb-page {
    max-width: 1100px;
    padding: 48px var(--pad-x) 96px;
  }
  .eb-product {
    max-width: 800px;
    padding: 48px var(--pad-x) 96px;
  }
  .eb-product__photo {
    width: 280px;
    height: 280px;
  }
  .eb-product__price {
    font-size: 32px;
  }
  .eb-page .opt__element {
    padding: 10px 20px;
    gap: 16px;
    min-height: 64px;
  }
  .eb-page .opt__element--img {
    width: 56px;
    height: 56px;
  }
  .eb-page .opt__element--name1 {
    font-size: 15px;
  }
  .eb-page .opt__element--price {
    font-size: 16px;
  }
}
