/**
 * MEGAPOLIS — marketplace redesign (Avito-like UX, без копий brand-assets).
 * SAFE-режим: ничего не делает с .image-autofocus, .container-item-images,
 * и не задаёт !important на структуру карточки. Только цвета, типография,
 * spacing, hover, кнопки, breadcrumb, filter-sidebar.
 */

:root {
  --m-blue: #2962ff;
  --m-blue-h: #1d4ed8;
  --m-blue-soft: #e8f0ff;
  --m-bg: #f7f8fa;
  --m-card: #ffffff;
  --m-text: #111827;
  --m-text2: #6b7280;
  --m-text3: #9ca3af;
  --m-border: #e5e7eb;
  --m-border-h: #d1d5db;
  --m-radius: 14px;
  --m-radius-sm: 10px;

  /* === STABILIZE / ШАГ 3.1.b — sticky offset feature-flag ===
     Контролируемая подмена magic-number 185px на переменную.
     Значение НЕ меняется (preserve current behavior).
     Применено только к .mp-ad-sidebar; .catalog-sidebar / .ad-card-sidebar /
     .mp-side-viewer оставлены с hardcoded значениями до ШАГ 3.1.c. */
  --mp-sticky-top: 185px;
}

body {
  background: var(--m-bg);
  color: var(--m-text);
}

.container, .container-fluid { max-width: 1280px; }

/* ============================================================
   1. CTA «Разместить объявление» — синяя кнопка в шапке
   ============================================================ */
a.btn-custom[href*="ad-create"],
a.btn-custom[href*="profile/ad-create"],
.web-menu-top .btn-custom.button-color-scheme1 {
  background: var(--m-blue);
  color: #fff;
  border: 0;
  font-weight: 600;
  height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, transform .1s;
}
a.btn-custom[href*="ad-create"]:hover,
a.btn-custom[href*="profile/ad-create"]:hover,
.web-menu-top .btn-custom.button-color-scheme1:hover {
  background: var(--m-blue-h);
  color: #fff;
  transform: translateY(-1px);
}

/* ============================================================
   2. ПОИСК — input + button + контейнер
   ============================================================ */
.search-form-line,
.actionSearchForm,
.web-menu-top-search {
  border-radius: var(--m-radius);
  border: 1px solid var(--m-border);
  background: #fff;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.search-form-line:focus-within,
.web-menu-top-search:focus-within {
  border-color: var(--m-blue);
  box-shadow: 0 0 0 3px rgba(41,98,255,0.12);
}

/* ============================================================
   3a. CMS-native кнопка избранного — Avito-like.
      Override main.css:1115 (35×35 плотно-белый круг → 32×32 glass).
      Сбрасываем любые потенциальные «расширители» (width/height 100%,
      transform: scale, inset:0).
   ============================================================ */
.container-item-favorite {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  /* explicit reset чтобы ни одно правило не растянуло на 100% */
  left: auto !important;
  bottom: auto !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  padding: 0 !important;
  margin: 0 !important;
  transform: none !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.88) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 5 !important;
  cursor: pointer;
  border: 0;
  box-shadow: none;
  transition: background .15s, box-shadow .15s, transform .15s;
}
.container-item-favorite:hover {
  background: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.container-item-favorite i {
  width: 18px !important;
  height: 18px !important;
  font-size: 18px !important;
  line-height: 1 !important;
  color: #111827 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.container-item-favorite i.ti-heart-filled {
  color: #ff4053 !important;
}

/* ============================================================
   3. КАРТОЧКА — только hover/transition, НЕ трогаем фото-блок
   ============================================================ */
.container-item-grid {
  background: var(--m-card);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  overflow: hidden;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  text-decoration: none;
  color: var(--m-text);
}
.container-item-grid:hover {
  border-color: var(--m-border-h);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(17,24,39,0.08);
  color: var(--m-text);
}

/* Чтобы border-radius применился к фото внутри */
.container-item-grid .container-item-images {
  border-radius: var(--m-radius) var(--m-radius) 0 0;
}

.container-item-grid-content {
  padding: 12px 14px 14px;
}
.container-item-grid-content-prices {
  margin-top: 0;
}
.container-item-grid-content-prices .card-item-price-now {
  font-size: 19px;
  font-weight: 700;
  color: var(--m-text);
}
.container-item-grid-content-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--m-text);
  line-height: 1.35;
  margin: 4px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}
.container-item-grid-content-additionally > span {
  color: var(--m-text2);
  font-size: 12.5px;
}

/* ============================================================
   4. FACE-CARD продавца — strict 28-30px квадрат, не растягивается
   ============================================================ */
.box-user-face-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--m-text2);
}
.box-user-face-card-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  overflow: hidden;
  background: #f3f4f6;
}
.box-user-face-card-avatar > div {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
}
.box-user-face-card-avatar img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  /* убираем translate/position trick из main.css .image-autofocus только тут */
  position: static;
  top: auto;
  left: auto;
  transform: none;
}

/* ============================================================
   5. КАТЕГОРИИ — карточки на главной с hover
   ============================================================ */
.widget-categories-container .home-categories > a,
.widget-categories-container a[class*="category"] {
  background: #fff;
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  padding: 12px 14px;
  text-decoration: none;
  color: var(--m-text);
  transition: background .15s, border-color .15s, transform .15s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.widget-categories-container .home-categories > a:hover,
.widget-categories-container a[class*="category"]:hover {
  background: var(--m-blue-soft);
  border-color: var(--m-blue);
  color: var(--m-blue);
  transform: translateY(-1px);
}

/* ============================================================
   6. ФИЛЬТРЫ (sidebar) — sticky + чистая карточка
   ============================================================ */
.catalog-sidebar {
  background: var(--m-card);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  padding: 18px;
}
@media (min-width: 992px) {
  .catalog-sidebar {
    position: sticky;
    top: 80px;
  }
}
.params-form input,
.params-form select {
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  height: 42px;
  font-size: 14px;
  background: #fff;
}
.params-form input:focus,
.params-form select:focus {
  border-color: var(--m-blue);
  box-shadow: 0 0 0 3px rgba(41,98,255,0.10);
  outline: none;
}
.params-buttons-sticky .btn-custom.button-color-scheme1 {
  background: var(--m-blue);
  border: 0;
  height: 44px;
  border-radius: var(--m-radius-sm);
  font-weight: 600;
  color: #fff;
}
.params-buttons-sticky .btn-custom.button-color-scheme1:hover {
  background: var(--m-blue-h);
}

/* Toolbar над сеткой */
.catalog-container-options {
  background: var(--m-card);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  padding: 14px 18px;
  margin-bottom: 14px;
}

/* ============================================================
   7. ДЕТАЛЬНАЯ — Avito-like layout
   Структура CMS: .container > .row > .col-md-9 (gallery+content)
                                     + .col-lg-3 (sticky sidebar)
   ============================================================ */

/* === LEVEL 3 / ШАГ 3 — Тёмный photo-viewer (правая колонка) === */
.mp-side-viewer {
  background: #090909;
  border-radius: 18px;
  padding: 20px;
  position: sticky;
  top: 88px;
  min-height: 640px;
  color: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
}
.mp-side-viewer-counter {
  position: absolute;
  top: 20px;
  left: 20px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  z-index: 2;
}
.mp-side-viewer-close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: background .15s, transform .15s;
}
.mp-side-viewer-close:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.06);
}

