/*
Theme Name: Discounter
Theme URI: https://github.com/alexeev-vn/discounter
Author: Алексеев В.Н.
Author URI: mailto:alexeev_vn@mail.ru
Description: Современная тема для доски объявлений. Адаптивный дизайн для десктопа, планшетов и мобильных устройств.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: discounter
Tags: custom-background, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, blog, one-column, two-columns, right-sidebar, flexible-header, full-width-template, sticky-post, theme-options

Discounter — тема доски объявлений. Автор: Алексеев В.Н. (alexeev_vn@mail.ru)
*/

/* Шрифт Inter подключается в functions.php (discounter-fonts). */

/* ==========================================================================
   CSS Variables — оформление в стиле Obyava (obyava.org)
   ========================================================================== */
:root {
  /* Основной акцент — зелёный (кнопки «Разместить», ссылки, CTA) */
  --color-primary: #00a650;
  --color-primary-hover: #008f47;
  --color-primary-light: #e6f7ef;
  /* Дополнительный акцент */
  --color-accent: #ff9800;
  --color-accent-hover: #e68900;
  /* Фоны */
  --color-bg: #f5f5f5;
  --color-bg-card: #ffffff;
  /* Текст */
  --color-text: #222222;
  --color-text-muted: #666666;
  --color-border: #e0e0e0;
  /* Семантика */
  --color-success: #00a650;
  --color-danger: #e53935;
  /* Шрифты как на Obyava */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, monospace;
  /* Размеры шрифтов */
  --font-size-base: 15px;
  --font-size-sm: 13px;
  --font-size-lg: 17px;
  --font-size-title: 20px;
  /* Тени и скругления */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
  --radius: 6px;
  --radius-lg: 8px;
  --header-height: 96px;
  --container-max: 1200px;
  --transition: 0.2s ease;
  /* Верхняя плашка шапки — тёмная */
  --header-bar-bg: #1c1c1e;
  --header-bar-text: #e5e5e7;
  --header-bar-text-muted: #98989d;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: var(--font-size-base);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary-hover);
}

/* ==========================================================================
   Layout
   ========================================================================== */
.site-container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1rem;
}

.content-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1rem;
}

.site-main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 0 2rem;
}

.site-container--main {
  padding-left: 0;
  padding-right: 0;
}

#secondary.widget-area {
  width: 280px;
  flex-shrink: 0;
  padding: 1.5rem 0 2rem;
}

/* ==========================================================================
   Header — одна строка: иконки, «Мои объявления», профиль, кнопка
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

/* Ширина контейнера шапки как на Авито */
.site-header .site-container {
  max-width: 1280px;
}

/* Верхняя плашка — тёмная, в стиле Obyava */
.header-bar {
  background: var(--header-bar-bg);
  color: var(--header-bar-text);
  overflow: visible;
  min-height: 40px;
}

.header-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 1rem;
  gap: 0;
  flex-wrap: nowrap;
  overflow: visible;
}

/* Переключатель Розница — [пилюля] — Опт */
.header-bar__switcher {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
}

