/* src/css/styles.css */

/* Общие стили для страницы */
body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f4f5f7;
  color: #333;
}

/* Стили для заголовков */
h1 {
  font-size: 24px;
  margin-bottom: 20px;
  text-align: center;
}

h1 a {
  color: #0079bf;
  text-decoration: none;
  transition: color 0.3s ease;
}

h1 a:hover {
  color: #0056b3;
}

h2 {
  margin-top: 40px;
  margin-bottom: 15px;
  font-size: 20px;
  color: #444;
}

/* --- Контейнер приложения --- */
.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 30px 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

/* Контейнер новостей */
.container-news {
  padding-top: 20px;
}

/* Стили для списка новостей */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.news-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.news-title {
  margin: 0;
  padding: 10px 20px;
  font-size: 24px;
  font-weight: 600;
  color: #0079bf;
  text-decoration: none;
  transition: color 0.3s ease;
}

.news-title:hover {
  color: #0056b3;
}

/* Элемент новости */
.news-item {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 20px;
  background: #f0f0f0;
  border-radius: 8px;
}

/* Заголовок новости */
.news-item__title {
  font-size: 18px;
  font-weight: bold;
}

/* Содержимое новости (изображение и текст) */
.news-item__content {
  display: flex;
  gap: 15px;
  flex: 1;
}

/* Область под изображение */
.news-item__image {
  width: 100px;
  height: 100px;
  background: #ddd;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
}

/* Текст новости */
.news-item__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.news-item__paragraph {
  margin: 0;
  line-height: 1.5;
  color: #666;
}

/* Дата новости */
.news-item__date {
    font-size: 14px;
    border-radius: 4px;
    color: #999;
    margin-top: 0px;
}

/* --- Плейсхолдеры для загрузки (Shimmer Effect) --- */

/* Контейнер, который сам не мерцает */
.news-item.placeholder {
    background: #f0f0f0; 
    pointer-events: none;
}

/* Убираем глобальную анимацию, чтобы не мерцал фон и тени */
.placeholder::before {
    content: none !important; 
}

/* Общие стили для всех мерцающих блоков */
.news-item__title.placeholder,
.news-item__image.placeholder,
.news-item__paragraph.placeholder,
.news-item__date.placeholder {
    background-color: #e0e0e0 !important;
    position: relative;
    overflow: hidden; 
    border: none;
    color: transparent !important;
}

/* Размеры плейсхолдеров */
.news-item__title.placeholder {
  width: 60%;
  height: 48px; /* увеличено до реальной высоты заголовка */
  border-radius: 4px;
  padding: 0;
  margin-bottom: 0px;
}

.news-item__image.placeholder {
  width: 100px;
  height: 100px; 
  border-radius: 4px;
}

.news-item__text.placeholder {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.news-item__paragraph.placeholder {
  height: 60px; 
  width: 95%; 
  border-radius: 4px;
  padding: 0;
  margin: 0px 0;
}

.news-item__date.placeholder {
  display: block;
  height: 20px;
  border-radius: 4px;
  width: 35%;
  margin-top: 0px;
}

/* --- САМА АНИМАЦИЯ МЕРЦАНИЯ (Shimmer) --- */

/* Применяем псевдоэлемент с градиентом только к внутренним блокам */
.news-item__title.placeholder::after,
.news-item__image.placeholder::after,
.news-item__paragraph.placeholder::after,
.news-item__date.placeholder::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 20%,
        rgba(255, 255, 255, 0.6) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shimmer 1.5s linear infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* --- Стили для ошибки --- */
.error {
  text-align: center;
  color: #d9534f;
  padding: 20px;
}

.hidden {
  display: none;
}

/* Кнопка */
#refresh {
  display: block;
  margin-right: 20px;
  padding: 10px 20px;
  font-size: 16px;
  color: #fff;
  background-color: #007bff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#refresh:hover {
  background-color: #0056b3;
}

#refresh:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