.mp-side-viewer-main {
  position: relative;
  height: 420px;
  margin-top: 50px;
  border-radius: 14px;
  overflow: hidden;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mp-side-viewer-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.mp-side-viewer-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 0;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  transition: background .15s, transform .15s;
}
.mp-side-viewer-arrow:hover {
  background: rgba(255, 255, 255, 0.25);
}
.mp-side-viewer-arrow.left {
  left: 30px;
}
.mp-side-viewer-arrow.right {
  right: 30px;
}

.mp-side-viewer-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 2px 0 6px;
  -webkit-overflow-scrolling: touch;
}
.mp-side-viewer-thumbs::-webkit-scrollbar { height: 4px; }
.mp-side-viewer-thumbs::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 2px; }
.mp-side-viewer-thumb {
  flex: 0 0 auto;
  width: 70px;
  height: 54px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  padding: 0;
  opacity: 0.6;
  transition: opacity .15s, border-color .15s;
}
.mp-side-viewer-thumb:hover { opacity: 0.85; }
.mp-side-viewer-thumb.active {
  border-color: #2563eb;
  opacity: 1;
}
.mp-side-viewer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mp-side-viewer-footer {
  margin-top: 20px;
}
.mp-side-viewer-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mp-side-viewer-price {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

/* === LEVEL 5 — Hero specs (под галереей) === */
.mp-ad-hero-specs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 18px;
}
.mp-hero-item {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mp-hero-item .label {
  font-size: 12px;
  color: #64748b;
}
.mp-hero-item .value {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.2;
}
.mp-hero-item .value.highlight {
  color: #2563eb;
}
@media (max-width: 768px) {
  .mp-ad-hero-specs {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* === LEVEL 3 / ШАГ 13 — Spacing + секционность страницы === */
.mp-ad-main > * + * {
  margin-top: 24px;
}
.mp-ad-main .ad-card-content-item {
  margin-top: 24px !important;
}
.mp-ad-sidebar > * + * {
  margin-top: 18px;
}
.ad-card-user,
.ad-card-buy-now,
.mp-safety-hint,
[class*="safe"] {
  margin-top: 18px !important;
}

@media (max-width: 768px) {
  .mp-ad-main > * + * {
    margin-top: 18px;
  }
  .mp-ad-main .ad-card-content-item {
    margin-top: 18px !important;
  }
  .mp-ad-sidebar > * + * {
    margin-top: 14px;
  }
}

/* === LEVEL 3 / ШАГ 12 — Safe-deal label: normal flow, не absolute === */
.ad-card-buy-now {
  position: relative;
  margin-top: 24px !important;
  padding-top: 0;
}
.ad-card-buy-now > span {
  position: static !important;
  top: auto !important;
  right: auto !important;
  display: inline-flex !important;
  align-items: center;
  margin: 0 0 10px !important;
}
.ad-card-buy-now:hover > span {
  display: inline-flex !important;
}

/* === LEVEL 3 / ШАГ 11 — Vertical rhythm в .mp-ad-main + verification spacing === */
.mp-ad-main > * + * {
  margin-top: 24px;
}

.ad-card-verification,
.profile-verification,
[class*="verification"] {
  margin-top: 24px !important;
  margin-bottom: 24px !important;
}

.mp-gallery + .ad-card-verification,
.mp-gallery + .profile-verification,
.mp-gallery + [class*="verification"] {
  margin-top: 28px !important;
}

@media (max-width: 768px) {
  .mp-ad-main > * + * {
    margin-top: 18px;
  }
  .ad-card-verification,
  .profile-verification,
  [class*="verification"] {
    margin-top: 18px !important;
    margin-bottom: 18px !important;
  }
}

/* === LEVEL 3 / ШАГ 10 — Mobile sticky CTA fix === */
@media (max-width: 768px) {
  .mp-ad-page {
    padding-bottom: 90px;
  }
}

.mp-mobile-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.08);
  z-index: 50;
}
.mp-mobile-cta .btn-buy {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
}

.tooltip,
.safe-deal-tooltip {
  z-index: 60 !important;
}
.safe-deal-tooltip {
  bottom: 80px !important;
}

/* === LEVEL 3 / ШАГ 5 — временно скрыть правый viewer === */
.mp-side-viewer-mount {
  display: none !important;
}
/* Grid возвращается к 2-колоночному (main + sidebar) пока viewer скрыт */
.mp-ad-layout {
  grid-template-columns: minmax(0, 1fr) 340px !important;
}

/* === LEVEL 3 / ШАГ 7 — sidebar sticky fix (header-safe top) === */
/* Защита от родителей с overflow — sticky перестаёт работать если предок имеет overflow:hidden/auto/scroll */
.mp-ad-page,
.mp-ad-layout {
  overflow: visible !important;
}

.mp-ad-sidebar {
  margin-top: 0 !important;
}
.mp-ad-sidebar > * {
  width: 100%;
}

/* ШАГ 3.2.3 HOTFIX-3 — sticky на ВСЕЙ правой карточке, не на её части.
   Внутренний sticky-core отключён: при sticky-частичной блок visually
   перекрывал seller и аватара. Решение: card цельный + статичный поток
   внутри, sticky на родителе .mp-ad-sidebar (grid-item). */
@media (min-width: 992px) {
  .mp-ad-sidebar {
    position: sticky !important;
    top: var(--mp-sticky-top) !important;
    align-self: start !important;
    z-index: 5 !important;
  }
  .mp-sidebar-sticky-core {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
  }
}

@media (max-width: 991px) {
  .mp-ad-sidebar {
    position: static !important;
    top: auto !important;
    margin-top: 20px !important;
  }
  .mp-sidebar-sticky-core {
    position: static;
    top: auto;
    background: transparent;
  }
}

.mp-sidebar-static-tail {
  margin-top: 20px;
}

/* === LEVEL 3 / ШАГ 4 — структура mp-ad-main: header-row + gallery-mount === */
.mp-ad-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
}
.mp-ad-header-text {
  flex: 1 1 auto;
  min-width: 0;
}
.mp-ad-header-text h1 {
  margin-top: 0 !important;
}
.mp-ad-header-actions {
  flex: 0 0 auto;
}
.mp-ad-gallery-mount {
  margin-top: 18px;
}

