/* resources/css/forum.css */

/* === Общая структура === */
.forum-page {
  background: linear-gradient(180deg, #f8f5f0 0%, #ffffff 100%);
  min-height: 100vh;
}

.forum-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* === Хлебные крошки === */
.forum-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: #64748b;
}

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

.forum-breadcrumbs a:hover {
  color: #3a6347;
  text-decoration: underline;
}

.forum-breadcrumbs span {
  color: #94a3b8;
}

/* === Шапка форума === */
.forum-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

@media (min-width: 768px) {
  .forum-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.forum-title-group h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 0.25rem;
}

.forum-title-group p {
  color: #64748b;
  font-size: 0.95rem;
}

.forum-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* === Поиск === */
.forum-search {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.forum-search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 50px;
  font-size: 0.95rem;
  background: #f8f5f0;
  transition: all 0.2s ease;
}

.forum-search-input:focus {
  outline: none;
  border-color: #4a7c59;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.1);
}

.forum-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #94a3b8;
}

/* === Кнопки === */
.btn-forum-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #4a7c59 0%, #3a6347 100%);
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-forum-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(74, 124, 89, 0.3);
  background: linear-gradient(135deg, #3a6347 0%, #2d4d38 100%);
}

.btn-forum-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #ffffff;
  color: #4a7c59;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  border: 2px solid #4a7c59;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn-forum-secondary:hover {
  background: #4a7c59;
  color: #ffffff;
}

/* === Фильтры и сортировка === */
.forum-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.filter-chip {
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  background: #f1f5f9;
  color: #64748b;
}

.filter-chip:hover,
.filter-chip.active {
  background: #4a7c59;
  color: #ffffff;
}

.forum-sort {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #64748b;
}

.forum-sort select {
  padding: 0.5rem 2rem 0.5rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  font-size: 0.9rem;
  color: #2d3748;
  cursor: pointer;
}

/* === Категории форума === */
.forum-categories {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.category-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  transition: all 0.3s ease;
}

.category-card:hover {
  border-color: #4a7c59;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.category-header {
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #f8f5f0 0%, #ffffff 100%);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.category-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.category-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4a7c59 0%, #3a6347 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.25rem;
}

.category-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
}

.category-description {
  font-size: 0.9rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.category-stats {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: #64748b;
}

.category-stats span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.category-toggle {
  width: 24px;
  height: 24px;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.category-toggle.expanded {
  transform: rotate(180deg);
}

/* === Список тем === */
.category-topics {
  display: none;
  padding: 0.5rem;
}

.category-topics.expanded {
  display: block;
}

.topic-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.topic-item:hover {
  background: #fafafa;
}

.topic-item:last-child {
  border-bottom: none;
}

.topic-item.topic-closed {
  opacity: 0.7;
  background: #fafafa;
}

.topic-item.topic-closed:hover {
  background: #f5f5f5;
}

.topic-item.topic-closed .topic-title {
  color: #94a3b8;
}

/* Индикатор нового */
.topic-indicator {
  display: flex;
  align-items: center;
}

.topic-indicator.new::before {
  content: '';
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

/* Заголовок темы */
.topic-main {
  min-width: 0;
}

.topic-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.topic-title {
  font-weight: 500;
  color: #2d3748;
  font-size: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.topic-title:hover {
  color: #4a7c59;
}

.topic-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.topic-tag {
  padding: 0.2rem 0.5rem;
  background: #f1f5f9;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #64748b;
}

.topic-tag.pinned {
  background: #fef3c7;
  color: #92400e;
}

.topic-tag.hot {
  background: #fee2e2;
  color: #b91c1c;
}

.topic-tag.locked {
  background: #fee2e2;
  color: #dc2626;
}

.topic-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

.topic-author {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #64748b;
}

.topic-author-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a7c59, #3a6347);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Статистика темы */
.topic-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  text-align: right;
  font-size: 0.85rem;
  color: #64748b;
}

.topic-stat-value {
  font-weight: 600;
  color: #2d3748;
}

.topic-last-post {
  font-size: 0.8rem;
  color: #94a3b8;
}

.topic-last-post a {
  color: #4a7c59;
  text-decoration: none;
}

.topic-last-post a:hover {
  text-decoration: underline;
}

/* === Пагинация === */
.forum-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 2rem 0;
}

.pagination-btn {
  padding: 0.5rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #64748b;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.pagination-btn:hover,
.pagination-btn.active {
  background: #4a7c59;
  border-color: #4a7c59;
  color: #ffffff;
}

.pagination-ellipsis {
  color: #94a3b8;
  padding: 0.5rem;
}

/* === Пустое состояние === */
.forum-empty {
  text-align: center;
  padding: 4rem 2rem;
  background: #ffffff;
  border-radius: 16px;
  border: 1px dashed #e2e8f0;
}

.forum-empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.forum-empty-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.forum-empty-text {
  color: #64748b;
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* === Мобильная адаптация === */
@media (max-width: 768px) {
  .topic-item {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .topic-stats {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }

  .forum-actions {
    width: 100%;
    justify-content: space-between;
  }

  .forum-search {
    max-width: 100%;
  }

  .forum-filters {
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }

  .forum-sort {
    margin-left: 0;
    width: 100%;
  }

  .forum-sort select {
    width: 100%;
  }
}

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

.category-card,
.topic-item {
  animation: fadeIn 0.4s ease forwards;
  opacity: 0;
}

.category-card:nth-child(1) { animation-delay: 0.1s; }
.category-card:nth-child(2) { animation-delay: 0.2s; }
.category-card:nth-child(3) { animation-delay: 0.3s; }
.category-card:nth-child(4) { animation-delay: 0.4s; }
.category-card:nth-child(5) { animation-delay: 0.5s; }
.category-card:nth-child(6) { animation-delay: 0.6s; }
