/* Адаптивные стили для верхнего баннера рекламы */
.ad-top-banner {
  text-align: center;
  margin: 4px 0 12px;
  min-height: 0;
  transition: opacity 0.3s ease, margin 0.3s ease;
  overflow: hidden;
}

.ad-top-banner.loading .mrg-tag {
  height: 0 !important;
  min-height: 0;
  overflow: hidden;
  opacity: 0;
}

.ad-top-banner.loading::before {
  content: none;
}

.ad-top-banner.ad-loaded .mrg-tag,
.ad-top-banner:not(.loading):not(.hidden) .mrg-tag {
  width: 100% !important;
  max-width: 970px;
  height: auto !important;
  opacity: 1;
  display: inline-block;
}

.ad-top-banner.hidden {
  display: none !important;
  height: 0;
  margin: 0;
}

.ad-top-banner ins[style*="display: none"],
.ad-top-banner ins[style*="height: 0px"],
.ad-top-banner ins[style*="width: 0px"] {
  display: none !important;
}

@media (max-width: 1199px) {
  .ad-top-banner.ad-loaded .mrg-tag,
  .ad-top-banner:not(.loading):not(.hidden) .mrg-tag {
    max-width: 728px;
  }
}

@media (max-width: 768px) {
  .ad-top-banner.ad-loaded .mrg-tag,
  .ad-top-banner:not(.loading):not(.hidden) .mrg-tag {
    max-width: 320px;
  }
}

/* Базовые стили страницы */
html, body { 
  width: 100%; 
  overflow-x: hidden; 
}

body { 
  margin: 0; 
  padding: 0; 
  background: #f5f5f5; 
  min-height: 100vh; 
}

.page { 
  max-width: 1200px; 
  margin: 0 auto; 
  padding: 16px; 
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; 
  line-height: 1.6; 
  box-sizing: border-box; 
}

/* Стили заголовка раздела новостей */
.news-header { 
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%); 
  color: white; 
  padding: 40px; 
  border-radius: 12px; 
  margin-bottom: 30px; 
  text-align: center; 
}

.news-header--compact {
  padding: 18px 20px 16px;
  margin-bottom: 16px;
}

.news-header .news-title { 
  font-size: 3rem; 
  margin-bottom: 15px; 
  font-weight: 700; 
  color: #fff;
}

.news-header--compact .news-title {
  font-size: 1.65rem;
  margin: 0 0 6px;
  line-height: 1.25;
}

.news-subtitle { 
  font-size: 1.2rem; 
  opacity: 0.9; 
  margin-bottom: 20px; 
}

.news-header--compact .news-subtitle {
  font-size: 0.95rem;
  margin: 0 0 12px;
  opacity: 0.92;
  line-height: 1.4;
}