/* === LEVEL 3 / ШАГ 1 — Grid layout детальной (CSS-only) === */
.mp-ad-page {
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px 24px 48px;
  box-sizing: border-box;
}
.mp-ad-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 320px 520px;
  gap: 24px;
  align-items: start;
  margin-top: 20px;
}
.mp-ad-main {
  min-width: 0;
}
.mp-ad-sidebar {
  min-width: 0;
}
.mp-side-viewer-mount {
  min-width: 0;
}
@media (max-width: 1199px) {
  .mp-ad-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
  .mp-side-viewer-mount {
    display: none;
  }
}
@media (max-width: 991px) {
  .mp-ad-layout {
    display: block;
  }
  .mp-ad-sidebar {
    margin-top: 20px;
  }
}
@media (max-width: 575px) {
  .mp-ad-page {
    padding: 14px 14px 32px;
  }
}

/* === LEVEL 1 — типография и spacing (CSS-only) === */
/* Контентные блоки — белые карточки + увеличенный padding */
.ad-card-content-item,
.ad-card-content {
  background: #ffffff;
  border: 1px solid var(--m-border);
  border-radius: 16px !important;
  padding: 28px !important;
  margin-bottom: 16px;
}
.ad-card-content {
  padding: 0;
  border: 0;
  background: transparent;
}
.ad-card-content > .ad-card-content-item {
  background: #fff;
  border: 1px solid var(--m-border);
  padding: 28px !important;
}
/* Отступы между секциями внутри блоков */
.ad-card-content-item > * + * {
  margin-top: 20px !important;
}
/* Колонки ad-card имеют gap 24 на bootstrap-row — добавляем явно */
.ad-card .row,
.col-md-9 + .col-md-12,
.col-md-9 + .col-lg-3 {
  --bs-gutter-x: 24px;
}
.ad-card-subtitle {
  font-size: 22px !important;
  font-weight: 700 !important;
  color: var(--m-text) !important;
  margin-bottom: 18px !important;
  letter-spacing: -0.01em;
}

/* H1 заголовок объявления — 32px desktop / 22px mobile */
.col-md-9 > h1.font-bold.text-break-word,
h1.font-bold.text-break-word {
  font-size: 32px !important;
  line-height: 1.2 !important;
  font-weight: 600 !important;
  color: var(--m-text) !important;
  margin: 16px 0 8px !important;
  letter-spacing: -0.01em;
}
@media (max-width: 768px) {
  .col-md-9 > h1.font-bold.text-break-word,
  h1.font-bold.text-break-word {
    font-size: 22px !important;
  }
}
.ad-card-info-line {
  color: var(--m-text2) !important;
  font-size: 14px !important;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}
.ad-card-info-line span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* === RIGHT SIDEBAR (price/CTA card) === */
.ad-card-sidebar {
  background: #ffffff !important;
  border: 1px solid var(--m-border) !important;
  border-radius: 16px !important;
  padding: 20px !important;
}

/* ЦЕНА — крупно */
.ad-card-prices,
.ad-card-prices .card-item-price-now {
  margin-top: 0 !important;
}
.ad-card-prices {
  margin-bottom: 16px !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
}
.ad-card-prices .card-item-price-now,
.ad-card-prices > .card-item-price-now,
.card-item-price-now {
  font-size: 32px !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
  color: var(--m-text) !important;
  display: block;
}
@media (max-width: 768px) {
  .ad-card-prices .card-item-price-now,
  .card-item-price-now {
    font-size: 26px !important;
  }
}

/* ОСНОВНАЯ кнопка «Показать телефон» / «Написать» */
.ad-card-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.ad-card-action-buttons .btn-custom,
.ad-card-action-buttons button,
.ad-card-action-buttons a.btn-custom,
.actionViewContacts {
  width: 100% !important;
  height: 48px !important;
  border-radius: 12px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
  transition: background .15s, box-shadow .15s, transform .1s;
  cursor: pointer;
}
.ad-card-action-buttons .btn-custom.button-color-scheme1,
.actionViewContacts {
  background: #2563eb !important;
  color: #ffffff !important;
  border: 0 !important;
}
.ad-card-action-buttons .btn-custom.button-color-scheme1:hover,
.actionViewContacts:hover {
  background: #1d4ed8 !important;
  box-shadow: 0 4px 12px rgba(37,99,235,0.30);
}
.ad-card-action-buttons .btn-custom.button-color-scheme2,
.ad-card-action-buttons .btn-custom.button-color-scheme3 {
  background: #eaf6ff !important;
  color: #0066cc !important;
  border: 0 !important;
}
.ad-card-action-buttons .btn-custom.button-color-scheme2:hover,
.ad-card-action-buttons .btn-custom.button-color-scheme3:hover {
  background: #d8edff !important;
}

