/* ============================================================
   3DCORE — корзина, оформление заказа, формы
   ============================================================ */

:root {
  --hub-red: #d32300;
  --hub-red-2: #b81e00;
  --hub-ink: #14161a;
  --hub-mute: #6b7078;
  --hub-line: #e6e7ea;
  --hub-bg: #f7f7f5;
}

/* ---------- кнопка «в корзину» в карточке ---------- */
.pcard-cart.is-added {
  background: #16a34a !important;
  border-color: #16a34a !important;
}

/* ---------- уведомление ---------- */
.hub-toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: #14161a;
  color: #fff;
  font: 600 14px/1.35 system-ui, -apple-system, 'Segoe UI', sans-serif;
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
}

.hub-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hub-toast__icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  font-size: 13px;
}

.hub-toast--error .hub-toast__icon {
  background: #dc2626;
}

.hub-toast__link {
  color: #7dd3fc;
  text-decoration: underline;
  white-space: nowrap;
}

/* ---------- страница корзины ---------- */
.hub-cart {
  --pad: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 28px;
  align-items: start;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--hub-ink);
}

@media (max-width: 999px) {
  .hub-cart {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.hub-cart__title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
}

.hub-cart__count {
  font-size: 14px;
  font-weight: 500;
  color: var(--hub-mute);
}

/* список товаров */
.hub-items {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hub-line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.hub-item {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--hub-line);
}

.hub-item:last-child {
  border-bottom: 0;
}

.hub-item__img {
  width: 84px;
  height: 84px;
  border-radius: 10px;
  border: 1px solid var(--hub-line);
  background: #fff;
  object-fit: contain;
}

.hub-item__name {
  display: block;
  margin-bottom: 6px;
  color: var(--hub-ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}

.hub-item__name:hover {
  color: var(--hub-red);
}

.hub-item__meta {
  font-size: 13px;
  color: var(--hub-mute);
}

.hub-item__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.hub-item__sum {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

/* количество */
.hub-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--hub-line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.hub-qty button {
  width: 34px;
  height: 34px;
  border: 0;
  background: #fff;
  color: var(--hub-ink);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.hub-qty button:hover {
  background: var(--hub-bg);
}

.hub-qty input {
  width: 44px;
  height: 34px;
  border: 0;
  border-inline: 1px solid var(--hub-line);
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  -moz-appearance: textfield;
}

.hub-qty input::-webkit-outer-spin-button,
.hub-qty input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.hub-item__del {
  border: 0;
  background: none;
  padding: 0;
  color: var(--hub-mute);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hub-item__del:hover {
  color: #dc2626;
}

/* итог */
.hub-summary {
  position: sticky;
  top: 90px;
  border: 1px solid var(--hub-line);
  border-radius: 14px;
  background: #fff;
  padding: var(--pad);
}

@media (max-width: 999px) {
  .hub-summary {
    position: static;
  }
}

.hub-summary h3 {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
}

.hub-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 14px;
  color: var(--hub-mute);
}

.hub-row b {
  color: var(--hub-ink);
  font-size: 15px;
}

.hub-row--total {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--hub-line);
  color: var(--hub-ink);
  font-size: 15px;
  font-weight: 600;
}

.hub-row--total b {
  font-size: 24px;
  white-space: nowrap;
}

.hub-note {
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--hub-mute);
}

/* поля формы */
.hub-field {
  display: block;
  margin-bottom: 10px;
}

.hub-field[hidden] {
  display: none !important;
}

.hub-field span {
  display: block;
  margin-bottom: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--hub-mute);
}

.hub-field input,
.hub-field textarea,
.hub-field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--hub-line);
  border-radius: 9px;
  background: #fff;
  color: var(--hub-ink);
  font: inherit;
  font-size: 14px;
}

.hub-field textarea {
  min-height: 74px;
  resize: vertical;
}

