/* Стили для страницы коллекций в новом дизайне */

/* Основные переменные для цветов */
:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  --primary: 211 100% 55%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 222.2 84% 4.9%;
  --radius: 0.5rem;
}

/* Основные стили */
body {
  background-color: #f9fafb;
  color: #111827;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

/* Контейнер для страницы */
.collections-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  box-sizing: border-box;
}

/* Заголовок страницы */
.collections-header-section {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid hsl(var(--border));
}

.collections-main-title {
  font-size: 2rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.collections-subtitle {
  font-size: 1rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 1rem;
}

/* Сетка для основного контента и боковой панели */
.collections-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.collections-main {
  flex: 1;
  min-width: 0; /* Предотвращает переполнение */
  max-width: calc(100% - 350px); /* Максимальная ширина основного контента */
}

.collections-sidebar {
  width: 320px;
  flex-shrink: 0;
}

@media (max-width: 992px) {
  .collections-grid {
    flex-direction: column;
  }
  
  .collections-main {
    max-width: 100%;
  }
  
  .collections-sidebar {
    width: 100%;
    margin-top: 2rem;
  }
}

/* Сетка коллекций */
.collections-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
}

/* Карточка коллекции */
.collection-card {
  display: flex;
  flex-direction: column;
  border-radius: 0.5rem;
  background-color: #ffffff;
  color: #333333;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  overflow: hidden;
  height: 100%;
  position: relative;
}

.collection-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Контент коллекции */
.collection-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.collection-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
}

.collection-title a {
  color: #333333;
  text-decoration: none;
}

.collection-title a:hover {
  color: #3b82f6;
}

.collection-stats {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: #6b7280;
}

.collection-stat {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.collection-stat-icon {
  width: 0.875rem;
  height: 0.875rem;
}

.collection-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #f59e0b;
}

.collection-comments {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #9ca3af;
}

.collection-comments a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #9ca3af;
  text-decoration: none;
}

.collection-comments a:hover {
  color: #3b82f6;
}

/* Книги в коллекции */
.collection-books {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1rem;
  position: relative;
  height: 150px;
}

.book-thumbnail {
  position: absolute;
  width: 80px;
  height: 120px;
  overflow: hidden;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.book-thumbnail:nth-child(1) {
  transform: rotate(-10deg) translateX(-30px);
  z-index: 3;
}

.book-thumbnail:nth-child(2) {
  transform: rotate(0deg);
  z-index: 2;
}

.book-thumbnail:nth-child(3) {
  transform: rotate(10deg) translateX(30px);
  z-index: 1;
}

.book-thumbnail:hover {
  transform: translateY(-10px) rotate(0);
  z-index: 10;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.book-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-thumbnail .icons {
  position: absolute;
  top: 0;
  right: 0;
}

.book-thumbnail .icon {
  width: 25px;
  height: 25px;
  background-size: cover;
  display: inline-block;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  .collections-list {
    grid-template-columns: 1fr;
  }
}

/* Пагинация */
.collections-pagination {
  display: flex;
  justify-content: center;
  margin: 1rem 0 !important;
}

/* Стили для пагинации */
.pagination {
  display: flex;
  justify-content: center;
  /*margin: 1.5rem 0;*/
  margin: 0;
  box-sizing: border-box;
  flex-wrap: wrap;
}

.pagination ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0.25rem;
  max-width: 100%;
}

.pagination li {
  margin: 0 0 0.25rem 0;
}

.pagination a, .pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.pagination a {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
}

.pagination a:hover {
  background-color: hsl(var(--accent));
}

.pagination .active a {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

.pagination .disabled span {
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  cursor: not-allowed;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  .pagination a, .pagination span {
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.25rem;
    font-size: 0.75rem;
  }
  
  .collections-list {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
}

@media (max-width: 480px) {
  .collections-list {
    grid-template-columns: 1fr;
  }
}

/* Боковая панель */
.collections-sidebar {
  position: sticky;
  top: 2rem;
}

.sidebar-card {
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--card));
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sidebar-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: hsl(var(--foreground));
  padding-bottom: 0.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

/* Форма поиска */
.search-form {
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: hsl(var(--foreground));
}

.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.2);
}

/* Стили для MagicSuggest */
.ms-ctn .ms-sel-ctn {
  margin-left: 0;
  padding-left: 0;
}

.ms-ctn {
  border-radius: 0.375rem;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  padding: 0.25rem 0.5rem;
}

.ms-ctn-focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.ms-ctn input {
  padding: 0.25rem;
  font-size: 0.875rem;
  color: #333333;
}

.ms-sel-ctn .ms-sel-item {
  margin: 2px 5px 2px 0;
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 0.25rem;
}