/* === SELLER CARD (внизу sidebar) === */
.ad-card-user {
  border-top: 1px solid var(--m-border) !important;
  border-radius: 16px !important;
  padding: 20px !important;
  margin-top: 18px !important;
  display: flex !important;
  gap: 12px;
  align-items: center;
  background: #fff;
}
.ad-card-user-avatar,
.ad-card-user-avatar > div {
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  min-height: 52px !important;
  max-width: 52px !important;
  max-height: 52px !important;
  flex: 0 0 52px;
  border-radius: 50% !important;
  overflow: hidden;
  background: #f3f4f6;
}
.ad-card-user-avatar img,
.ad-card-user-avatar img.image-autofocus {
  width: 52px !important;
  height: 52px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: block !important;
  position: static !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
}
.ad-card-user-content a {
  font-weight: 600;
  color: var(--m-text);
  text-decoration: none;
  font-size: 15px;
}
.ad-card-user-content a:hover { color: var(--m-blue); }
.menu-user-rating-stars {
  margin-top: 4px;
  font-size: 13px;
  color: var(--m-text2);
}

/* === SAFETY HINT === убран по запросу. Стили deprecated (kept commented for rollback).
.ad-safety-hint {
  margin-top: 16px;
  padding: 12px 14px;
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #854d0e;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.ad-safety-hint::before {
  content: "⚠";
  font-size: 16px;
  line-height: 1.2;
  flex: 0 0 auto;
}
*/
/* Defense-in-depth: на случай если safety-hint появится через другой code path */
.ad-safety-hint { display: none !important; }

/* === ХАРАКТЕРИСТИКИ — features grid === */
.ad-card-list-properties {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 28px;
}
.ad-card-list-properties > div,
.ad-card-list-properties .property-item,
.ad-card-list-properties .row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 8px;
  font-size: 14.5px;
}
.ad-card-list-properties > div > span:first-child,
.ad-card-list-properties .property-label {
  color: var(--m-text2);
}
.ad-card-list-properties > div > span:last-child,
.ad-card-list-properties .property-value {
  color: var(--m-text);
  font-weight: 600;
  text-align: right;
}

/* === LOCATION block === */
.ad-card-content-geo-map {
  margin-top: 14px;
  border-radius: 12px;
  overflow: hidden;
  min-height: 260px;
  background: #f3f4f6;
}

/* === REVIEWS tab === */
.ad-card-reviews-content {
  background: #ffffff;
  border: 1px solid var(--m-border);
  border-radius: 16px;
  padding: 24px;
  margin-top: 16px;
}
.my-tabs-items-big .my-tabs-item {
  font-size: 18px;
  font-weight: 700;
  color: var(--m-text);
  padding: 8px 0;
  margin-right: 24px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.my-tabs-items-big .my-tabs-item.active {
  border-bottom-color: var(--m-blue);
  color: var(--m-blue);
}
.my-tabs-items-big .my-tabs-item span {
  background: var(--m-blue-soft);
  color: var(--m-blue);
  border-radius: 999px;
  padding: 2px 10px;
  margin-left: 6px;
  font-size: 13px;
}

/* === RELATED ADS — уже есть .related-ads-block в avito-ux.css === */

/* ============================================================
   8. MOBILE BOTTOM CONTACT BAR (детальная)
   ============================================================ */
.mp-mobile-contact-bar {
  display: none;
}
@media (max-width: 768px) {
  /* Layout: одна колонка */
  body.is-detail .col-lg-3,
  body.is-detail .ad-card-sidebar {
    position: static !important;
    top: auto !important;
  }
  /* Bottom contact bar — fixed под viewport */
  .mp-mobile-contact-bar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #ffffff;
    border-top: 1px solid var(--m-border);
    padding: 10px 12px;
    gap: 10px;
    z-index: 100;
    box-shadow: 0 -2px 12px rgba(17,24,39,0.06);
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
  .mp-mobile-contact-bar button,
  .mp-mobile-contact-bar a {
    flex: 1;
    height: 46px;
    border-radius: 12px;
    border: 0;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
  }
  .mp-mobile-contact-bar .mp-call {
    background: #2563eb;
    color: #fff;
  }
  .mp-mobile-contact-bar .mp-write {
    background: #eaf6ff;
    color: #0066cc;
  }
  /* Не перекрывать контент */
  body.is-detail { padding-bottom: 80px; }

  /* Уменьшить заголовок и цену */
  h1.font-bold.text-break-word { font-size: 22px !important; }
  .ad-card-prices .card-item-price-now { font-size: 26px !important; }
  .ad-card-content-item { padding: 18px !important; }
  .ad-card-list-properties { grid-template-columns: 1fr; }
  .ad-card-subtitle { font-size: 18px !important; }
}

/* ============================================================
   8. BREADCRUMB
   ============================================================ */
.breadcrumb {
  background: transparent;
  padding: 0;
  font-size: 13px;
  color: var(--m-text2);
}
.breadcrumb a { color: var(--m-text2); text-decoration: none; }
.breadcrumb a:hover { color: var(--m-blue); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--m-text3); }

/* ============================================================
   9. ЗАГОЛОВКИ + SPACING СЕКЦИЙ КАТЕГОРИЙ
   На главной CMS не оборачивает секции в .category-section —
   просто иде .bold-title-and-link → .row.row-cols-* → следующий
   .bold-title-and-link → следующий .row...
   Подвешиваем spacing на .bold-title-and-link.
   ============================================================ */
.bold-title-and-link {
  display: flex !important;
  align-items: center;
  gap: 20px;
  margin-top: 48px !important;
  margin-bottom: 24px !important;
  line-height: 1.2;
}
.bold-title-and-link span {
  font-size: 22px;
  font-weight: 700;
  color: var(--m-text);
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.2;
}
/* «Все объявления» — secondary CTA, насыщенный синий + белый текст */
.bold-title-and-link a.btn-custom-mini,
.bold-title-and-link a.btn-custom-mini.button-color-scheme1 {
  margin-left: auto !important;
  background: #2563eb !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 9999px !important;
  padding: 8px 14px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  opacity: 1 !important;
  box-shadow: none;
  transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
}
.bold-title-and-link a.btn-custom-mini:hover,
.bold-title-and-link a.btn-custom-mini.button-color-scheme1:hover {
  background: #1d4ed8 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.30);
}
.bold-title-and-link a.btn-custom-mini:active,
.bold-title-and-link a.btn-custom-mini.button-color-scheme1:active {
  transform: scale(0.97);
}

/* Первый title в widget-контейнере не должен иметь верхний margin —
   там уже есть отступ от секции выше */
.widget-ads-categories-container > .bold-title-and-link:first-child,
.widget-ads-container > .bold-title-and-link:first-child,
.widget-ads-categories-container .home-widget-sections > section:first-child .bold-title-and-link,
.home-widget-sections > section:first-child .bold-title-and-link {
  margin-top: 0 !important;
}