.hub-field input:focus,
.hub-field textarea:focus,
.hub-field select:focus {
  outline: none;
  border-color: var(--hub-red);
  box-shadow: 0 0 0 3px rgb(211 35 0 / 0.12);
}

.hub-options {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.hub-options legend {
  margin: 0 0 6px;
  padding: 0;
  color: var(--hub-ink);
  font-size: 13px;
  font-weight: 700;
}

.hub-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--hub-line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.hub-option:has(input:checked) {
  border-color: var(--hub-red);
  box-shadow: 0 0 0 1px var(--hub-red);
}

.hub-option:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

.hub-option input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  flex: 0 0 17px;
  accent-color: var(--hub-red);
}

.hub-option span,
.hub-option b,
.hub-option small {
  display: block;
}

.hub-option b {
  color: var(--hub-ink);
  font-size: 13px;
  line-height: 1.35;
}

.hub-option small {
  margin-top: 3px;
  color: var(--hub-mute);
  font-size: 12px;
  line-height: 1.45;
}

.hub-field.has-error input,
.hub-field.has-error textarea {
  border-color: #dc2626;
}

.hub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  margin-top: 6px;
  padding: 12px 20px;
  border: 0;
  border-radius: 10px;
  background: var(--hub-red);
  color: #fff;
  font: 700 16px/1 system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}

.hub-btn:hover {
  background: var(--hub-red-2);
}

.hub-btn[disabled] {
  opacity: 0.6;
  cursor: default;
}

.hub-btn--ghost {
  background: #fff;
  color: var(--hub-ink);
  border: 1px solid var(--hub-line);
  font-weight: 600;
  font-size: 14px;
  min-height: 44px;
}

.hub-btn--ghost:hover {
  background: var(--hub-bg);
}

.hub-msg {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.45;
}

.hub-msg--err {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.hub-msg--ok {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

/* пустая корзина */
.hub-empty {
  padding: 56px 24px;
  border: 1px solid var(--hub-line);
  border-radius: 16px;
  background: #fff;
  text-align: center;
}

.hub-empty__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--hub-bg);
  color: var(--hub-mute);
}

.hub-empty h2 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 700;
}

.hub-empty p {
  margin: 0 0 22px;
  color: var(--hub-mute);
  font-size: 14.5px;
}

.hub-empty .hub-btn {
  width: auto;
  min-width: 220px;
}

/* успех */
.hub-success {
  padding: 44px 24px;
  border: 1px solid #bbf7d0;
  border-radius: 16px;
  background: #f0fdf4;
  text-align: center;
}

.hub-success h2 {
  margin: 0 0 10px;
  font-size: 22px;
  color: #15803d;
}

.hub-success p {
  margin: 0 0 8px;
  color: #166534;
  font-size: 15px;
}

.hub-success__num {
  display: inline-block;
  margin: 6px 0 18px;
  padding: 6px 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #bbf7d0;
  font-weight: 700;
  font-size: 15px;
  color: #15803d;
}

/* ---------- форма заявки (CF7) ---------- */
.wpcf7-form input[type='submit'],
.wpcf7-form button[type='submit'] {
  cursor: pointer;
}

.wpcf7-form .hub-msg {
  margin-top: 12px;
}

/* мобильная адаптация корзины */
@media (max-width: 640px) {
  .hub-item {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .hub-item__img {
    width: 68px;
    height: 68px;
  }

  .hub-item__right {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .hub-row--total b {
    font-size: 21px;
  }
}

/* ---------- бейдж количества на иконке корзины ---------- */
a[href="/cart/"] .ct-icon-container {
  position: relative;
}

.hub-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--hub-red, #d32300);
  color: #fff;
  font: 700 11px/18px system-ui, sans-serif;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
  pointer-events: none;
}

/* ---------- живой поиск ---------- */
.ct-search-form {
  position: relative;
}

#search-modal {
  background: rgb(18 21 25 / 0.98);
  overflow-y: auto;
  overscroll-behavior: contain;
}