.header-bar__switcher-label {
  font-size: var(--font-size-sm);
  color: var(--header-bar-text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.header-bar__switcher-label:hover {
  color: var(--header-bar-text);
}

/* Пилюля: белый трек, круглый бегунок */
.header-bar__toggle {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.header-bar__toggle-track {
  display: flex;
  align-items: center;
  width: 44px;
  height: 24px;
  padding: 2px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.header-bar__toggle:hover .header-bar__toggle-track {
  border-color: #999;
}

.header-bar__toggle-thumb {
  display: block;
  width: 18px;
  height: 18px;
  background: #999;
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}

/* Состояние Опт: зелёная обводка и бегунок (Obyava-style) */
.header-bar__toggle.is-opt .header-bar__toggle-track {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.header-bar__toggle.is-opt .header-bar__toggle-thumb {
  transform: translateX(22px);
  background: var(--color-primary);
}

.header-bar__toggle.is-opt:hover .header-bar__toggle-track {
  border-color: var(--color-primary-hover);
}

.header-bar__toggle.is-opt:hover .header-bar__toggle-thumb {
  background: var(--color-primary-hover);
}

/* Закладка (слово со ссылкой) в черной полоске */
.header-bar__promo {
  flex-shrink: 0;
  margin-right: 12px;
  font-size: var(--font-size-sm);
  line-height: 40px;
}

.header-bar__promo-link {
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.header-bar__promo-link:hover {
  text-decoration: underline;
}

.header-bar__promo-text {
  white-space: nowrap;
}

/* Правая группа: иконки | «Мои объявления» | профиль | кнопка (как на Авито) */
.header-bar__right {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: visible;
}

/* Иконки в плашке */
.header-bar__icons {
  display: flex;
  align-items: center;
  gap: 0;
}

.header-bar__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 0;
  color: var(--header-bar-text-muted);
  transition: color var(--transition), background var(--transition);
}

.header-bar__icon:hover {
  color: var(--header-bar-text);
  background: rgba(255, 255, 255, 0.08);
}

.header-bar__icon-svg {
  display: inline-flex;
  line-height: 0;
}

.header-bar__icon--badge {
  position: relative;
}

.header-bar__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  color: #fff;
  background: var(--color-danger);
  border-radius: 9px;
}

/* «Мои объявления» и профиль в одну линию, разделитель как на Авито */
.header-bar__user {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
  flex-shrink: 0;
  margin-left: 4px;
}

.header-bar__user::before {
  content: '';
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.2);
  margin-right: 12px;
}

.header-bar__link {
  font-size: var(--font-size-sm);
  line-height: 40px;
  padding: 0 8px;
  text-decoration: none;
  white-space: nowrap;
  color: var(--header-bar-text-muted);
}

.header-bar__link:hover {
  color: var(--header-bar-text);
  text-decoration: underline;
}

.header-bar__user .header-bar__profile {
  margin-left: 4px;
}

/* Профиль: аватар + имя + выпадающее меню */
.header-bar__profile {
  position: relative;
}

.header-bar__profile-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  height: 40px;
  background: transparent !important;
  border: none;
  border-radius: 0;
  font-size: var(--font-size-sm);
  cursor: pointer;
  color: inherit;
  transition: background var(--transition);
}

.header-bar__profile-trigger:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--header-bar-text);
}

.header-bar__avatar {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.2);
}

.header-bar__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.header-bar__name {
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--header-bar-text-muted);
}

.header-bar__chevron {
  display: inline-flex;
  transition: transform var(--transition);
}

.header-bar__profile.is-open .header-bar__chevron {
  transform: rotate(180deg);
}

.header-bar__dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 180px;
  padding: 0.5rem 0;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.header-bar__dropdown[hidden] {
  display: none;
}

.header-bar__dropdown a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--color-text);
  text-decoration: none;
}

.header-bar__dropdown a:hover {
  background: var(--color-bg);
  color: var(--color-primary);
}

/* Кнопка «Разместить объявление» — зелёная (Obyava-style) */
.header-bar__cta {
  flex-shrink: 0;
  margin-left: 8px;
  position: relative;
}

.header-bar__cta::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.2);
}

.header-bar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 18px;
  color: #fff;
  font-size: var(--font-size-sm);
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  background: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), filter var(--transition);
}

.header-bar__btn:hover {
  color: #fff;
  background: var(--color-primary-hover);
}

/* Вторая строка шапки (Под меню) */
.header-second {
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
}

.header-second__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 56px;
  padding: 0.5rem 0;
  flex-wrap: nowrap;
}

.header-second__logo {
  flex-shrink: 0;
}

.header-second__logo-link {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}

.header-second__logo-link:hover {
  color: var(--color-primary);
}

/* «Все категории» — текстовая ссылка как на Авито */
.header-second__categories {
  display: inline-flex;
  align-items: center;
  padding: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
}

.header-second__categories:hover {
  text-decoration: underline;
  color: var(--color-primary);
}

/* Поиск: растягивается между «Все категории» и «Город», без пустого зазора */
.header-second__search {
  flex: 1 1 auto;
  min-width: 220px;
  max-width: none;
}