@media (max-width: 768px) {
  .bold-title-and-link {
    margin-top: 36px !important;
    margin-bottom: 18px !important;
    gap: 12px;
    flex-wrap: wrap;
  }
  .bold-title-and-link span {
    font-size: 18px;
  }
  .bold-title-and-link a.btn-custom-mini,
  .bold-title-and-link a.btn-custom-mini.button-color-scheme1 {
    margin-left: auto !important;
    font-size: 13px !important;
    padding: 6px 12px !important;
  }
}

/* Между соседними сетками — обеспечить минимум 24px (доп. защита) */
.row.row-cols-2 + .bold-title-and-link {
  margin-top: 48px !important;
}
@media (max-width: 768px) {
  .row.row-cols-2 + .bold-title-and-link {
    margin-top: 36px !important;
  }
}

/* ============================================================
   10. АДАПТИВ — sidebar в bottom-sheet на мобиле
   ============================================================ */
@media (max-width: 768px) {
  .catalog-sidebar { display: none; }
  .catalog-sidebar.mp-mobile-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 200;
    border-radius: 18px 18px 0 0;
    overflow-y: auto;
    margin: 0;
    padding-bottom: 80px;
    animation: mp-slide-up .25s ease-out;
  }
  @keyframes mp-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
}

/* Floating «Фильтры» FAB на мобиле */
.mp-filter-trigger {
  display: none;
}
@media (max-width: 768px) {
  .mp-filter-trigger {
    display: block;
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--m-blue);
    color: #fff;
    border: 0;
    padding: 12px 26px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 18px rgba(41,98,255,0.35);
    z-index: 30;
    cursor: pointer;
  }
  .container-item-grid-content-prices .card-item-price-now { font-size: 16px; }
  .container-item-grid-content-title { font-size: 13.5px; }
}

/* ============================================================
   11. HEADER + CATALOG MEGA-MENU (override main.css фикс-высот)
   ============================================================ */

/* CSS-переменная высоты шапки — единый источник правды для catalog-menu */
:root {
  --m-header-h: 101px;            /* desktop: -4px */
}
@media (max-width: 768px) {
  :root { --m-header-h: 53px; }
}

/* Top toolbar — компактнее (была 14px padding по умолчанию) */
.header-wow-top {
  padding: 6px 0 !important;
  font-size: 13px;
}
.header-wow-top-list-item {
  margin-right: 20px !important;
  font-size: 13px !important;
}

/* === Inline-SVG logo (replaces <img> в header.tpl) === */
.h-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.h-logo svg {
  display: block;
  height: 32px;
  width: auto;
}

/* Header sticky — высота 70px (было 76+), z-index выше карточек */
.header-wow-sticky {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--m-border);
}
.header-wow-sticky-active {
  z-index: 100;
  box-shadow: 0 1px 3px rgba(17,24,39,0.06);
}
.header-wow-sticky-container {
  padding: 6px 0 !important;     /* -4px к высоте sticky-ряда */
}

