/* ============================================
   SWELA — Card CSS (Listing pages)
   Overlay cards, auto-fill grid, pill style
   ============================================ */

/* --- Page Header --- */
.sw-page-header {
  margin-bottom: 10px;
}
.sw-page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--sw-text);
  line-height: 1.3;
}

/* --- Location Info --- */
.sw-location-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  margin-bottom: 12px;
  background: var(--sw-primary-light);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sw-text);
}
.sw-location-info svg {
  width: 14px;
  height: 14px;
  color: var(--sw-primary);
  flex-shrink: 0;
}

/* --- Cards Count --- */
.sw-cards-count {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--sw-muted);
  margin-bottom: 14px;
}
.sw-cards-count svg { width: 15px; height: 15px; }

/* --- Filters Bar (L-SIDE-3: горизонтальная панель) --- */
.sw-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--sw-surface);
  border: 1px solid var(--sw-border);
  border-radius: 24px;
  box-shadow: 0 2px 8px rgba(219,39,119,0.06);
}
.sw-filter-group {
  position: relative;
}
.sw-filter-group__toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: var(--sw-bg);
  border: 1px solid var(--sw-border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sw-text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.sw-filter-group__toggle:hover {
  background: var(--sw-primary-light);
  border-color: var(--sw-primary);
  color: var(--sw-primary);
}
.sw-filter-group__toggle svg {
  width: 13px;
  height: 13px;
  color: var(--sw-muted);
  transition: transform 0.2s;
}
.sw-filter-group.is-expanded .sw-filter-group__toggle svg {
  transform: rotate(180deg);
}
.sw-filter-group__items {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  max-width: 260px;
  background: var(--sw-surface);
  border: 1px solid var(--sw-border);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(219,39,119,0.12);
  padding: 8px;
  z-index: 100;
  flex-wrap: wrap;
  gap: 4px;
}
.sw-filter-group.is-expanded .sw-filter-group__items {
  display: flex;
}
.sw-filter-group__link {
  display: inline-block;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--sw-body);
  background: var(--sw-bg);
  border-radius: 999px;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.sw-filter-group__link:hover {
  background: var(--sw-primary-light);
  color: var(--sw-primary);
}

/* --- Listing Grid (L-LAYOUT-7: auto-fill) --- */
.sw-listing__cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* --- Card (L-ORIENT-5: overlay) --- */
.sw-card {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background: var(--sw-surface);
  box-shadow: 0 4px 16px rgba(219,39,119,0.12);
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
}
.sw-card:hover {
  box-shadow: 0 8px 28px rgba(219,39,119,0.22);
  transform: translateY(-2px);
}

/* Невидимая ссылка на весь блок */
.sw-card__link {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* --- Фото-обёртка --- */
.sw-card__photo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--sw-bg);
}
.sw-card__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.3s;
  display: block;
}
.sw-card:hover .sw-card__photo {
  transform: scale(1.04);
}
.sw-card__photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--sw-border);
}
.sw-card__photo-placeholder svg { width: 40px; height: 40px; }

/* --- Градиентный оверлей снизу --- */
.sw-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 35%,
    rgba(0, 0, 0, 0.15) 55%,
    rgba(0, 0, 0, 0.72) 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* --- Цена: pill снизу-слева (L-PRICE-1) --- */