.kb-subscribe {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.kb-subscribe__link {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}

.kb-subscribe__link:hover {
  background: rgba(255, 255, 255, 0.32);
  transform: translateY(-1px);
  color: #fff;
}

/* Стили блока статистики */
.news-stats { 
  display: flex; 
  justify-content: center; 
  gap: 30px; 
  flex-wrap: wrap; 
}

.stat-item { 
  text-align: center; 
}

.stat-number { 
  font-size: 2rem; 
  font-weight: bold; 
  display: block; 
}

.stat-label { 
  font-size: 0.9rem; 
  opacity: 0.8; 
}

/* Стили навигации по категориям */
.news-categories { 
  display: flex; 
  gap: 15px; 
  margin-bottom: 30px; 
  flex-wrap: nowrap; 
  justify-content: center; 
  overflow-x: auto; 
  -webkit-overflow-scrolling: touch; 
  scrollbar-width: thin;
  scrollbar-color: #dc3545 #f1f1f1;
}

.news-categories::-webkit-scrollbar {
  height: 6px;
}

.news-categories::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.news-categories::-webkit-scrollbar-thumb {
  background: #dc3545;
  border-radius: 3px;
}

.category-link { 
  padding: 10px 20px; 
  background: #fff; 
  border: 2px solid #e9ecef; 
  border-radius: 25px; 
  text-decoration: none; 
  color: #333; 
  font-weight: 500; 
  transition: all 0.3s ease; 
  cursor: pointer; 
  white-space: nowrap; 
  flex-shrink: 0;
}

.category-link:hover, 
.category-link.active { 
  background: #dc3545; 
  color: white; 
  border-color: #dc3545; 
  transform: translateY(-2px);
}

/* Стили поисковой строки */
.search-box { 
  max-width: 500px; 
  margin: 0 auto 30px; 
  position: relative; 
}

.search-input { 
  width: 100%; 
  padding: 15px 20px; 
  border: 2px solid #e9ecef; 
  border-radius: 25px; 
  font-size: 1rem; 
  outline: none; 
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  background: #fff;
}

.search-input:focus { 
  border-color: #dc3545; 
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.search-suggestions { 
  position: absolute; 
  top: 100%; 
  left: 0; 
  right: 0; 
  background: #fff; 
  border: 1px solid #e9ecef; 
  border-radius: 8px; 
  max-height: 200px; 
  overflow-y: auto; 
  z-index: 1000; 
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-top: 5px;
}

.search-suggestion { 
  padding: 12px 16px; 
  cursor: pointer; 
  border-bottom: 1px solid #f8f9fa;
  transition: background-color 0.2s ease;
}

.search-suggestion:hover { 
  background: #f8f9fa; 
}

.search-suggestion:last-child {
  border-bottom: none;
}

/* Индикатор загрузки */
.loading-indicator {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
  font-size: 1.1rem;
}

.loading-indicator p {
  margin: 0;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Стили сетки новостей */
.news-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); 
  gap: 25px; 
  margin-bottom: 40px; 
}

.news-card { 
  position: relative; 
  background: white; 
  border-radius: 12px; 
  overflow: hidden; 
  box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
  transition: all 0.3s ease; 
  cursor: pointer;
  opacity: 1;
  transform: translateY(0);
}

.news-card.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.news-card:hover { 
  transform: translateY(-5px); 
  box-shadow: 0 8px 25px rgba(0,0,0,0.15); 
}

.news-card-content { 
  padding: 25px; 
}

.news-card-category { 
  display: inline-block; 
  padding: 5px 12px; 
  background: #e9ecef; 
  color: #495057; 
  border-radius: 15px; 
  font-size: 0.8rem; 
  font-weight: 500; 
  margin-bottom: 15px; 
}

.news-card-title { 
  font-size: 1.3rem; 
  font-weight: 600; 
  margin-bottom: 10px; 
  color: #333; 
  line-height: 1.4; 
}

.news-card-excerpt { 
  color: #6c757d; 
  margin-bottom: 15px; 
  line-height: 1.6; 
}

.news-card-meta { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  font-size: 0.9rem; 
  color: #6c757d; 
}

.news-card-link { 
  position: absolute; 
  inset: 0; 
  z-index: 1; 
}

.news-card-share { 
  display: flex; 
  gap: 10px; 
  margin-top: 10px;
  position: relative;
  z-index: 2;
}

.kb-share-button {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e53935, #c62828);
  color: #fff;
  box-shadow: 0 3px 8px rgba(229, 57, 53, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.kb-share-button:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(229, 57, 53, 0.5);
  color: #fff;
}

.kb-share-button:active {
  transform: translateY(0);
}

/* legacy share-btn (если остался) */
.share-btn { 
  padding: 8px; 
  background: #f8f9fa; 
  border-radius: 50%; 
  text-decoration: none; 
  color: #333 !important; 
  transition: all 0.2s ease;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-btn:hover { 
  background: #e53935; 
  color: white !important; 
  transform: scale(1.1);
}

/* Share popup (как у промокодов) */
#kb-share-popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9000;
  align-items: center;
  justify-content: center;
}

#kb-share-popup-overlay.visible {
  display: flex;
  animation: kb-share-overlay-in 0.18s ease;
}

@keyframes kb-share-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.kb-share-popup {
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px 20px;
  width: min(92vw, 360px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
  position: relative;
  animation: kb-share-popup-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes kb-share-popup-in {
  from { transform: scale(0.82); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.kb-share-popup__close {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 22px;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  padding: 4px;
  border-radius: 6px;
}

.kb-share-popup__close:hover {
  color: #333;
  background: rgba(0,0,0,0.06);
}

.kb-share-popup__title {
  font-size: 16px;
  font-weight: 700;
  color: #222;
  margin: 0 0 4px;
  padding-right: 28px;
  text-align: center;
}

.kb-share-popup__name {
  font-size: 13px;
  color: #666;
  text-align: center;
  margin: 0 0 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-share-networks {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.kb-share-network-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  color: #333;
  font-size: 11px;
  font-weight: 600;
  width: 56px;
  transition: transform 0.15s ease;
}

.kb-share-network-btn:hover {
  transform: translateY(-3px);
}

.kb-share-network-btn .sn-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.sn-icon--vk    { background: #0077ff; }
.sn-icon--tg    { background: #26a5e4; }
.sn-icon--max   { background: linear-gradient(135deg, #44ccff 0%, #5533ee 62%, #9933dd 100%); }
.sn-icon--ok    { background: #ee8208; }
.sn-icon--email { background: #6c757d; }

.kb-share-popup__url-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.kb-share-popup__url-input {
  flex: 1;
  font-size: 12px;
  padding: 7px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  color: #444;
  background: #f7f7f7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  outline: none;
}

.kb-share-popup__copy-btn {
  flex-shrink: 0;
  padding: 7px 12px;
  background: #e53935;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.kb-share-popup__copy-btn.copied {
  background: #28a745;
}

@media (max-width: 500px) {
  #kb-share-popup-overlay {
    align-items: flex-end;
  }
  .kb-share-popup {
    width: 100%;
    border-radius: 20px 20px 0 0;
  }
}

/* Стили промо-баннера */
.promo-banner { 
  background: linear-gradient(135deg, #dc3545 0%, #f47059 100%); 
  color: white; 
  padding: 20px; 
  border-radius: 12px; 
  text-align: center; 
  margin-bottom: 30px; 
}

.promo-banner a { 
  color: white; 
  text-decoration: underline; 
  font-weight: 600;
}

.promo-banner a:hover { 
  text-decoration: none; 
}

/* Стили секции RSS */
.rss-section { 
  background: #fff; 
  border-radius: 12px; 
  padding: 30px; 
  text-align: center; 
  margin-bottom: 30px; 
  box-shadow: 0 2px 8px rgba(0,0,0,0.1); 
}

.rss-title { 
  font-size: 1.5rem; 
  margin-bottom: 15px; 
  color: #333; 
}

.rss-description { 
  color: #6c757d; 
  margin-bottom: 20px; 
}

.rss-btn { 
  display: inline-block; 
  padding: 12px 30px; 
  background: #dc3545; 
  color: white; 
  text-decoration: none; 
  border-radius: 25px; 
  font-weight: 500; 
  transition: all 0.3s ease;
  border: 2px solid #dc3545;
}

.rss-btn:hover { 
  background: #c82333; 
  border-color: #c82333;
  transform: translateY(-2px);
}

/* Стили кнопок социальных сетей */
.social-subscribe { 
  display: flex; 
  justify-content: center; 
  gap: 12px; 
  margin-top: 12px; 
  flex-wrap: wrap; 
}

.tg-btn, .vk-btn { 
  display: inline-block; 
  padding: 10px 20px; 
  border-radius: 25px; 
  color: #fff; 
  font-weight: 600; 
  text-decoration: none; 
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.tg-btn { 
  background: #229ED9; 
}

.vk-btn { 
  background: #2787F5; 
}

.tg-btn:hover, .vk-btn:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 6px 14px rgba(0,0,0,.15); 
  color: #fff; 
  text-decoration: none;
  border-color: rgba(255,255,255,0.3);
}

/* Стили кнопки "Загрузить еще" */
.load-more { 
  display: flex; 
  justify-content: center; 
  margin-top: 40px; 
}

.load-more-btn { 
  padding: 12px 30px; 
  background: #dc3545; 
  color: white; 
  border: none; 
  border-radius: 25px; 
  font-size: 1rem; 
  cursor: pointer; 
  transition: all 0.3s ease;
  font-weight: 600;
  border: 2px solid #dc3545;
}

.load-more-btn:hover { 
  background: #c82333; 
  border-color: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Стили для состояния "ничего не найдено" */
.no-results { 
  text-align: center; 
  padding: 60px 20px; 
  color: #6c757d; 
  background: #fff;
  border-radius: 12px;
  margin: 20px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.no-results h3 { 
  margin-bottom: 15px; 
  color: #333; 
  font-size: 1.5rem;
}

.no-results a { 
  color: #dc3545; 
  text-decoration: none; 
  font-weight: 600;
}

.no-results a:hover { 
  text-decoration: underline; 
}

/* Анимации */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.news-card {
  animation: fadeIn 0.5s ease forwards;
}

.news-card:nth-child(odd) {
  animation-delay: 0.1s;
}

.news-card:nth-child(even) {
  animation-delay: 0.2s;
}

/* Адаптивные стили для планшетов и мобильных устройств */
@media (max-width: 768px) {
  html, body { 
    overflow-x: auto; 
  }
  
  .page { 
    padding: 8px; 
    max-width: 100%; 
    box-sizing: border-box; 
  }
  
  .news-title { 
    font-size: 2rem; 
  }
  
  .news-subtitle { 
    font-size: 1rem; 
  }
  
  .news-header { 
    padding: 20px; 
    margin-bottom: 20px; 
  }

  .news-header--compact {
    padding: 14px 16px 12px;
    margin-bottom: 12px;
  }

  .news-header--compact .news-title {
    font-size: 1.35rem;
  }

  .news-header--compact .news-subtitle {
    font-size: 0.88rem;
    margin-bottom: 10px;
  }
  
  .news-grid { 
    grid-template-columns: 1fr; 
    gap: 15px; 
  }
  
  .news-categories { 
    justify-content: flex-start; 
    overflow-x: auto; 
    padding-bottom: 10px; 
    margin-bottom: 20px; 
  }
  
  .category-link { 
    font-size: 0.9rem; 
    padding: 8px 16px; 
  }
  
  .news-stats { 
    gap: 15px; 
  }
  
  .stat-number { 
    font-size: 1.5rem; 
  }
  
  .stat-label { 
    font-size: 0.8rem; 
  }
  
  .news-card-content { 
    padding: 15px; 
  }
  
  .news-card-title { 
    font-size: 1.2rem; 
  }
  
  .news-card-excerpt { 
    font-size: 0.9rem; 
  }
  
  .search-box { 
    margin-bottom: 20px; 
  }
  
  .search-input { 
    padding: 12px 16px; 
    font-size: 0.9rem; 
  }
  
  .rss-section { 
    padding: 20px; 
  }
  
  .rss-title { 
    font-size: 1.3rem; 
  }
  
  .social-subscribe { 
    flex-direction: column; 
    gap: 8px; 
  }
  
  .tg-btn, .vk-btn { 
    width: 100%; 
    text-align: center; 
  }
}

/* Адаптивные стили для очень маленьких экранов */
@media (max-width: 480px) {
  html, body { 
    overflow-x: auto; 
  }
  
  .page { 
    padding: 4px; 
    max-width: 100%; 
    box-sizing: border-box; 
  }
  
  .news-title { 
    font-size: 1.5rem; 
  }
  
  .news-header { 
    padding: 15px; 
  }
  
  .news-card-content { 
    padding: 12px; 
  }
  
  .news-card-title { 
    font-size: 1.1rem; 
  }
  
  .news-card-excerpt { 
    font-size: 0.85rem; 
  }
  
  .news-stats { 
    flex-direction: column; 
    gap: 10px; 
  }
  
  .stat-item { 
    margin-bottom: 10px; 
  }
  
  .news-categories { 
    gap: 8px; 
  }
  
  .category-link { 
    padding: 6px 12px; 
    font-size: 0.8rem; 
  }
  
  .search-input { 
    padding: 10px 12px; 
    font-size: 0.8rem; 
  }
  
  .rss-section { 
    padding: 15px; 
  }
  
  .rss-title { 
    font-size: 1.1rem; 
  }
  
  .rss-description { 
    font-size: 0.9rem; 
  }
  
  .rss-btn { 
    padding: 10px 20px; 
    font-size: 0.9rem; 
  }
}