.ms-res-ctn {
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 0.375rem 0.375rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.ms-res-ctn .ms-res-item {
  padding: 0.5rem 0.75rem;
  color: #374151;
}

.ms-res-ctn .ms-res-item-active {
  background-color: #f3f4f6;
}

.ms-res-ctn .ms-res-group {
  background: #f9fafb;
  color: #111827;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
}

.form-select {
  width: 100%;
  height: 38px;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  color: #333333;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23333333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1rem;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.form-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-select::-ms-expand {
  display: none;
}

/* Стили для выпадающих списков */
select.form-select option {
  padding: 0.5rem;
  font-size: 0.875rem;
  background-color: #ffffff;
  color: #333333;
}

/* Исправление для Firefox */
@-moz-document url-prefix() {
  .form-select {
    text-indent: 0.01px;
    text-overflow: '';
    padding-right: 1rem;
  }
}

/* Исправление для IE */
select::-ms-expand {
  display: none;
}

.form-radio-group {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.form-radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* Кнопки */
.collections-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
  height: 40px;
  box-sizing: border-box;
  text-decoration: none;
}

.collections-button-primary {
  background-color: #3b82f6;
  color: #ffffff;
  border: none;
}

.collections-button-primary:hover {
  background-color: #2563eb;
}

.collections-button-secondary {
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #374151;
}

.collections-button-secondary:hover {
  background-color: #e5e7eb;
}

.collections-button-danger {
  background-color: #ef4444;
  color: #ffffff;
  border: none;
}

.collections-button-danger:hover {
  background-color: #dc2626;
}

.collections-button-icon {
  width: 1rem;
  height: 1rem;
}

/* Уведомление о скрытой коллекции */
.collection-hidden-notice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fbbf24;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.collection-hidden-notice svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* Стили для блока кнопок в форме поиска */
.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.form-actions .collections-button {
  width: 100%;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.form-actions .collections-button-icon {
  position: absolute;
  left: 1rem;
}

/* Для кнопки "Показать/скрыть расширенные фильтры" */
#toggle-filters-button {
  width: 100%;
}

/* Страница отдельной коллекции */
.collection-detail {
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--card));
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.collection-detail-header {
  display: flex;
  margin-bottom: 2rem;
}

.collection-detail-image {
  width: 250px;
  height: 250px;
  object-fit: cover;
  border-radius: 0.5rem;
  margin-right: 2rem;
}

.collection-detail-info {
  flex-grow: 1;
}

.collection-detail-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: hsl(var(--foreground));
}

.collection-detail-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  margin-bottom: 1.5rem;
}

.collection-detail-meta-label {
  font-weight: 600;
  color: hsl(var(--foreground));
}

.collection-detail-meta-value {
  color: hsl(var(--muted-foreground));
}

.collection-detail-description {
  margin-bottom: 1.5rem;
}

.collection-detail-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

/* Таблица книг в коллекции */
.collection-books-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

.collection-books-table th,
.collection-books-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
}

.collection-books-table th {
  font-weight: 600;
  color: hsl(var(--foreground));
  background-color: hsl(var(--muted));
}

.collection-books-table tr:hover {
  background-color: hsl(var(--muted) / 0.5);
}

.collection-books-table .book-cover {
  width: 50px;
  height: 70px;
  object-fit: cover;
  border-radius: 0.25rem;
}

.collection-books-table .book-title {
  font-weight: 500;
}

.collection-books-table .book-title a {
  color: hsl(var(--foreground));
  text-decoration: none;
}

.collection-books-table .book-title a:hover {
  color: hsl(var(--primary));
}

.collection-books-table .book-author {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.collection-books-table .book-actions {
  display: flex;
  gap: 0.5rem;
}

/* Форма добавления книги */
.add-book-form {
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--card));
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.add-book-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: hsl(var(--foreground));
}

.add-book-input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.add-book-input {
  flex-grow: 1;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 0.875rem;
}

.add-book-input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.2);
}

.add-book-help {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}

/* Таблица голосов */
.votes-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

.votes-table th,
.votes-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
}

.votes-table th {
  font-weight: 600;
  color: hsl(var(--foreground));
  background-color: hsl(var(--muted));
}

.votes-table tr:hover {
  background-color: hsl(var(--muted) / 0.5);
}

/* Адаптивность */
@media (max-width: 768px) {
  .collection-detail-header {
    flex-direction: column;
  }
  
  .collection-detail-image {
    width: 100%;
    height: auto;
    margin-right: 0;
    margin-bottom: 1.5rem;
  }
  
  .collection-books-table {
    display: block;
    overflow-x: auto;
  }
}