/* Header search row — компактный grid */
.header-flex-box {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
}
.header-flex-box-1 {
  flex: 0 0 auto;
}
.header-flex-box-2 {
  flex: 1 1 auto;
  min-width: 0;
}
.header-flex-box-3 {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* «Создать профиль» — outline-blue secondary CTA рядом с «Войти» */
.header-wow-sticky-register {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  background: #fff;
  color: var(--m-blue);
  border: 1px solid var(--m-blue);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.header-wow-sticky-register:hover {
  background: var(--m-blue);
  color: #fff;
}
@media (max-width: 768px) {
  .header-wow-sticky-register {
    height: 34px; padding: 0 10px; font-size: 12.5px;
  }
}

/* «Каталог» button */
.header-button-menu-catalog {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  height: 42px !important;
  padding: 0 16px !important;
  border-radius: 10px !important;
  background: #2563eb !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border: 0 !important;
  cursor: pointer;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.header-button-menu-catalog:hover {
  background: #1d4ed8 !important;
}
.header-button-menu-catalog i {
  font-size: 18px !important;
  color: #ffffff !important;
}
.header-button-menu-catalog span {
  font-size: 14.5px !important;
  color: #ffffff !important;
}

/* === MEGA-MENU контейнер === */
.big-catalog-menu-container {
  position: static !important;        /* убираем relative — fixed-content не зависит от него */
  display: none;
  z-index: 200;
}

/* Контент-панель: ФИКСИРОВАННОЕ позиционирование от viewport
   — гарантирует что dropdown всегда сразу под шапкой,
   независимо от scroll/parent layout */
.big-catalog-menu-content {
  position: fixed !important;
  top: var(--m-header-h) !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: calc(100% - 32px) !important;
  max-width: 1280px !important;
  z-index: 200 !important;
  background: #ffffff !important;
  border: 1px solid var(--m-border) !important;
  border-radius: 16px !important;
  box-shadow: 0 12px 32px rgba(17,24,39,0.12) !important;
  padding: 20px !important;
  height: auto !important;            /* override main.css 450px */
  max-height: calc(100vh - var(--m-header-h) - 24px) !important;
  overflow: hidden !important;        /* внутренние колонки скроллят сами */
}

/* Левая колонка категорий — авто-высота, скролл внутри */
.big-catalog-menu-content-categories {
  height: auto !important;            /* override 400px */
  max-height: calc(100vh - var(--m-header-h) - 80px) !important;
  overflow-y: auto !important;
  padding-right: 6px;
}

/* Правая колонка подкатегорий */
.big-catalog-menu-content-subcategories {
  height: auto !important;            /* override 400px */
  max-height: calc(100vh - var(--m-header-h) - 80px) !important;
  overflow-y: auto !important;
  padding-left: 8px;
  border-left: 1px solid var(--m-border);
}
.big-catalog-menu-content-subcategories h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--m-text);
  margin: 0 0 14px;
  padding-left: 12px;
}
.big-catalog-menu-content-subcategories a {
  color: var(--m-text2);
  text-decoration: none;
  font-size: 13.5px;
  padding: 4px 0;
  display: block;
  transition: color .12s;
}
.big-catalog-menu-content-subcategories a:hover {
  color: var(--m-blue);
}

.big-catalog-menu-category-item {
  padding: 8px 12px !important;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
}
.big-catalog-menu-category-item:hover,
.big-catalog-menu-category-item.active {
  background: var(--m-blue-soft) !important;
  color: var(--m-blue) !important;
}
.big-catalog-menu-category-item > div {
  width: 24px !important;
  height: 24px !important;
}

/* === АДАПТИВ — header + catalog === */
@media (max-width: 1199px) {
  .header-button-menu-catalog { padding: 0 12px; height: 40px; }
  .header-button-menu-catalog span { font-size: 13.5px; }
  .header-wow-sticky-add { padding: 0 14px !important; }
}

@media (max-width: 991px) {
  /* Mega-menu: в одну колонку */
  .big-catalog-menu-content .row { flex-direction: column; }
  .big-catalog-menu-content .col-md-3,
  .big-catalog-menu-content .col-md-6 {
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
  }
  .big-catalog-menu-content-subcategories {
    border-left: 0;
    border-top: 1px solid var(--m-border);
    padding-left: 0;
    padding-top: 14px;
    margin-top: 14px;
  }
}

@media (max-width: 768px) {
  /* Mega-menu — full-screen на мобиле */
  .big-catalog-menu-content {
    position: fixed !important;
    top: var(--m-header-h) !important;
    bottom: 0 !important;
    left: 0 !important; right: 0 !important;
    width: 100% !important;
    max-width: none !important;
    transform: none !important;
    border-radius: 0 !important;
    max-height: none !important;
    height: calc(100vh - var(--m-header-h)) !important;
    overflow-y: auto !important;
  }
  .big-catalog-menu-content-categories,
  .big-catalog-menu-content-subcategories {
    max-height: none !important;
    overflow-y: visible !important;
  }
  .header-button-menu-catalog span { display: inline; }
}

/* ============================================================
   13. MOBILE — горизонтальный swipe-scroll по категориям
       На мобиле каждая секция .row.row-cols-* превращается
       в горизонтальный flex-strip с touch-snap.
   ============================================================ */
@media (max-width: 768px) {
  .home-widget-sections .row.row-cols-2,
  .widget-ads-categories-container .row.row-cols-2,
  .widget-ads-vip-container .row.row-cols-2,
  .widget-ads-container .row.row-cols-2,
  .home-ads-list.row {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
    /* padding-inline = (100% - card%) / 2 чтобы первая/последняя
       карточки центрировались при snap. Card 78% → side gap 11% */
    padding: 0 11% 6px;
    margin: 0 -14px;             /* edge-to-edge wrap */
    scroll-padding-inline: 11%;
    scrollbar-width: none;
  }
  .home-widget-sections .row.row-cols-2::-webkit-scrollbar,
  .widget-ads-categories-container .row.row-cols-2::-webkit-scrollbar,
  .widget-ads-container .row.row-cols-2::-webkit-scrollbar,
  .home-ads-list.row::-webkit-scrollbar { display: none; }

  /* Карточка 78% ширины, snap по ЦЕНТРУ */
  .home-widget-sections .row.row-cols-2 > .col,
  .widget-ads-categories-container .row.row-cols-2 > .col,
  .widget-ads-vip-container .row.row-cols-2 > .col,
  .widget-ads-container .row.row-cols-2 > .col,
  .home-ads-list.row > .col {
    flex: 0 0 78% !important;
    max-width: 78% !important;
    scroll-snap-align: center;   /* было start → теперь center */
    scroll-snap-stop: always;    /* останавливаться на каждой карточке */
    padding: 0 !important;
  }

  /* Заголовок секции остаётся обычным */
  .bold-title-and-link {
    padding: 0 14px;
    margin-top: 28px !important;
    margin-bottom: 14px !important;
  }
  .bold-title-and-link span { font-size: 17px; }

  /* Категории-плитки — тоже горизонтальный strip (если есть) */
  .widget-categories-container .row,
  .widget-categories-container .home-categories {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 10px;
    padding: 4px 14px 6px;
    margin: 0 -14px;
    scrollbar-width: none;
  }
  .widget-categories-container .row::-webkit-scrollbar,
  .widget-categories-container .home-categories::-webkit-scrollbar { display: none; }
  .widget-categories-container .row > * {
    flex: 0 0 auto;
    width: auto !important;
    max-width: none !important;
  }

  /* Stories — те же правила */
  .widget-stories-container .swiper-wrapper {
    padding-bottom: 6px;
  }
}

/* ============================================================
   14. MOBILE — bottom navigation bar
   ============================================================ */
.mp-mobile-nav {
  display: none;
}
@media (max-width: 768px) {
  .mp-mobile-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #ffffff;
    border-top: 1px solid var(--m-border);
    box-shadow: 0 -2px 12px rgba(17,24,39,0.06);
    padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
    z-index: 90;
    align-items: stretch;
  }
  .mp-mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 0;
    text-decoration: none;
    color: var(--m-text2);
    font-size: 11px;
    font-weight: 500;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color .15s;
  }
  .mp-mobile-nav-item.active,
  .mp-mobile-nav-item:active {
    color: var(--m-blue);
  }
  .mp-mobile-nav-item .ti {
    font-size: 22px;
    line-height: 1;
  }
  .mp-mobile-nav-item-create {
    color: #fff !important;
    background: var(--m-blue) !important;
    border-radius: 16px;
    margin: 4px 6px;
    padding: 6px 0 !important;
  }
  .mp-mobile-nav-item-create .ti { font-size: 24px; }
  .mp-mobile-nav-item-create span { font-size: 11px; font-weight: 600; }

  /* Пушим body чтобы bottom-nav не перекрывал контент */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)) !important; }

  /* Mobile contact bar (детальная) — поднимаем над nav */
  .mp-mobile-contact-bar {
    bottom: calc(64px + env(safe-area-inset-bottom)) !important;
    box-shadow: 0 -2px 12px rgba(17,24,39,0.06);
  }
}

/* ============================================================
   15. MOBILE — компактный header (logo + меню только)
   ============================================================ */
