.header {
    display: flex;
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
    position: relative;
  }

  .brand {
    flex: 1 1 100%;
  }
.logo img{
width:128px;
}

.nav{
    display:flex;
    flex-wrap:wrap;
    width:100%;
    justify-content:center;
    gap:6px;
}

/* Все элементы навигации по умолчанию скрываем */
.nav > *{
    display:none;
}

/* ---------- ВЕРХНИЙ РЯД ---------- */
/* Страны + Login/Logout */

.nav select#countrySelect{
    display:block;
    order:1;
}

.nav button:has(a[href*="/profile"]){
    display:block;
    order:1;
    margin:0 4px;
}

.nav button:has(a[href$="/login"]),
.nav button:has(a[href$="/logout"]){
    display:block;
    order:1;
}

/* Центровка верхнего ряда */
.nav select#countrySelect,
.nav button:has(a[href$="/login"]),
.nav button:has(a[href$="/logout"]){
    margin:0 4px;
}

/* ---------- СЕРЕДИНА ---------- */
/* Переключатель темы */

.theme-switch-wrapper{
    display:flex;
    order:2;
    flex:1 1 100%;
    justify-content:flex-end;
    margin-top:4px;
}

/* ---------- НИЖНИЙ РЯД ---------- */
/* Статьи Форум Язык */

.nav button:has(a[href$="/articles"]){
    display:block;
    order:3;
}

/* Форум */
.nav button:has(a[href$="/topics"]){
    display:block;
    order:4;
}

/* Язык */
.nav select[aria-label="Язык"]{
    display:block;
    order:5;
}

.nav button:has(a[href$="/articles"]),
.nav button:has(a[href$="/topics"]),
.nav select[aria-label="Язык"]{
    margin:0 4px;
}

/* ---------- КНОПКА POST ---------- */

.nav .btn-post{
    display:block;
    position:absolute;
    top:10px;
    right:12px;
    z-index:5;
}

.brand .title {
  font-size: 16px;
}

.brand div:last-child {
  font-size: 12px;
}

.filter-card {
  padding: 10px;
}

.filter-card {
  position: relative;
}

.filter-card h4 {
  cursor: pointer;
  padding-right: 30px; /* Место для стрелки */
  margin-bottom: 0 !important;
}

/* Стрелка для индикации сворачивания */
.filter-card h4::after {
  content: '▼';
  position: absolute;
  right: 15px;
  top: 15px;
  font-size: 12px;
  transition: transform 0.3s ease;
  color: var(--muted);
}

.filter-card.collapsed h4::after {
  transform: rotate(-90deg);
}

/* Содержимое фильтров */
.filter-card .form-row,
.filter-card .filter-actions {
  max-height: 500px;
  opacity: 1;
  transition: all 0.3s ease;
  overflow: hidden;
}

.filter-card.collapsed .form-row,
.filter-card.collapsed .filter-actions {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
}

/* Сортировка всегда видна */
.filter-card:not(:first-child) h4::after {
  display: none; /* Убираем стрелку у сортировки */
}

.filter-card:not(:first-child) .form-row {
  max-height: none !important;
  opacity: 1 !important;
}


.form-row {
  gap: 6px;
}

/* ПЕРЕНОСИМ БЛОКИ ВНИЗ ПОД ОБЪЯВЛЕНИЯ */
.layout {
  display: flex;
  flex-direction: column;
}

.sidebar {
  order: -1; /* Перемещаем сайдбар с фильтрами выше основного контента */
  margin-top: 0;
  position: static; /* Убираем sticky позиционирование */
}

/* Скрываем блоки статистики и форума в сайдбаре */
.sidebar .stats,
.sidebar .filter-card:last-child {
  display: none;
}

/* Показываем эти блоки в основном контенте внизу */
section .forum:last-child {
  display: block; /* Убедимся, что блок виден */
}

/* СКРЫВАЕМ СТАТИСТИКУ И ФОРУМ В САЙДБАРЕ */
.sidebar .stats,
.sidebar .filter-card:last-child {
  display: none;
}

/* СТАТИСТИКА В ОСНОВНОМ КОНТЕНТЕ - ПЕРЕМЕЩАЕМ ПОСЛЕ ОБЪЯВЛЕНИЙ */
.stats {
  order: 2;
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
  background: var(--card);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.stats div {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  background: transparent !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.stats strong {
  display: block;
  font-size: 16px;
  color: var(--text-color);
  margin-top: 4px;
}

/* СКРЫВАЕМ СТАТИСТИКУ И ФОРУМ В САЙДБАРЕ */
.sidebar .stats,
.sidebar .filter-card:last-child {
  display: none;
}

.sidebar .stats,
.sidebar .filter-card:last-child {
  display: none !important;
}


section {
  display: flex;
  flex-direction: column;
}

/* Объявления идут первыми */
.card-grid {
  order: 1;
}

/* Пагинация после объявлений */
.card-grid + div {
  order: 2;
}


section .forum {
  order: 3;
  display: block !important;
}

.in-container{
flex-direction: column;
align-items: center;
}
    
.login, .signup{
width: 100%;
}