/* Поиск: поле и кнопка «Найти» строго в одну строку, как на Авито */
.header-second__form {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex-wrap: nowrap;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  width: 100%;
}

.header-second__input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 40px;
  height: 40px;
  padding: 0 12px;
  border: none;
  font-size: 0.9375rem;
  background: #fff;
  box-sizing: border-box;
}

.header-second__input::placeholder {
  color: var(--color-text-muted);
}

/* Кнопка «Найти» справа от поля в одной строке */
.header-second__submit {
  flex: 0 0 auto;
  padding: 0 16px;
  min-height: 40px;
  height: 40px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-left: 1px solid rgba(255,255,255,0.2);
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.header-second__submit:hover {
  background: var(--color-primary-hover);
  color: #fff;
}

.header-second__location,
.header-second__categories-wrap .header-second__categories {
  flex-shrink: 0;
  font-size: 0.875rem;
  color: #6b7280;
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: inherit;
  text-decoration: none;
}

.header-second__location:hover,
.header-second__categories-wrap .header-second__categories:hover {
  color: var(--color-primary);
}

.header-second__location-text {
  white-space: nowrap;
}

.header-second__chevron {
  font-size: 0.6em;
  opacity: 0.8;
}

.header-second__categories-wrap,
.header-second__location-wrap {
  position: relative;
}

.header-second__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 2px;
  min-width: 180px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 100;
  padding: 0.25rem 0;
}

.header-second__dropdown a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--color-text);
  text-decoration: none;
}

.header-second__dropdown a:hover {
  background: #f3f4f6;
  color: var(--color-primary);
}

.header-second__categories-wrap .header-second__dropdown {
  left: 0;
}

.header-second__location-wrap.is-open .header-second__dropdown,
.header-second__categories-wrap.is-open .header-second__dropdown {
  display: block;
}

/* Адаптив шапки — в одну линию на десктопе, перенос только на планшетах/мобильных */
@media (max-width: 767px) {
  .header-bar__inner {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .header-bar__right {
    flex-wrap: wrap;
  }

  .header-bar__user {
    order: 3;
    width: 100%;
  }

  .header-bar__cta {
    order: 2;
  }
}

@media (max-width: 782px) {
  .header-second__inner {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: wrap;
  }

  .header-second__search {
    max-width: none;
  }
}

/* Общие (сайдбар и др. используют .site-branding) */
.site-branding {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.site-title a {
  color: var(--color-text);
}

.site-title a:hover {
  color: var(--color-primary);
}

.site-description {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Cards (Ads listing)
   ========================================================================== */
.ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.ad-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}

.ad-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.ad-card__thumb {
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--color-border);
  overflow: hidden;
}

.ad-card__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.ad-card__body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ad-card__title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.ad-card__title a {
  color: var(--color-text);
}

.ad-card__title a:hover {
  color: var(--color-primary);
}

.ad-card__price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-top: auto;
}

.ad-card__meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}

/* ==========================================================================
   Single ad (страница объявления, layout как на Авито)
   ========================================================================== */
.single-ad__article {
  padding-bottom: 2rem;
}

.single-ad__layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

.single-ad__main {
  min-width: 0;
}

.single-ad__aside {
  position: relative;
}

.single-ad__sticky {
  position: sticky;
  top: calc(var(--header-height, 64px) + 1rem);
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.single-ad__header {
  margin-bottom: 1rem;
}

.single-ad__title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}

.single-ad__meta-top {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.single-ad__meta-top .single-ad__categories a {
  color: var(--color-text-muted);
}

.single-ad__meta-top .single-ad__categories a:hover {
  color: var(--color-primary);
}

.single-ad__gallery {
  margin-bottom: 1.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-border);
  box-shadow: var(--shadow);
}

.single-ad__gallery img {
  width: 100%;
  height: auto;
  display: block;
}

.single-ad__gallery {
  position: relative;
  margin-bottom: 1.5rem;
}

.single-ad__gallery-main {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-border);
  margin-bottom: 0.5rem;
  aspect-ratio: 4/3;
}

.single-ad__gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.single-ad__gallery-slide {
  display: none;
  width: 100%;
  height: 100%;
}

.single-ad__gallery-slide.is-active {
  display: block;
}