.sw-card__price-pill {
  position: absolute;
  bottom: 110px;
  left: 12px;
  padding: 4px 12px;
  background: var(--sw-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(219,39,119,0.35);
  pointer-events: none;
}

/* --- Сердце (избранное): справа-сверху (L-ACT-2) --- */
.sw-card__fav {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: none;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sw-card__fav:hover {
  background: rgba(219,39,119,0.85);
  color: #fff;
}
.sw-card__fav.is-active {
  background: var(--sw-primary);
  color: #fff;
}
.sw-card__fav svg { width: 18px; height: 18px; }

/* --- Текстовый блок поверх фото --- */
.sw-card__body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 14px 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* --- Имя --- */
.sw-card__name-link {
  display: block;
  z-index: 3;
  position: relative;
}
.sw-card__name {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Inline параметры (L-PARAMS-3) --- */
.sw-card__params-inline {
  font-size: 12px;
  color: rgba(255,255,255,0.88);
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* --- Локация --- */
.sw-card__location {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: rgba(255,255,255,0.75);
}
.sw-card__location svg { width: 11px; height: 11px; flex-shrink: 0; }
.sw-card__location-link {
  color: rgba(255,255,255,0.85);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sw-card__location-link:hover { color: #fff; }

/* --- CTA-строка (кнопка телефона + мессенджеры) --- */
.sw-card__cta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

/* --- Кнопка телефона (L-CTA-2) — СВОЙ класс, не наследует sw-btn--primary --- */
.sw-card__phone-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--sw-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  z-index: 3;
  position: relative;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(219,39,119,0.35);
}
.sw-card__phone-btn:hover { background: var(--sw-primary-hover); }
.sw-card__phone-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
/* CSS-страховка от автолинковки браузером */
.sw-card__phone-btn a { color: #fff; }

/* --- Маскированный номер --- */
.sw-card__phone-masked {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: 0.3px;
}

/* --- Кнопка "Подробнее" --- */
.sw-card__detail-btn {
  display: inline-flex;
  align-items: center;
  padding: 7px 18px;
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(4px);
  transition: background 0.15s;
  position: relative;
  z-index: 3;
}
.sw-card__detail-btn:hover { background: rgba(255,255,255,0.32); }

/* --- Мессенджеры --- */
.sw-card__messengers {
  display: flex;
  gap: 5px;
  position: relative;
  z-index: 3;
}
.sw-card__messenger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(4px);
  color: #fff;
  transition: background 0.15s;
  cursor: default;
}
.sw-card__messenger--tg:hover { background: #2AABEE; }
.sw-card__messenger--wa:hover { background: #25D366; }
.sw-card__messenger--vb:hover { background: #7360F2; }

/* --- Пагинация (L-PAGE-1: нумерованная) --- */
.sw-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 28px 0 20px;
  flex-wrap: wrap;
}
.sw-pagination__item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--sw-body);
  background: var(--sw-surface);
  border: 1px solid var(--sw-border);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  box-shadow: 0 1px 4px rgba(219,39,119,0.06);
}
.sw-pagination__item:hover {
  border-color: var(--sw-primary);
  background: var(--sw-primary-light);
  color: var(--sw-primary);
}
.sw-pagination__item--active {
  background: var(--sw-primary);
  color: #fff;
  border-color: var(--sw-primary);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(219,39,119,0.3);
}
.sw-pagination__item--prev svg,
.sw-pagination__item--next svg { width: 16px; height: 16px; }
.sw-pagination__dots {
  padding: 0 4px;
  color: var(--sw-muted);
  font-size: 16px;
  line-height: 38px;
}

/* --- SEO Blocks --- */
.sw-seo-blocks {
  margin-top: 28px;
  padding: 20px 24px;
  background: var(--sw-surface);
  border-radius: 24px;
  border: 1px solid var(--sw-border);
}
.sw-seo-block--h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--sw-text);
  margin: 20px 0 8px;
}
.sw-seo-block--h2:first-child { margin-top: 0; }
.sw-seo-block--text {
  font-size: 14px;
  color: var(--sw-body);
  line-height: 1.65;
  margin-bottom: 8px;
}

/* --- Mobile < 480px: строго 1 колонка --- */
@media (max-width: 480px) {
  .sw-listing__cards {
    grid-template-columns: 1fr;
  }
  .sw-filters-bar {
    padding: 10px 12px;
    border-radius: 16px;
    gap: 6px;
  }
  .sw-filter-group__items {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 20px;
    top: auto;
    max-width: none;
    border-radius: 20px;
    z-index: 200;
  }
  .sw-card__price-pill { bottom: 104px; }
}

/* --- Tablet 480px+ --- */
@media (min-width: 480px) {
  .sw-listing__cards {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
  .sw-page-title { font-size: 26px; }
}

/* --- Desktop 768px+ --- */
@media (min-width: 768px) {
  .sw-listing__cards {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
  }
  .sw-page-title { font-size: 30px; }
  .sw-card__name { font-size: 18px; }
  .sw-card__price-pill { bottom: 116px; }
}

/* --- Desktop 1200px+ --- */
@media (min-width: 1200px) {
  .sw-listing__cards {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}
