/* public/css/posts-index.css */

/* === Контейнер страницы === */
.posts-index-page {
  background: linear-gradient(180deg, #f8f5f0 0%, #ffffff 100%);
  min-height: 100vh;
  padding: 2rem 1rem;
}

.posts-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* === Навигация === */
.posts-nav {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: #64748b;
}

.posts-nav a {
  color: #4a7c59;
  text-decoration: none;
  transition: color 0.2s ease;
}

.posts-nav a:hover {
  color: #3a6347;
  text-decoration: underline;
}

.posts-nav span {
  color: #94a3b8;
  margin: 0 0.25rem;
}

/* === Заголовок и фильтры === */
.posts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.posts-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: #2d3748;
  margin: 0;
}

.posts-filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-select {
  padding: 0.625rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 50px;
  font-size: 0.9rem;
  background: #ffffff;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.filter-select:hover {
  border-color: #4a7c59;
}

.filter-select:focus {
  border-color: #4a7c59;
  box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.1);
}

/* === Сетка постов === */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .posts-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* === Карточка поста === */
.post-card {
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
  text-decoration: none;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* Изображение поста */
.post-card-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  overflow: hidden;
  background: #f1f5f9;
}

.post-card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.post-card:hover .post-card-image {
  transform: scale(1.08);
}

.post-card-type {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.post-card-type.blog {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.post-card-type.forum {
  background: linear-gradient(135deg, #4a7c59 0%, #3a6347 100%);
}

/* Контент карточки */
.post-card-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.post-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #2d3748;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-category {
  font-size: 0.8rem;
  color: #4a7c59;
  font-weight: 500;
  background: #f0f7f4;
  padding: 0.25rem 0.625rem;
  border-radius: 50px;
  align-self: flex-start;
}

/* Мета информация */
.post-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.post-card-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #64748b;
}

.post-card-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, #c9a961 0%, #a08040 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #ffffff;
  border: 2px solid #e2e8f0;
}

.post-card-stats {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #64748b;
}

.post-card-date {
  font-size: 0.8rem;
  color: #94a3b8;
}

/* === Пагинация === */
.posts-pagination {
  margin-top: 2.5rem;
  display: flex;
  justify-content: center;
}

.posts-pagination nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.posts-pagination a,
.posts-pagination span {
  padding: 0.5rem 0.875rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-decoration: none;
  color: #374151;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.posts-pagination a:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.posts-pagination .active {
  background: linear-gradient(135deg, #4a7c59 0%, #3a6347 100%);
  color: #ffffff;
  border-color: #4a7c59;
}

.posts-pagination .disabled {
  color: #cbd5e1;
  cursor: not-allowed;
}

/* === Пустое состояние === */
.posts-empty {
  text-align: center;
  padding: 4rem 1rem;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.posts-empty svg {
  margin-bottom: 1rem;
}

.posts-empty h2 {
  margin: 0.5rem 0;
}

.posts-empty p {
  color: #64748b;
  margin-bottom: 1.5rem;
}

.btn-clear-filters {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #4a7c59 0%, #3a6347 100%);
  color: #ffffff;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-clear-filters:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(74, 124, 89, 0.3);
}

/* === Адаптивность === */
@media (max-width: 640px) {
  .posts-index-page {
    padding: 1rem;
  }

  .posts-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .posts-filters {
    width: 100%;
  }

  .filter-select {
    flex: 1;
  }

  .post-card-meta {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .post-card-stats {
    margin-left: auto;
  }
}
