/* Стили для рекламных блоков */

/* Контейнеры для рекламы */
.ad-container {
  margin: var(--spacing-md) auto;
  text-align: center;
  max-width: 100%;
  min-width: 320px;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.ad-placeholder {
  position: relative;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  min-height: 90px;
  min-width: 320px;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.ad-label {
  display: none;
}

.ad-content {
  width: 100%;
  max-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
}

/* Responsive стили для рекламы */
@media (max-width: 768px) {
  .ad-header-banner,
  .ad-footer-banner {
    width: 320px;
    height: 50px;
  }
  
  .ad-header-banner .ad-placeholder,
  .ad-footer-banner .ad-placeholder {
    height: 50px;
    min-height: 50px;
  }
  
  .ad-in-content {
    width: 300px;
    height: 250px;
  }
  
  /* Боковая реклама остается видимой на планшетах */
}

@media (max-width: 480px) {
  .ad-header-banner,
  .ad-footer-banner {
    width: 300px;
    height: 50px;
  }
  
  .ad-in-content {
    width: 280px;
    height: 200px;
  }
  
  .ad-in-content .ad-placeholder {
    height: 200px;
    min-height: 200px;
  }
}

/* Базовые стили для рекламных элементов */
.adsbygoogle {
  display: block;
  width: 100%;
  height: auto;
}

/* Стили для элементов внутри рекламного блока */
.ad-header-banner * {
  max-width: 100%;
}

.ad-header-banner .ad-content {
  width: 100%;
  height: auto;
}

/* Стили для рекламы в списке */
.ad-in-content .adsbygoogle {
  width: 100% !important;
  max-width: 100% !important;
  height: auto;
  min-height: 250px;
}

/* Стили для элементов внутри рекламы в списке */
.ad-in-content * {
  max-width: 100%;
}

.ad-in-content iframe {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 250px;
  border: none !important;
  display: block;
}

/* Стили для дочерних элементов рекламы */
.ad-in-content .adsbygoogle > * {
  max-width: 100%;
}

.ad-in-content .adsbygoogle div {
  max-width: 100%;
}

/* Верхний баннер - адаптивный размер */
.ad-header-banner {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  margin: var(--spacing-md) auto;
  box-sizing: border-box;
}

.ad-header-banner .ad-placeholder {
  width: 100%;
  min-height: 90px;
  height: auto;
}

/* Нижний баннер - адаптивный размер */
.ad-footer-banner {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  margin: var(--spacing-md) auto var(--spacing-sm) auto;
  padding-bottom: 0;
}

.ad-footer-banner .ad-placeholder {
  width: 100%;
  min-height: 90px;
  height: auto;
}

/* Боковая реклама - sticky система */
.sidebar-ad-container {
  position: fixed;
  top: 80px; /* Начальная позиция - 2см от верха */
  right: 20px;
  width: 360px;
  height: 800px; /* Новый размер 360x800 */
  z-index: 5;
  display: none;
  background: transparent;
  border: none;
  border-radius: 8px;
  overflow: hidden;
  transition: top 0.3s ease-out;
  /* Принудительно ограничиваем размеры */
  max-height: 800px !important;
  min-height: 800px !important;
  max-width: 360px !important;
  min-width: 360px !important;
}

.sidebar-ad-container.sticky {
  top: 20px !important;
}

/* Класс для ограничения позиции рекламы относительно хедера */
.sidebar-ad-container.header-limited {
  top: calc(var(--header-height, 200px) + 20px) !important;
}

/* Альтернативный способ через JavaScript стили */
.sidebar-ad-container.position-limited {
  /* Позиция будет установлена через JavaScript */
}

/* Стили для нового формата рекламы - сетка из 4 объявлений */
.sidebar-ad-container .adsbygoogle {
  width: 100% !important;
  height: auto !important;
  min-height: 800px !important;
  display: block !important;
}

/* Обеспечиваем правильное отображение для matched content */
.sidebar-ad-container .adsbygoogle[data-matched-content-ui-type="image_stacked"] {
  width: 360px !important;
  height: auto !important;
  min-height: 800px !important;
}

.sidebar-ad {
  width: 100%;
  height: 100%;
  max-height: 800px !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-ad-content {
  width: 100%;
  height: 100%;
  max-height: 800px !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Показываем боковую рекламу только на широких экранах */
@media (min-width: 1024px) {
  .sidebar-ad-container {
    display: block !important;
  }
}

/* На средних экранах скрываем */
@media (max-width: 1023px) {
  .sidebar-ad-container {
    display: none !important;
  }
}

/* Реклама между контентом - адаптивный размер */
.ad-in-content {
  margin: 10px auto;
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  text-align: center;
  box-sizing: border-box;
}

.ad-in-content .ad-placeholder {
  width: 100%;
  min-height: 90px;
  height: 90px; /* Фиксированная высота */
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 10px;
  display: block; /* Изменено с flex на block */
  box-sizing: border-box;
}

/* Удален класс .ad-content - больше не используется */

/* Стили для рекламы в списке */
.ad-in-content .adsbygoogle {
  width: 100% !important;
  max-width: 100% !important;
  height: 90px !important; /* Фиксированная высота */
  min-height: 90px !important;
  max-height: 90px !important; /* Ограничиваем максимальную высоту */
  display: block !important;
  overflow: hidden !important; /* Скрываем переполнение */
  box-sizing: border-box !important;
}

/* Дополнительные стили для предотвращения двойной высоты */
.ad-in-content .adsbygoogle iframe {
  height: 90px !important;
  max-height: 90px !important;
  width: 100% !important;
  border: none !important;
}

/* Принудительная высота для всех элементов внутри рекламного блока */
.ad-in-content .adsbygoogle * {
  max-height: 90px !important;
}

/* Принудительная высота для самого контейнера adsbygoogle */
.ad-in-content .adsbygoogle {
  height: 90px !important;
  min-height: 90px !important;
  max-height: 90px !important;
}

/* Responsive стили для рекламы */
@media (max-width: 768px) {
  .ad-header-banner,
  .ad-footer-banner {
    width: 320px;
    height: 50px;
  }
  
  .ad-header-banner .ad-placeholder,
  .ad-footer-banner .ad-placeholder {
    height: 50px;
    min-height: 50px;
  }
  
  .ad-in-content {
    width: 300px;
    height: 250px;
  }
  
  /* Боковая реклама остается видимой на планшетах */
}

@media (max-width: 480px) {
  .ad-header-banner,
  .ad-footer-banner {
    width: 300px;
    height: 50px;
  }
  
  .ad-in-content {
    width: 280px;
    height: 200px;
  }
  
  .ad-in-content .ad-placeholder {
    height: 200px;
    min-height: 200px;
  }
}
