/* Стили для страницы изображения */
.image-page {
  padding-top: 80px;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
  padding-bottom: 40px;
}

.image-container {
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin-bottom: 40px;
  box-shadow: none;
}

.image-container img {
  width: 100%;
  max-height: 50vh;
  object-fit: contain;
  border-radius: 0;
  margin-bottom: 20px;
}

.image-container h1 {
  font-size: 24px;
  margin-bottom: 30px;
  text-align: center;
  color: #333;
  margin-top: 18px; /* Добавлен верхний отступ для отделения от картинки */
}

/* Кнопки действий */
.action-buttons {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 16px 0;
}

.action-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  text-align: center;
  min-width: 160px;
  justify-content: center;
}

/* Apply flex and center alignment to the text span */
.action-button span {
    display: flex;
    align-items: center;
    transform: translateY(1px);
}

.action-button svg, .action-button span, .action-button span img {
  vertical-align: middle;
}

.share-button {
  background-color: #1976d2;
  color: white;
  border: none;
}

.share-button:hover {
  background-color: #0d47a1;
}

.download-button {
  background-color: #1976d2;
  color: white;
  border: none;
}

.download-button:hover {
  background-color: #0d47a1;
}

/* Секция похожих изображений */
.related-images {
  margin-top: 20px;
}

.related-images h2 {
  font-size: 20px;
  margin-bottom: 20px;
  color: #333;
  text-align: center;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  justify-content: center;
  margin: 0 auto;
  max-width: 1200px;
}

.adsense-container {
  width: 100%;
  max-width: 1200px;
  margin: 20px auto;
  background: #f3f3f3;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.related-grid > div {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.related-grid > div:hover {
  transform: scale(1.05);
}

.related-grid > div img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Адаптивность */
@media (max-width: 1200px) {
  .related-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 800px;
  }
  .adsense-container {
    max-width: 800px;
  }
}

@media (max-width: 768px) {
  .image-page {
    padding-top: 70px;
    padding-left: 8px;
    padding-right: 8px;
    padding-bottom: 12px;
  }

  .action-buttons {
    flex-direction: column;
    gap: 16px;
    align-items: center;
  }

  .action-button {
    width: 100%;
    max-width: 300px;
    justify-content: center;
  }

  .related-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 100vw;
  }
  .adsense-container {
    max-width: 100vw;
  }

  .image-container img {
    margin-bottom: 0px; /* Исправлено: убран отрицательный отступ, чтобы не было наложения */
  }

  .image-container h1 {
    margin-bottom: 24px;
    margin-top: 14px; /* Добавлен верхний отступ для мобильных */
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .image-page {
    padding-top: 90px;
    padding-left: 8px;
    padding-right: 8px;
    padding-bottom: 12px;
  }
  .image-container img {
    max-height: 80vh;
    width: 95vw;
    max-width: none;
    margin-bottom: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
  }
  .action-buttons {
    flex-direction: row;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
  }
  .action-button {
    width: 160px;
    min-width: 160px;
    max-width: 160px;
    flex: none;
    font-size: 15px;
    padding: 10px 0;
    box-sizing: border-box;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
  }
  .action-button {
    min-height: 52px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
  }
  .image-container h1 {
    font-size: 1.1em;
    margin-bottom: 12px;
  }
  .related-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

