/* Favorites / wishlist — Terra B2B комплектация */

:root {
  --fav-blue: #0066FF;
  --fav-blue-hover: #0052CC;
  --fav-dark: #0F172A;
  --fav-red: #E11D48;
  --fav-slate: #475569;
  --fav-muted: #64748B;
  --fav-border: #E2E8F0;
  --fav-bg: #F8FAFC;
}

/* --- Listing / PDP heart button --- */
.terra-btn-fav {
  appearance: none;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
  padding: 0;
}

.terra-btn-fav .heart-svg {
  color: #94A3B8;
  transition: color 0.2s, fill 0.2s, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.terra-btn-fav .fav-text.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.terra-btn-fav:hover .heart-svg {
  color: var(--fav-red);
  transform: scale(1.1);
}

.terra-btn-fav:active .heart-svg {
  transform: scale(0.9);
}

.terra-btn-fav.is-favorited .heart-svg {
  color: var(--fav-red);
  fill: var(--fav-red);
  animation: fav-heart-pop 0.35s ease-out;
}

.terra-btn-fav--icon {
  width: 36px;
  height: 36px;
  border-radius: 8px; /* match .terra-btn-compare rounded square */
  background: #fff;
  border: 1px solid var(--fav-border);
  box-shadow: none;
}

.terra-btn-fav--icon:hover {
  background: var(--fav-bg);
  border-color: #CBD5E1;
}

.terra-btn-fav--text {
  width: auto;
  min-height: 44px;
  padding: 10px 16px;
  gap: 8px;
  border-radius: 12px;
  border: 1.5px solid var(--fav-border);
  background: #fff;
  font-family: 'InterSemiBold', sans-serif;
  font-size: 0.875rem;
  color: var(--fav-dark);
}

.terra-btn-fav--text .fav-text {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  overflow: visible;
  white-space: nowrap;
}

.terra-btn-fav--text:hover {
  border-color: var(--fav-red);
  color: var(--fav-red);
}

.terra-btn-fav--text.is-favorited {
  border-color: var(--fav-red);
  color: var(--fav-red);
  background: #FFF1F2;
}

@keyframes fav-heart-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Card placement: heart top-right; compare shifted left */
.pc-card__fav {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
}

.pc-card__compare {
  right: 52px;
}

.pdp-fav-row {
  margin-top: 10px;
}

.pdp-fav-row .terra-btn-fav--text {
  width: 100%;
}

/* --- Header badge (icon-first, slate + red pill) --- */
.header-fav-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 40px;
  min-height: 40px;
  padding: 4px 6px;
  text-decoration: none !important;
  color: #64748B;
  transition: color 0.15s ease;
}

.header-fav-btn:hover,
.header-fav-btn:focus-visible {
  color: #0F172A;
  text-decoration: none !important;
}

.header-fav-btn.has-items {
  color: #64748B;
}

.header-fav-btn.has-items:hover,
.header-fav-btn.has-items:focus-visible {
  color: #0F172A;
}

.header-fav-btn__icon {
  position: relative;
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
}

.header-fav-btn__icon svg {
  display: block;
}

.header-fav-btn__pill {
  position: absolute;
  top: -7px;
  right: -9px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--fav-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
  box-shadow: 0 0 0 1.5px #fff;
  pointer-events: none;
}

.header-fav-btn__pill.is-hidden {
  display: none;
}

.header-fav-btn__pill.is-bounce {
  animation: fav-badge-bounce 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fav-badge-bounce {
  0% { transform: scale(1); }
  28% { transform: scale(1.35); }
  55% { transform: scale(0.92); }
  100% { transform: scale(1); }
}

.header-fav-btn__label {
  display: none;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: #64748B;
  white-space: nowrap;
}

@media (min-width: 1200px) {
  .header-fav-btn {
    min-width: 48px;
    padding: 2px 4px;
  }

  .header-fav-btn__label {
    display: block;
  }
}

/* --- Favorites page --- */
.favorites-page {
  /* max-width via style.css --terra-content-max (header-aligned) */
  margin: 0 auto;
  padding: 8px 0 48px;
}

.fav-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 24px;
}

