.news-widget {
  max-width: 1200px;
  margin: 0 auto;
  background-image: url(/img/kontrol/methods_bg.png);
  padding: 20px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  height: 1000px; /* 2502px */
  overflow-y: auto;
}

@media (max-width: 768px) {
  .news-widget {
    height: 480px; /* Указано для мобильных с горизонтальным скроллом */
    overflow-y: hidden; /* Горизонтальный скролл в .news-horizontal-scroll */
  }
}

.widget-title {
  margin-top: 0;
  margin-bottom: 20px;
  color: #2c3e50;
  font-size: 1.4rem;
  font-weight: 600;
  text-align: center;
}

.news-tabs .nav-tabs {
  border-bottom: 2px solid #e9ecef !important;
  margin-bottom: 25px;
  display: flex;
  justify-content: center;
}

.news-tabs .nav-tabs > li {
  float: none;
  display: inline-block;
}

.news-tabs .nav-tabs > li > a {
  border: none !important;
  color: #6c757d !important;
  font-weight: 600;
  padding: 12px 24px;
  margin-right: 5px;
  border-radius: 6px 6px 0 0;
  transition: all 0.3s ease;
}

.news-tabs .nav-tabs > li > a:hover {
  background-color: #f8f9fa;
  color: #495057;
}

.news-tabs .nav-tabs > li.active > a,
.news-tabs .nav-tabs > li.active > a:hover,
.news-tabs .nav-tabs > li.active > a:focus {
  border: none !important;
  border-bottom: 3px solid #007bff !important;
  color: #007bff !important;
  background: transparent !important;
}

.tab-content {
  min-height: 2200px; /* Синхронизировано с десктопной высотой минус заголовки/отступы */
  overflow: hidden; /* Предотвращает сдвиги */
}

@media (max-width: 768px) {
  .tab-content {
    min-height: 400px; /* Синхронизировано с мобильной высотой */
  }
}

/* Десктопная версия */
.news-desktop {
  display: block !important;
}

.news-item {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  display: flex;
  align-items: flex-start;
}

.news-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.news-image {
  width: 195px;
  height: 130px;
  object-fit: cover;
  border-radius: 6px;
  margin-right: 20px;
  flex-shrink: 0;
  aspect-ratio: 195 / 130;
}

.news-content {
  flex: 1;
  min-width: 0;
}

.news-publisher {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.publisher-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-right: 8px;
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

.publisher-name {
  font-size: 13px;
  color: #666;
  font-weight: 500;
}

.news-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
}

.news-title a {
  color: #2c3e50;
  text-decoration: none;
  transition: color 0.2s ease;
}

.news-title a:hover {
  color: #007bff;
  text-decoration: underline;
}

.news-description {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 10px;
}

.news-time {
  color: #999;
  font-size: 12px;
  font-weight: 500;
}

/* Мобильная версия */
.news-mobile {
  display: none !important;
}

.news-horizontal-scroll {
  display: flex;
  overflow-x: auto;
  padding: 10px 5px 20px 5px;
  scrollbar-width: thin;
  scroll-behavior: smooth;
  gap: 15px;
}

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

.news-horizontal-scroll::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

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

.news-card-mobile {
  flex: 0 0 230px; /* Уточнено под новые размеры изображений */
  background: white;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease;
}

.news-card-mobile:hover {
  transform: translateY(-1px);
}

.news-image-mobile {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 12px;
  aspect-ratio: 230 / 140; /* Уточнено */
}

.publisher-name-mobile {
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

.news-title-mobile {
  font-size: 14px;
  font-weight: 600;
  margin: 8px 0;
  line-height: 1.3;
}

.news-title-mobile a {
  color: #2c3e50;
  text-decoration: none;
}

.news-title-mobile a:hover {
  color: #007bff;
}

.news-time-mobile {
  color: #999;
  font-size: 11px;
}

.no-news-message {
  text-align: center;
  color: #999;
  padding: 60px 20px;
  font-style: italic;
  min-height: 400px; /* Синхронизировано с мобильной .tab-content */
}

/* Адаптивность */
@media (max-width: 768px) {
  .news-widget {
    padding: 15px;
    margin-bottom: 4px;
  }

  .widget-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
  }

  .news-tabs .nav-tabs {
    flex-wrap: wrap;
    margin-bottom: 5px;
  }

  .news-tabs .nav-tabs > li {
    margin-bottom: 5px;
  }

  .news-tabs .nav-tabs > li > a {
    padding: 10px 15px;
    font-size: 14px;
  }

  .news-desktop {
    display: none !important;
  }

  .news-mobile {
    display: block !important;
  }

  .news-card-mobile {
    flex: 0 0 230px; /* Уточнено */
  }
}

@media (max-width: 480px) {
  .news-widget {
    padding: 12px;
  }

  .news-card-mobile {
    flex: 0 0 200px; /* Уменьшено для меньших экранов */
    padding: 12px;
  }

  .news-image-mobile {
    height: 120px;
    aspect-ratio: 200 / 120; /* Уточнено для меньших экранов */
  }
}

/* Состояние загрузки */
.news-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Анимации */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.news-item,
.news-card-mobile {
  animation: fadeIn 0.3s ease;
}

/* Безопасные области для iPhone X+ */
@supports (padding: max(0px)) {
  .news-widget {
    padding-left: max(15px, env(safe-area-inset-left));
    padding-right: max(15px, env(safe-area-inset-right));
  }
}

/* Skeleton анимация */
.news-image-loading {
  width: 195px;
  height: 130px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

.news-image-mobile-loading {
  width: 100%;
  height: 140px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@media (max-width: 480px) {
  .news-image-mobile-loading {
    height: 120px;
  }
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