.single-ad__gallery-prev,
.single-ad__gallery-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s;
}

.single-ad__gallery-prev:hover,
.single-ad__gallery-next:hover {
  background: rgba(0,0,0,0.7);
}

.single-ad__gallery-prev {
  left: 0.75rem;
}

.single-ad__gallery-next {
  right: 0.75rem;
}

.single-ad__gallery-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.single-ad__gallery-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: var(--color-border);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s;
}

.single-ad__gallery-dot:hover,
.single-ad__gallery-dot.is-active {
  background: var(--color-primary);
}

.single-ad__header--row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.single-ad__header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.single-ad__price-inline {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
}

.single-ad__action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--color-text-muted);
  cursor: pointer;
}

.single-ad__action-btn:hover {
  background: var(--color-bg);
  color: var(--color-primary);
}

.single-ad__action-icon {
  display: inline-flex;
  line-height: 0;
}

.single-ad__actions-row {
  display: flex;
  gap: 0.75rem;
  margin: 1.25rem 0;
  flex-wrap: wrap;
}

.single-ad__btn-phone.is-disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-success {
  background: var(--color-success);
  color: #fff;
}

.btn-success:hover {
  background: #0d9668;
  color: #fff;
}

.single-ad__seller-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9375rem;
}

.single-ad__seller-inline-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
  text-decoration: none;
}

.single-ad__seller-inline-link:hover {
  color: var(--color-primary);
}

.single-ad__seller-inline .single-ad__seller-avatar {
  width: 40px;
  height: 40px;
  font-size: 1.125rem;
}

.single-ad__seller-rating {
  color: var(--color-text-muted);
}

.single-ad__seller-meta {
  color: var(--color-text-muted);
}

.single-ad__seller-subscribe {
  margin-left: auto;
  font-size: 0.875rem;
}

.single-ad__ask-seller {
  margin-bottom: 1.5rem;
}

.single-ad__ask-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.single-ad__ask-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.single-ad__quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.single-ad__quick-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  cursor: pointer;
}

.single-ad__quick-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.single-ad__location-block {
  margin-bottom: 1.5rem;
}

.single-ad__location-text {
  margin: 0 0 0.25rem;
  font-weight: 600;
}

.single-ad__location-link {
  font-size: 0.9375rem;
}

.single-ad__sidebar-ads {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
}