#search-modal > .ct-panel-actions {
  padding: 12px clamp(12px, 4vw, 35px) 0;
}

#search-modal .ct-toggle-close {
  min-width: 44px;
  min-height: 44px;
}

#search-modal > .ct-panel-content {
  display: block;
  flex: 1 0 auto;
  min-height: 0;
  padding: clamp(16px, 10vh, 96px) 16px 24px;
}

#search-modal .ct-search-form {
  width: min(100%, 640px);
  margin-inline: auto;
  text-align: start;
}

#search-modal .ct-search-form-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid #727984;
  border-radius: 14px;
  background: #232831;
  outline: none;
}

#search-modal .ct-search-form-inner:focus-within {
  border-color: #8ebaff;
  box-shadow: 0 0 0 1px #8ebaff;
}

#search-modal input.modal-field {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: clamp(16px, 2vw, 19px);
  line-height: normal;
  text-align: start;
  outline: none !important;
  box-shadow: none;
}

#search-modal input.modal-field::placeholder {
  color: #bfc7d3;
  opacity: 1;
}

#search-modal button[type='submit'] {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 9px;
  color: #fff;
}

.hub-search-dd {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 900;
  max-height: min(70vh, 460px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--hub-line, #e6e7ea);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 48px rgb(0 0 0 / 0.16);
  text-align: left;
}

#search-modal .hub-search-dd {
  position: static;
  max-height: min(460px, max(68px, calc(var(--hub-search-viewport, 100dvh) - 176px)));
  margin-top: 10px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.hub-search-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 4px 10px;
  min-height: 44px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #14161a;
  font-size: 14px;
  line-height: 1.3;
  text-decoration: none;
}

.hub-search-item:is(:hover, :focus-visible) {
  background: #f7f7f5;
}

.hub-search-title {
  grid-column: 1 / -1;
  min-width: 0;
  font-weight: 600;
}

.hub-search-kind {
  justify-self: start;
  padding: 1px 6px;
  border-radius: 5px;
  background: #f0f1f3;
  color: #6b7078;
  font-size: 11px;
  font-weight: 600;
}

.hub-search-price {
  grid-column: 2;
  font-weight: 700;
  white-space: nowrap;
}

.hub-search-empty {
  padding: 14px;
  color: #6b7078;
  font-size: 14px;
}

.hub-search-all {
  display: block;
  min-height: 44px;
  margin-top: 4px;
  padding: 10px;
  border-top: 1px solid var(--hub-line, #e6e7ea);
  color: var(--hub-red, #d32300);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

/* страница результатов */
.hub-search-page {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.hub-search-page input[type='search'] {
  width: 100%;
  min-height: 52px;
  margin-bottom: 20px;
  padding: 12px 16px;
  border: 1px solid var(--hub-line, #e6e7ea);
  border-radius: 12px;
  font-size: 16px;
}

.hub-search-count {
  margin: 0 0 14px;
  color: #6b7078;
  font-size: 14px;
}

.hub-search-hint {
  padding: 30px 0;
  color: #6b7078;
  font-size: 15px;
}

.hub-search-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hub-line, #e6e7ea);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.hub-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hub-line, #e6e7ea);
  color: #14161a;
  text-decoration: none;
}

.hub-search-row:last-child {
  border-bottom: 0;
}

.hub-search-row:hover {
  background: #f7f7f5;
}

.hub-search-row__title {
  font-size: 15px;
  font-weight: 600;
}

.hub-search-row__desc {
  grid-column: 1 / -1;
  color: #6b7078;
  font-size: 13px;
  line-height: 1.4;
}

.hub-search-row__price {
  grid-column: 2;
  grid-row: 1;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 640px) {
  #search-modal > .ct-panel-content {
    padding-top: 12px;
  }

  .hub-search-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .hub-search-row__price {
    grid-column: 1;
    grid-row: auto;
  }
}