.fav-page-title {
  margin: 0 0 8px;
  font-family: 'InterBold', sans-serif;
  font-size: clamp(1.5rem, 2.5vw, 1.75rem);
  color: var(--fav-dark);
  line-height: 1.2;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.fav-chip-count {
  font-size: 14px;
  font-weight: 700;
  background: var(--fav-bg);
  color: var(--fav-blue);
  padding: 3px 12px;
  border-radius: 20px;
  border: 1px solid var(--fav-border);
}

.fav-page-lead {
  margin: 0;
  max-width: 560px;
  color: var(--fav-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.fav-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.btn-fav-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--fav-border);
  color: var(--fav-slate);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-fav-secondary:hover {
  border-color: var(--fav-blue);
  color: var(--fav-blue);
}

.btn-fav-clear {
  appearance: none;
  background: none;
  border: none;
  color: var(--fav-red);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px;
}

.btn-fav-clear:hover {
  color: #be123c;
}

.favorites-layout-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  align-items: start;
}

.favorites-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.fav-card {
  background: #fff;
  border: 1px solid var(--fav-border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.fav-card:hover {
  border-color: rgba(0, 102, 255, 0.4);
  box-shadow: 0 12px 24px -6px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}

.fav-card-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fav-bg);
  border: none;
  color: #94A3B8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s, color 0.2s;
}

.fav-card-remove:hover {
  background: #FEE2E2;
  color: #EF4444;
}

.fav-card-img-wrap {
  height: 160px;
  background: var(--fav-bg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 12px;
}

.fav-card-img-wrap img {
  max-height: 85%;
  max-width: 85%;
  object-fit: contain;
}

.fav-card-sku {
  font-size: 11px;
  color: #94A3B8;
  text-transform: uppercase;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.fav-card-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  min-height: 38px;
  margin: 4px 0 8px;
  overflow: hidden;
}

.fav-card-title a {
  color: var(--fav-dark);
  text-decoration: none;
}

.fav-card-title a:hover {
  color: var(--fav-blue);
}

.fav-card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.fav-card-specs span {
  font-size: 11.5px;
  background: var(--fav-bg);
  color: var(--fav-slate);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #EDF2F7;
}

/* Cap chips without Twig set/merge scoping bugs */
.fav-card-specs span:nth-child(n+5) {
  display: none;
}

.fav-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #F1F5F9;
}

.fav-card-price strong {
  font-size: 16px;
  color: var(--fav-dark);
}

.fav-card-price--request {
  color: var(--fav-blue);
  font-weight: 600;
  font-size: 14px;
}

.btn-fav-add-cart {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--fav-blue);
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-fav-add-cart:hover {
  background: var(--fav-blue-hover);
}

.btn-fav-request-quote {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: #fff;
  border: 1.5px solid var(--fav-blue);
  color: var(--fav-blue);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.btn-fav-request-quote:hover {
  background: var(--fav-blue);
  color: #fff;
}

/* Summary */
.fav-summary-box {
  background: #fff;
  border: 1px solid var(--fav-border);
  border-radius: 20px;
  padding: 24px;
  position: sticky;
  top: 96px;
  box-shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.05);
}

.fav-summary-box__heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--fav-dark);
  margin: 0 0 16px;
}

.fav-summary-box__metrics {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fav-metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  color: var(--fav-slate);
}

.fav-metric-row__val {
  font-weight: 600;
  color: var(--fav-dark);
  white-space: nowrap;
}

.fav-metric-row__val--muted {
  font-weight: 500;
  color: var(--fav-muted);
}

.fav-summary-box__sep {
  height: 1px;
  background: var(--fav-border);
  margin: 18px 0;
}

.fav-summary-box__total-label {
  font-size: 13px;
  color: var(--fav-muted);
  display: block;
}

.fav-summary-box__total-amount {
  font-size: 26px;
  font-weight: 800;
  color: var(--fav-blue);
  line-height: 1.2;
}

.fav-summary-box__calc-needed {
  font-size: 1.1rem;
  color: var(--fav-dark);
}

.fav-summary-box__note {
  font-size: 11px;
  color: #94A3B8;
  display: block;
  margin-top: 4px;
  line-height: 1.4;
}

.fav-summary-box__cta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.btn-summary-cart {
  height: 48px;
  background: var(--fav-blue);
  color: #fff;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.btn-summary-cart:hover {
  background: var(--fav-blue-hover);
}

.btn-summary-quote {
  height: 44px;
  background: var(--fav-dark);
  color: #fff;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.btn-summary-quote:hover {
  opacity: 0.92;
}

.fav-summary-box__trust {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--fav-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fav-trust-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fav-muted);
}

/* Empty */
.fav-empty-state {
  text-align: center;
  padding: 64px 20px;
  background: #fff;
  border: 1px dashed var(--fav-border);
  border-radius: 24px;
}

.fav-empty-state__icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--fav-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.fav-empty-state__title {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fav-dark);
}

.fav-empty-state__text {
  margin: 0 auto 24px;
  max-width: 420px;
  color: var(--fav-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.fav-empty-state__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 12px;
  background: var(--fav-blue);
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 0.9rem;
}

.fav-empty-state__cta:hover {
  background: var(--fav-blue-hover);
}

@media (max-width: 991.98px) {
  .favorites-layout-grid {
    grid-template-columns: 1fr;
  }

  .fav-summary-box {
    position: static;
  }
}

@media print {
  .moskvin-header-sticky,
  .moskvin-header-spacer,
  footer,
  #cookieConsent,
  #compareFloatingBar,
  .no-print,
  .fav-header-actions,
  .fav-card-remove,
  .fav-summary-box__cta,
  .fav-card-cta,
  .terra-breadcrumbs,
  .breadcrumbs {
    display: none !important;
  }

  .favorites-layout-grid {
    display: block;
  }

  .fav-summary-box {
    position: static;
    box-shadow: none;
    border: 1px solid #000;
    margin-top: 30px;
    page-break-inside: avoid;
  }

  .fav-card {
    break-inside: avoid;
    box-shadow: none;
    transform: none;
  }

  .fav-page-lead {
    display: none;
  }
}