.single-ad__sidebar-ads-label {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.single-ad__sidebar-ads-placeholder {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0;
  padding: 1rem;
  background: var(--color-bg);
  border-radius: var(--radius);
}


.single-ad__section {
  margin-bottom: 1.5rem;
}

.single-ad__section-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.single-ad__characteristics,
.single-ad__description {
  background: var(--color-bg-card);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.single-ad__char-list {
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.single-ad__char-list dt {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.single-ad__char-list dd {
  margin: 0;
}

.single-ad__content {
  font-size: 0.9375rem;
  line-height: 1.6;
}

.single-ad__content p:last-child {
  margin-bottom: 0;
}

.single-ad__footer-meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.single-ad__footer-meta .single-ad__id {
  margin-right: 0.5rem;
}

.single-ad__similar .single-ad__section-title {
  margin-bottom: 1rem;
}

.ads-grid--similar {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

/* Блок продавца в сайдбаре */
.single-ad__seller-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.single-ad__seller-avatar-wrap {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-border);
}

.single-ad__seller-avatar-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
}

.single-ad__seller-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.single-ad__seller-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.single-ad__seller-name {
  font-weight: 600;
  font-size: 1rem;
}

.single-ad__seller-type,
.single-ad__seller-since {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.single-ad__seller-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.single-ad__seller-actions .btn--full,
.single-ad__seller-actions .is-disabled {
  width: 100%;
}

.single-ad__seller-ads-count {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.single-ad__seller-subscribe {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--color-primary);
  text-align: center;
}

.single-ad__seller-subscribe:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

@media (max-width: 900px) {
  .single-ad__layout {
    grid-template-columns: 1fr;
  }

  .single-ad__aside {
    order: -1;
  }

  .single-ad__sticky {
    position: static;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
  }


  .single-ad__seller {
    grid-column: 1 / -1;
    border-top: 1px solid var(--color-border);
    padding-top: 1rem;
  }
}

@media (max-width: 480px) {
  .single-ad__sticky {
    grid-template-columns: 1fr;
  }

  .ads-grid--similar {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}

/* ==========================================================================
   Buttons & Forms
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-family: inherit;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  color: #fff;
}

.btn-accent {
  background: var(--color-accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--color-accent-hover);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.btn-small {
  padding: 0.35rem 0.65rem;
  font-size: 0.875rem;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
  color: #fff;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="number"],
textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg-card);
  transition: border-color var(--transition);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 2rem 0 0;
  list-style: none;
  padding: 0;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.5rem;
  background: var(--color-bg-card);
  border-radius: var(--radius);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.pagination .current {
  background: var(--color-primary);
  color: #fff;
}

.pagination a:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.widget-area {
  padding: 1rem 0;
}

.widget {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.widget-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.widget ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.widget li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-border);
}

.widget li:last-child {
  border-bottom: none;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--color-text);
  color: #94a3b8;
  margin-top: auto;
  padding: 1.5rem 0;
}

.site-footer a {
  color: #cbd5e1;
}

.site-footer a:hover {
  color: #fff;
}

.site-footer .site-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.site-info {
  font-size: 0.875rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 782px) {
  .menu-toggle {
    display: block;
  }

  .main-navigation ul {
    display: none;
    width: 100%;
    flex-direction: column;
  }

  .main-navigation.toggled ul {
    display: flex;
  }

  .main-navigation a {
    padding: 0.75rem;
  }

  .ads-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
  }

  .site-header .site-container {
    min-height: auto;
    padding: 0.75rem 1rem;
  }

  #secondary.widget-area {
    width: 100%;
    order: 1;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .site-container {
    padding: 0 0.75rem;
  }

  .ads-grid {
    grid-template-columns: 1fr;
  }

  .single-ad .entry-title {
    font-size: 1.25rem;
  }

  .site-footer .site-container {
    flex-direction: column;
    text-align: center;
  }
}

/* Content width for alignment */
.alignwide {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.alignfull {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
}

/* ==========================================================================
   Breadcrumb & Search form
   ========================================================================== */
.breadcrumb {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.breadcrumb .sep {
  margin: 0 0.25rem;
}

.breadcrumb .current {
  color: var(--color-text);
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 1rem 0;
}

.search-form label {
  flex: 1;
  min-width: 200px;
}

.search-form .search-field {
  width: 100%;
}

.page-header .page-description {
  margin: 0.5rem 0 0;
  color: var(--color-text-muted);
}

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

/* ==========================================================================
   Auth (Login / Registration)
   ========================================================================== */
.page-auth .page-header {
  margin-bottom: 1.5rem;
}

.auth-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  max-width: 800px;
}

.auth-single {
  max-width: 400px;
}

.btn--full {
  width: 100%;
}

.auth-box {
  background: var(--color-bg-card);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.auth-box__title {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.auth-box__link {
  margin-top: 1rem;
  font-size: 0.875rem;
}

.auth-form__row {
  margin: 0 0 1rem;
}

.auth-form__row--inline {
  margin-bottom: 0.5rem;
}

.auth-form__row:last-of-type {
  margin-bottom: 0;
}

.auth-form__input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-top: 0.25rem;
}

.auth-message {
  padding: 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.auth-message--error {
  background: #fef2f2;
  color: var(--color-danger);
}

.auth-message--success {
  background: #ecfdf5;
  color: var(--color-success);
}

.auth-message--info {
  background: var(--color-primary-light);
  color: var(--color-primary-hover);
}

/* ==========================================================================
   User Cabinet
   ========================================================================== */
.page-cabinet .cabinet-header {
  margin-bottom: 0.5rem;
}

.page-cabinet .cabinet-header .page-description {
  margin-top: 0.25rem;
}

.cabinet-logout {
  font-size: 0.875rem;
  font-weight: normal;
}

.cabinet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.cabinet-tabs__link {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 500;
  color: var(--color-text-muted);
}

.cabinet-tabs__link:hover {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.cabinet-tabs__link--active {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.cabinet-actions {
  margin-bottom: 1.5rem;
}

.cabinet-section-title {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.cabinet-form-section,
.cabinet-list-section {
  background: var(--color-bg-card);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.cabinet-ad-form .form-row {
  margin-bottom: 1rem;
}

.cabinet-ad-form .form-row--actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cabinet-ad-form .form-input,
.cabinet-ad-form .form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
}

.cabinet-ad-form .form-textarea {
  min-height: 120px;
  resize: vertical;
}

.cabinet-ad-form .form-help,
.cabinet-ad-form small {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.cabinet-ad-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cabinet-ad-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.cabinet-ad-list__item:last-child {
  border-bottom: none;
}

.cabinet-ad-list__thumb {
  width: 80px;
  height: 60px;
  flex-shrink: 0;
  background: var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cabinet-ad-list__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cabinet-ad-list__no-thumb {
  color: var(--color-text-muted);
  font-size: 1.25rem;
}

.cabinet-ad-list__body {
  flex: 1;
  min-width: 0;
}

.cabinet-ad-list__title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
}

.cabinet-ad-list__title a {
  color: var(--color-text);
}

.cabinet-ad-list__title a:hover {
  color: var(--color-primary);
}

.cabinet-ad-list__meta {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.cabinet-ad-list__price {
  margin-left: 0.5rem;
  font-weight: 600;
  color: var(--color-primary);
}

.cabinet-ad-list__actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cabinet-empty {
  color: var(--color-text-muted);
}

.cabinet-notification-chat-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-primary);
}

.cabinet-notification-chat-link:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

.cabinet-compose-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.cabinet-compose-meta {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.cabinet-compose-form .form-row {
  margin-bottom: 0.75rem;
}

.cabinet-compose-form .form-row--actions,
.cabinet-compose-form .form-row:last-of-type {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.cabinet-threads-list {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cabinet-thread-item {
  border-bottom: 1px solid var(--color-border);
}

.cabinet-thread-item:last-child {
  border-bottom: none;
}

.cabinet-thread-link {
  display: block;
  padding: 12px 14px;
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.15s ease;
}

.cabinet-thread-link:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.cabinet-thread-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.cabinet-thread-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-primary);
  border-radius: 10px;
}

.cabinet-thread-ad {
  display: block;
  font-size: 0.875rem;
  color: var(--color-primary);
  margin-bottom: 2px;
}

.cabinet-thread-preview {
  display: block;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.cabinet-thread-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.cabinet-back-link {
  font-size: 0.9375rem;
  margin-bottom: 1rem;
  display: inline-block;
}

.cabinet-thread-header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 1rem;
}

.cabinet-thread-header a {
  color: var(--color-primary);
}

.cabinet-thread-msg {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  max-width: 85%;
}

.cabinet-thread-msg--own {
  margin-left: auto;
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary);
}

.cabinet-thread-msg--other {
  margin-right: auto;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

.cabinet-thread-msg-author {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--color-text-muted);
}

.cabinet-thread-msg-text {
  display: block;
  font-size: 0.9375rem;
}

.cabinet-thread-msg-date {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.cabinet-filters {
  margin-bottom: 1.5rem;
}

.cabinet-filters__form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}

.cabinet-filters__label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cabinet-filters__label-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.cabinet-filters__select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  min-width: 160px;
}

.cabinet-filters__submit {
  flex-shrink: 0;
}

.cabinet-ads-grid {
  margin-top: 0;
}

.cabinet-ad-card-wrap {
  display: flex;
  flex-direction: column;
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 0;
}

.cabinet-ad-card-wrap .ad-card {
  flex: 1 1 auto;
  min-height: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

.cabinet-ad-card-wrap .ad-card:hover {
  box-shadow: none;
  transform: none;
}

.cabinet-ad-card-wrap .ad-card__thumb {
  flex-shrink: 0;
}

.cabinet-ad-card-wrap .ad-card__body {
  flex: 1 1 auto;
  min-height: 0;
}

.cabinet-ad-card-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  flex-shrink: 0;
}