@media (max-width: 768px) {
  /* Скрываем top toolbar (Главная/Магазины/...) на мобиле */
  .header-wow-top { display: none !important; }
  /* «Разместить объявление» из шапки — убираем, есть в bottom nav */
  .header-wow-sticky-add { display: none !important; }
  /* «Войти» — компактнее */
  .header-wow-sticky-auth {
    padding: 0 10px !important;
    height: 36px;
    font-size: 13px;
  }
  /* Каталог-кнопка остаётся */
  .header-button-menu-catalog {
    height: 36px;
    padding: 0 10px;
    font-size: 13px;
  }
  /* Search — ширина растягивается */
  .header-flex-box-2 .live-search-form-input {
    height: 38px !important;
    font-size: 14px !important;
  }
}

/* ============================================================
   AD-CREATE FORM — финальные overrides поверх всего стека.
   Дублируем здесь чтобы любые legacy-стили не перебили.
   ============================================================ */
.form-ad-create .ad-create-options-container-item,
.ad-create-content-container .ad-create-options-container-item {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 16px !important;
  padding: 24px !important;
  margin-bottom: 24px !important;
}
.form-ad-create .ad-create-options-container-item-title,
.ad-create-content-container .ad-create-options-container-item-title {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #111827 !important;
  margin: 0 0 6px !important;
}
/* Helper-подпись под заголовком — добавляется JS-ом */
.ad-create-section-helper {
  font-size: 13.5px;
  color: #6b7280;
  margin: 0 0 14px;
  line-height: 1.45;
}

/* TEXTAREA — самый сильный override */
.form-ad-create textarea,
.form-ad-create .form-control-textarea,
.ad-create-options-container-item textarea,
textarea[name="text"],
textarea.form-control-textarea {
  width: 100% !important;
  min-height: 180px !important;
  padding: 16px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  color: #111827 !important;
  font-size: 16px !important;
  line-height: 1.5 !important;
  resize: vertical !important;
  outline: none !important;
  box-sizing: border-box !important;
  display: block !important;
  font-family: inherit !important;
  box-shadow: none !important;
}
.form-ad-create textarea::placeholder,
.form-ad-create .form-control-textarea::placeholder,
.ad-create-options-container-item textarea::placeholder,
textarea[name="text"]::placeholder {
  color: #9ca3af !important;
  opacity: 1 !important;
}
.form-ad-create textarea:focus,
.form-ad-create .form-control-textarea:focus,
.ad-create-options-container-item textarea:focus,
textarea[name="text"]:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
  background: #fff !important;
}

/* ============================================================
   16. SCROLLBAR
   ============================================================ */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* TRUST BLOCK — sidebar-meta под CTA, увеличивает доверие/конверсию.
   Stub-данные (статика) до подключения динамики. */
.mp-trust-block {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}
.mp-trust-block > div {
  font-size: 14px;
  color: #374151;
  margin-bottom: 6px;
}
.mp-trust-block > div:last-child {
  margin-bottom: 0;
}

/* DETAIL POLISH — safe typography/spacing pass */
@media (min-width: 992px) {
  .ad-card h1,
  .ad-card-title,
  .ad-card-content h1 {
    font-size: 32px !important;
    line-height: 1.18 !important;
    letter-spacing: -0.02em !important;
  }

  .ad-card-content-item {
    padding: 28px !important;
  }

  .ad-card-content-item + .ad-card-content-item {
    margin-top: 20px !important;
  }
}

@media (max-width: 991px) {
  .ad-card-content-item {
    padding: 20px !important;
  }

  .ad-card-content-item + .ad-card-content-item {
    margin-top: 16px !important;
  }
}

/* FOMO BLOCK — социальные сигналы (просмотры / активность) */
.mp-fomo-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}
.mp-fomo-block div {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 5px;
}
.mp-fomo-block div:last-child {
  margin-bottom: 0;
}

/* ACTION ROW — favorite / share / report под ценой */
.mp-action-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.mp-action-btn {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f3f4f6;
  color: #374151;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.mp-action-btn:hover {
  background: #e5e7eb;
}
.mp-action-btn.danger {
  color: #dc2626;
  background: #fef2f2;
}
.mp-action-btn.danger:hover {
  background: #fee2e2;
}

/* === SIDEBAR COMPACT (seller modal pattern) === */
.mp-action-row-compact {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.mp-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: #f3f4f6;
  color: #374151;
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s ease;
}
.mp-action-icon:hover {
  background: #e5e7eb;
}
.mp-action-icon.danger {
  color: #dc2626;
  background: #fef2f2;
}
.mp-action-icon.danger:hover {
  background: #fee2e2;
}

/* COMPACT TRUST — verified badge стиль */
.mp-trust-compact > div {
  font-size: 13px;
  line-height: 1.35;
  color: #16a34a;
  font-weight: 500;
}

/* SELLER MORE BUTTON */
.mp-seller-more-btn {
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #2563eb;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.mp-seller-more-btn:hover {
  text-decoration: underline;
}

/* SELLER MODAL */
.mp-seller-modal[hidden] {
  display: none !important;
}
.mp-seller-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
}
.mp-seller-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.mp-seller-modal-dialog {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  margin: 10vh auto 0;
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}
.mp-seller-modal-dialog h3 {
  margin: 0 0 16px;
  font-size: 20px;
  line-height: 1.2;
  color: #111827;
}
.mp-seller-modal-close {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: #f3f4f6;
  color: #111827;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.mp-seller-modal-list {
  display: grid;
  gap: 10px;
}
.mp-seller-modal-list > div {
  font-size: 15px;
  color: #374151;
  line-height: 1.4;
}
@media (max-width: 768px) {
  .mp-seller-modal-dialog {
    margin: 0;
    width: 100%;
    max-width: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 18px 18px 0 0;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }
}

/* === SELLER MODAL UPGRADE — mini-profile (header / stats grid / details / CTA) === */
.mp-modal-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 16px;
  color: #111827;
  line-height: 1.2;
}
.mp-seller-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.mp-seller-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #e5e7eb;
  flex: 0 0 44px;
  overflow: hidden;
}
.mp-seller-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 999px;
}
.mp-seller-name {
  font-weight: 600;
  font-size: 15px;
  color: #111827;
  line-height: 1.3;
}
.mp-seller-rating {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
}
.mp-seller-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.mp-seller-stats > div {
  background: #f9fafb;
  padding: 12px;
  border-radius: 12px;
  text-align: center;
}
.mp-seller-stats strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}
.mp-seller-stats span {
  font-size: 12px;
  color: #6b7280;
}
.mp-seller-details {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: #374151;
  margin-bottom: 20px;
}
.mp-seller-actions {
  margin-top: 10px;
}
.mp-seller-actions .btn-primary {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  background: #2563eb;
  color: #fff;
  border: none;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s ease;
}
.mp-seller-actions .btn-primary:hover {
  background: #1d4ed8;
}

/* FIX seller modal position under sticky header (override).
   Top-aligned (не center): vertical center конфликтовал с весом
   sticky header — модалка визуально «уходила» под него. */
.mp-seller-modal {
  display: flex;
  align-items: flex-start;          /* было: center */
  justify-content: center;
  padding: 100px 16px 32px;         /* было: 96px — чуть больше воздуха */
  box-sizing: border-box;
}
.mp-seller-modal[hidden] {
  display: none !important;
}
.mp-seller-modal-dialog {
  margin: 0 auto !important;
  margin-top: 0 !important;         /* override v2 margin: 10vh auto 0 */
  max-height: calc(100vh - 132px);  /* учёт padding-top + bottom */
  overflow-y: auto;
}

@media (max-width: 768px) {
  .mp-seller-modal {
    display: block;
    padding: 0;
  }
  .mp-seller-modal[hidden] {
    display: none !important;
  }
  .mp-seller-modal-dialog {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }
}

/* FIX: seller modal — top-anchored через margin-offset dialog (production pattern).
   Padding-хак заменён на margin: 120px auto 0 — predictable layout как у Avito/Kaspi. */
@media (min-width: 769px) {
  .mp-seller-modal {
    display: flex;
    align-items: flex-start !important;
    justify-content: center;
    padding: 0 !important;
  }
  .mp-seller-modal-dialog {
    margin: 120px auto 0 !important;
    max-height: calc(100vh - 140px) !important;
    overflow-y: auto !important;
  }
}

/* FIX: favorite counter badge — всегда видим при наличии содержимого. */
.header-wow-top-list-icon-item {
  position: relative !important;
}
.labelFavCount {
  position: absolute !important;
  top: -5px !important;
  right: -6px !important;
  min-width: 18px !important;
  height: 18px !important;
  padding: 0 6px !important;
  background: #ef4444 !important;
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 18px !important;
  border-radius: 999px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  z-index: 20 !important;
}
/* Empty state — скрыть пустой badge (когда avito_favs пуст). */
.labelFavCount:empty {
  display: none !important;
}

/* === P1 UX upgrades — CTA / urgency / seller-meta / modal anim / mobile cleanup === */

/* 1. CTA усиление: «Написать» доминирует, обе кнопки крупнее */
.ad-card-action-buttons .btn-custom {
  height: 52px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  transition: all .2s ease;
}
.ad-card-action-buttons .btn-custom.button-color-scheme1 {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25) !important;
  color: #fff !important;
}
.ad-card-action-buttons .btn-custom.button-color-scheme1:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.35) !important;
}

/* 2. Action-icons row перенесён под кнопки CTA (HTML moved); spacing */
.mp-sidebar-sticky-core .mp-action-row-compact {
  margin-top: 12px;
}

/* 3. Urgency line — психологический триггер под ценой */
.mp-urgency {
  font-size: 13px;
  color: #dc2626;
  margin-top: 8px;
  font-weight: 500;
}

/* 4. Seller meta — «На сайте с 2023» дешёвый trust-сигнал */
.mp-seller-meta {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

/* 5. Modal animation — fade + slight slide-down при открытии */
@keyframes mp-modal-overlay-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes mp-modal-dialog-slide-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mp-seller-modal:not([hidden]) {
  animation: mp-modal-overlay-fade-in .2s ease;
}
.mp-seller-modal:not([hidden]) .mp-seller-modal-dialog {
  animation: mp-modal-dialog-slide-in .22s ease;
}

/* 6. Mobile cleanup: убираем дубль CTA — на mobile есть .mp-mobile-contact-bar */
@media (max-width: 768px) {
  .ad-card-action-buttons {
    display: none !important;
  }
}

/* P2 conversion — hint под CTA: снижает страх писать («expectation ответа») */
.mp-cta-hint {
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
  text-align: center;
}
@media (max-width: 768px) {
  .mp-cta-hint { display: none; }      /* на mobile CTA скрыт — hint не нужен */
}

/* P3 conversion — social proof + chat-trigger micro-feedback */
.mp-social-proof {
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
}
.mp-chat-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  z-index: 10080;
  animation: mp-chat-hint-fade .3s ease;
  pointer-events: none;
}
@keyframes mp-chat-hint-fade {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* P5 — fake typing indicator внутри chat-модалки */
.mp-typing {
  position: absolute;
  bottom: 70px;
  left: 24px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  z-index: 10090;
  pointer-events: none;
  animation: mp-typing-pulse 1.2s ease-in-out infinite;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
@keyframes mp-typing-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* === P6.1 — Contact Gate (soft-paywall перед чатом) === */
.mp-gate {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mp-gate-fade .2s ease;
}
@keyframes mp-gate-fade { from { opacity: 0; } to { opacity: 1; } }
.mp-gate-box {
  position: relative;
  background: #fff;
  border-radius: 18px;
  padding: 28px 24px 24px;
  width: min(340px, calc(100vw - 32px));
  text-align: center;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.32);
  animation: mp-gate-slide .25s ease;
}
@keyframes mp-gate-slide {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.mp-gate-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 30px; height: 30px;
  border: 0; border-radius: 999px;
  background: #f3f4f6;
  color: #111827;
  font-size: 20px; line-height: 1;
  cursor: pointer;
}
.mp-gate-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #111827;
}
.mp-gate-sub {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 18px;
  line-height: 1.4;
}
.mp-gate-chat,
.mp-gate-phone {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  border: 0;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.mp-gate-chat {
  background: #f3f4f6;
  color: #111827;
  margin-bottom: 8px;
}
.mp-gate-chat:hover { background: #e5e7eb; }
.mp-gate-phone {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
}
.mp-gate-phone:hover { transform: translateY(-1px); }
.mp-gate-phone:active { transform: translateY(0); }
@media (max-width: 768px) {
  .mp-gate-box {
    border-radius: 18px 18px 0 0;
    width: 100%;
    margin-top: auto;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  .mp-gate {
    align-items: flex-end;
  }
}
