body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #f5f5f5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #000000;
  color: white;
  padding: 15px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.container {
  flex: 1;
}

.logo {
  height: 70px;
  width: auto;
  object-fit: contain;
}

.menu {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.menu a {
  color: white;
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s;
}

.menu a:hover {
  color: #f39c12;
}

/* Активная ссылка */
.menu a.active {
  color: #f39c12;
  outline: 2px solid rgba(243, 156, 18, 0.15);
  padding: 4px 8px;
  border-radius: 6px;
}

/* Фокус для клавиатуры */
.menu a:focus {
  outline: 3px solid #f39c12;
  outline-offset: 2px;
}

/* Иконка корзины */
.cart-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cart-icon-text {
  font-size: 20px;
}

.cart-count {
  background: #e74c3c;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;

  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 18px;
}

.cart-count:empty,
.cart-count[data-count="0"] {
  display: none;
}

.container {
  max-width: 1400px;
  width: 65vw;
  margin: 20px auto;
  padding: 20px;
}

h1 {
  color: #0f0f0f;
}

.gallery {
  position: relative;
  max-width: 90%;
  height: 300px;
  margin: 20px auto;
  border: 2px dashed #ccc;
  background: #fafafa;
  overflow: hidden;
}

.abs-img {
  position: absolute;
  width: 15%;
  min-width: 80px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s;
}

.img1 {
  top: 50px;
  left: 10%;
  transform: rotate(-15deg);
}
.img2 {
  top: 40px;
  left: 25%;
  transform: rotate(-7deg);
}
.img3 {
  top: 30px;
  left: 40%;
  transform: rotate(0deg);
}
.img4 {
  top: 40px;
  left: 55%;
  transform: rotate(7deg);
}
.img5 {
  top: 50px;
  left: 70%;
  transform: rotate(15deg);
}
.img6 {
  top: 60px;
  left: 80%;
  transform: rotate(20deg);
}

.abs-img:hover {
  transform: scale(1.1) rotate(0deg);
  z-index: 10;
}

.book-card {
  display: flex;
  gap: 30px;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  margin-top: 20px;
  flex-wrap: wrap;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.book-cover {
  width: 250px;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.book-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 18px;
  flex: 1;
}

.buy-btn {
  margin-top: 20px;
  padding: 12px 20px;
  font-size: 16px;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s;
  text-decoration: none;
  display: inline-block;
}

.buy-btn:hover {
  background: #219150;
}

.intro {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 30px;
}

.intro h1 {
  font-size: 28px;
  margin: 0;
  color: #0f0f0f;
}

.intro p {
  font-size: 18px;
  margin: 5px 0 0;
  color: #333;
}

@media (max-width: 768px) {
  .gallery {
    height: 250px;
  }

  .abs-img {
    width: 18%;
  }

  .book-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .book-info {
    font-size: 16px;
  }

  .buy-btn {
    width: 100%;
  }
}

/* ---------- CSS ФИЛЬТР (мульти) ---------- */

/* По умолчанию показываем все карточки */
#books-container .book-card {
  display: flex !important;
}

/* Fallback: если JS добавит класс .no-has, показываем все карточки */
.no-has .book-card {
  display: flex !important;
}

/* Если выбрано "Все" по всем параметрам — показываем всё (с :has — progressive enhancement) */
:has(#all-genre:checked):has(#all-price:checked):has(#all-author:checked)
  .book-card {
  display: flex;
}

/* Комбинации: ЖАНР + ЦЕНА + АВТОР (оставлены как enhancement для поддерживающих браузеров) */
:has(#fantasy:checked):has(#price-low:checked):has(#russian:checked)
  .book-card.fantasy.price-low.russian {
  display: flex;
}
:has(#fantasy:checked):has(#price-high:checked):has(#russian:checked)
  .book-card.fantasy.price-high.russian {
  display: flex;
}
:has(#fantasy:checked):has(#price-low:checked):has(#foreign:checked)
  .book-card.fantasy.price-low.foreign {
  display: flex;
}
:has(#drama:checked):has(#price-low:checked):has(#russian:checked)
  .book-card.drama.price-low.russian {
  display: flex;
}
:has(#drama:checked):has(#price-high:checked):has(#foreign:checked)
  .book-card.drama.price-high.foreign {
  display: flex;
}
:has(#bio:checked):has(#price-high:checked):has(#russian:checked)
  .book-card.bio.price-high.russian {
  display: flex;
}
:has(#romance:checked):has(#price-low:checked):has(#foreign:checked)
  .book-card.romance.price-low.foreign {
  display: flex;
}
:has(#romance:checked):has(#price-high:checked):has(#foreign:checked)
  .book-card.romance.price-high.foreign {
  display: flex;
}

/* ---------- ФОРМА РЕГИСТРАЦИИ ---------- */
.form-wrapper {
  max-width: 500px;
  margin: 50px auto;
  background: #fff;
  padding: 60px 60px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.form-wrapper h1 {
  text-align: center;
  color: #222;
  margin-bottom: 25px;
  margin-top: 0;
}
.necessarily {
  color: red;
}
.form-box {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-box label {
  font-weight: bold;
  font-size: 16px;
  color: #333;
}

.form-box input {
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  transition: border-color 0.3s;
}

.form-box input:focus {
  border-color: #27ae60;
  outline: none;
}

.form-btn {
  margin-top: 10px;
  padding: 12px;
  background: #27ae60;
  color: white;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s;
}

.form-btn:hover {
  background: #219150;
}

@media (max-width: 600px) {
  .form-wrapper {
    margin: 30px 15px;
    padding: 20px;
  }
}
/* добавление глазика  */
.password-input-wrapper {
  position: relative;
  width: 100%;
}
.password-input-wrapper input[type="password"],
.password-input-wrapper input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  padding-right: 40px;
}
.password-eye-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  height: 24px;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.password-eye-btn svg {
  pointer-events: none;
}

/* ---------- ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ДЛЯ ФОРМ АУТЕНТИФИКАЦИИ ---------- */

/* Группа полей формы */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 15px;
}

/* Ряд полей (для имени и фамилии) */
.form-row {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

/* Стили для полей с ошибками */
.form-group input.error {
  border-color: #e74c3c;
  background-color: #fdf2f2;
}

.form-group input.error:focus {
  border-color: #e74c3c;
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

/* Сообщения об ошибках */
.error-message {
  color: #e74c3c;
  font-size: 14px;
  margin-top: 2px;
  display: none;
  font-weight: 500;
  padding: 10px 20px;
}

.error-message:not(:empty) {
  display: block;
}

/* Требования к паролю */
.password-requirements {
  margin-top: 5px;
}

.password-requirements small {
  color: #666;
  font-size: 13px;
}

/* Группа с чекбоксом */
.checkbox-group {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
  margin: 0;
  width: auto;
}

/* Кастомный чекбокс */
.checkbox-label .checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid #ccc;
  border-radius: 3px;
  display: inline-block;
  position: relative;
  transition: all 0.3s;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
  background-color: #27ae60;
  border-color: #27ae60;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark:after {
  content: "✓";
  position: absolute;
  top: -2px;
  left: 3px;
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

/* Подвал формы */
.form-footer {
  text-align: center;
  margin-top: 20px;
}

.form-footer p {
  margin: 8px 0;
  color: #666;
  font-size: 14px;
}

.form-footer a {
  color: #27ae60;
  text-decoration: none;
  font-weight: 500;
}

.form-footer a:hover {
  text-decoration: underline;
}

/* Состояния кнопки загрузки */
.form-btn:disabled {
  background-color: #95a5a6;
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-loader {
  display: none;
}

/* Уведомления */
.notification {
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  border: 1px solid;
}

.notification.success {
  background-color: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
}

.notification.error {
  background-color: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}

.notification.info {
  background-color: #cce7ff;
  color: #004085;
  border-color: #b3d7ff;
}

/* Меню пользователя */
.user-menu {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.user-menu-content {
  padding: 15px;
  min-width: 200px;
}

.user-menu-content p {
  margin: 0 0 10px 0;
  color: #333;
  font-weight: 500;
}

.user-menu-content button {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
}

.user-menu-content button:hover {
  background: #c0392b;
}

/* Адаптивность для форм */
@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .form-row .form-group {
    margin-bottom: 15px;
  }
}

/* ---------- СОСТОЯНИЯ ЗАГРУЗКИ И ОШИБОК ---------- */
.loading {
  text-align: center;
  padding: 40px 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
}

.loading p {
  font-size: 18px;
  color: #666;
  margin: 0;
}

.error {
  text-align: center;
  padding: 40px 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
  border-left: 4px solid #e74c3c;
}

.error h1 {
  color: #e74c3c;
  margin-top: 0;
}

.error p {
  color: #666;
  font-size: 16px;
}

/* Анимация загрузки */
.loading::after {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #f39c12;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Стили для действий с книгами */
.book-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.book-actions .buy-btn {
  margin-top: 0;
}

/* ---------- СТИЛИ ДЛЯ ДИНАМИЧЕСКИХ КНИГ НА ГЛАВНОЙ ---------- */
.book-item {
  cursor: pointer;
  transition: transform 0.3s, z-index 0.3s;
}

.book-item:hover {
  z-index: 15;
}

.book-link {
  display: block;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.book-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.3s;
}

.book-item:hover .book-image {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.book-info {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  min-width: 200px;
  max-width: 300px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
  z-index: 20;
  backdrop-filter: blur(5px);
}

.book-item:hover .book-info {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-15px);
}

.book-title {
  margin: 0 0 5px 0;
  font-size: 14px;
  font-weight: bold;
  color: #333;
  line-height: 1.2;
}

.book-author {
  margin: 0 0 5px 0;
  font-size: 12px;
  color: #666;
  font-style: italic;
}

.book-price {
  margin: 0 0 5px 0;
  font-size: 14px;
  font-weight: bold;
  color: #27ae60;
}

.book-popularity {
  margin: 0;
  font-size: 11px;
  color: #999;
}

.out-of-stock {
  color: #e74c3c;
  font-weight: bold;
  font-size: 11px;
}

.low-stock {
  color: #f39c12;
  font-weight: bold;
  font-size: 11px;
}

/* Стили для состояний загрузки и ошибок в галерее */
.loading-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  font-size: 18px;
  color: #666;
}

.error-message {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  text-align: center;
  color: #e74c3c;
}

.error-message p:first-child {
  font-size: 20px;
  font-weight: bold;
  margin: 0 0 10px 0;
}

.error-message p:last-child {
  font-size: 14px;
  color: #666;
  margin: 0;
}

/* Мобильная адаптация для книжной информации */
@media (max-width: 768px) {
  .book-info {
    min-width: 150px;
    max-width: 200px;
    padding: 8px;
    bottom: -100px;
  }

  .book-title {
    font-size: 12px;
  }

  .book-author,
  .book-price {
    font-size: 11px;
  }

  .book-popularity,
  .out-of-stock,
  .low-stock {
    font-size: 10px;
  }
}

/* ===============================================
   Стили для статистики магазина
   =============================================== */

/* Статистика магазина */
.store-stats {
  margin: 20px 0;
  padding: 15px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  text-align: center;
}

.stat-item {
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px solid #e9ecef;
}

.stat-number {
  font-size: 32px;
  font-weight: bold;
  color: #27ae60;
  margin-bottom: 5px;
}

.stat-label {
  color: #666;
  font-weight: 500;
}

.genres {
  grid-column: span 2;
}

.genres-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
}

.genre-tag {
  background: #e3f2fd;
  color: #1976d2;
  padding: 5px 12px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 500;
}

/* Плейсхолдеры загрузки */
.loading-placeholder {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 40px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #ddd;
}

/* Сообщения об ошибках */
.error-message {
  text-align: center;
  color: #d32f2f;
  padding: 20px;
  background: #ffebee;
  border-radius: 8px;
  border: 2px solid #ffcdd2;
}

.error-message p {
  margin: 10px 0;
}

.error-message button {
  margin-top: 15px;
  padding: 10px 20px;
  background: #1976d2;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.error-message button:hover {
  background: #1565c0;
}

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

  .genres {
    grid-column: span 2;
  }

  .stat-number {
    font-size: 24px;
  }

  .genre-tag {
    font-size: 11px;
    padding: 4px 8px;
  }
}

/* ========== Catalog Page Styles ========== */

/* Filters Section */
.filters-section {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.filters-section h2 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #333;
  font-size: 24px;
}

/* Horizontal filters row */
.filters-row {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 150px;
  flex: 1;
}

.filter-item label {
  font-weight: 600;
  color: #555;
  font-size: 14px;
}

.filter-item select {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  transition: border-color 0.3s, box-shadow 0.3s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-item select:hover {
  border-color: #27ae60;
}

.filter-item select:focus {
  border-color: #27ae60;
  outline: none;
  box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

/* Responsive filters */
@media (max-width: 768px) {
  .filters-row {
    flex-direction: column;
    gap: 15px;
  }

  .filter-item {
    min-width: 100%;
  }
}

@media (max-width: 480px) {
  .filters-section {
    padding: 15px;
  }

  .filters-section h2 {
    font-size: 20px;
    margin-bottom: 15px;
  }
}

.filter-group {
  margin-bottom: 20px;
}

.filter-group h3 {
  margin: 0 0 10px 0;
  color: #555;
  font-size: 16px;
  font-weight: 600;
}

.filter-group label {
  display: block;
  margin-bottom: 8px;
  cursor: pointer;
  padding: 5px 0;
  transition: color 0.2s;
}

.filter-group label:hover {
  color: #27ae60;
}

.filter-group input[type="radio"] {
  margin-right: 8px;
  cursor: pointer;
}

/* Catalog Controls */
.catalog-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 20px;
  background: white;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.left-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.right-controls {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.items-per-page {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.items-per-page label {
  font-weight: 500;
  color: #333;
  white-space: nowrap;
}

.items-control-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.items-per-page select,
.items-per-page input[type="number"] {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  background: white;
  transition: border-color 0.2s;
}

.items-per-page select:hover,
.items-per-page select:focus,
.items-per-page input[type="number"]:hover,
.items-per-page input[type="number"]:focus {
  border-color: #27ae60;
  outline: none;
}

.items-per-page input[type="number"] {
  width: 120px;
  cursor: text;
}

#apply-custom {
  padding: 8px 16px;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
}

#apply-custom:hover {
  background: #219150;
}

#apply-custom:active {
  transform: scale(0.98);
}

.page-info {
  color: #666;
  font-size: 14px;
  white-space: nowrap;
}

/* Books Grid */
.books-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.books-grid .book-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 15px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.books-grid .book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.books-grid .book-cover {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 12px;
}

.books-grid .book-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.books-grid .book-info h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #333;
  line-height: 1.3;
}

.books-grid .book-info p {
  margin: 4px 0;
  font-size: 13px;
  color: #666;
}

.books-grid .book-description {
  flex: 1;
  margin: 8px 0;
  line-height: 1.4;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.books-grid .book-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

.books-grid .btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.2s, transform 0.1s;
}

.books-grid .btn:active {
  transform: scale(0.98);
}

.books-grid .btn-details {
  background: #3498db;
  color: white;
}

.books-grid .btn-details:hover {
  background: #2980b9;
}

.books-grid .btn-order {
  background: #27ae60;
  color: white;
}

.books-grid .btn-order:hover {
  background: #219150;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 6px 10px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  min-width: 35px;
}

.page-btn:hover:not(:disabled) {
  background: #f0f0f0;
  border-color: #27ae60;
}

.page-btn.active {
  background: #27ae60;
  color: white;
  border-color: #27ae60;
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-ellipsis {
  padding: 6px 4px;
  color: #999;
  font-size: 13px;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 40px;
  color: #666;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.no-results p {
  font-size: 18px;
  color: #666;
  margin: 0;
}

/* Error Message */
.error-message {
  text-align: center;
  padding: 10px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.error-message p {
  color: #e74c3c;
  font-size: 16px;
  margin-bottom: 20px;
}

.error-message .btn {
  padding: 10px 20px;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
}

.error-message .btn:hover {
  background: #219150;
}

/* ========== Infinite Scroll Styles ========== */

/* Infinite Scroll Info Panel */
.infinite-scroll-info {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #dee2e6;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.infinite-scroll-info p {
  margin: 0 0 15px 0;
  color: #495057;
  font-size: 15px;
  font-weight: 500;
}

.progress-container {
  margin: 15px 0;
}

.progress-text {
  color: #6c757d;
  font-size: 14px;
  margin-bottom: 8px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 15px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #27ae60 0%, #2ecc71 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

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

.switch-back-btn {
  padding: 10px 20px;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.switch-back-btn:hover {
  background: #5a6268;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.switch-back-btn:active {
  transform: translateY(0);
}

/* Loading More Indicator */
.loading-more-books {
  text-align: center;
  padding: 30px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
}

.loading-more-books p {
  color: #6c757d;
  font-size: 16px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.loading-more-books p::after {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #27ae60;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* End of Catalog */
.end-of-catalog {
  text-align: center;
  padding: 40px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
  border-top: 4px solid #27ae60;
}

.end-of-catalog p:first-child {
  font-size: 18px;
  font-weight: 600;
  color: #27ae60;
  margin: 0 0 10px 0;
}

.end-of-catalog p:last-child {
  color: #6c757d;
  font-size: 14px;
  margin: 0;
}

/* Scroll Sentinel (invisible trigger element) */
.scroll-sentinel {
  height: 1px;
  width: 100%;
  position: relative;
}

/* Animations for new books */
.book-card.fade-in {
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design */
@media (max-width: 1200px) {
  .books-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .catalog-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
    padding: 15px;
  }

  .left-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .right-controls {
    justify-content: center;
  }

  .pagination {
    justify-content: center;
    gap: 5px;
  }

  .page-btn {
    padding: 6px 8px;
    font-size: 12px;
    min-width: 30px;
  }

  .filters-section {
    padding: 15px;
  }

  .books-grid .book-cover {
    height: 240px;
  }

  .books-grid .book-info h3 {
    font-size: 15px;
  }

  .books-grid .book-info p {
    font-size: 12px;
  }
}

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

  .catalog-controls {
    padding: 12px;
  }

  .left-controls {
    gap: 12px;
  }

  .items-per-page {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .items-control-group {
    flex-direction: column;
    gap: 8px;
  }

  .pagination {
    gap: 4px;
  }

  .page-btn {
    padding: 5px 6px;
    font-size: 11px;
    min-width: 28px;
  }

  .books-grid .book-cover {
    height: 280px;
  }

  .books-grid .book-actions {
    flex-direction: column;
  }

  .books-grid .btn {
    width: 100%;
  }

  .books-grid .book-info h3 {
    font-size: 16px;
  }

  .books-grid .book-info p {
    font-size: 13px;
  }

  /* Infinite Scroll Mobile Styles */
  .infinite-scroll-info {
    padding: 15px;
    margin: 15px 0;
  }

  .infinite-scroll-info p {
    font-size: 14px;
  }

  .progress-text {
    font-size: 13px;
  }

  .switch-back-btn {
    padding: 8px 16px;
    font-size: 13px;
  }

  .loading-more-books,
  .end-of-catalog {
    padding: 25px 15px;
    margin: 15px 0;
  }

  .loading-more-books p {
    font-size: 14px;
  }

  .end-of-catalog p:first-child {
    font-size: 16px;
  }
}

/* ========== Book Detail Page ========== */

.breadcrumb {
  margin-bottom: 20px;
  font-size: 14px;
  color: #666;
}

.breadcrumb a {
  color: #27ae60;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.book-detail {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 40px;
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.book-detail-image {
  text-align: center;
}

.book-detail-image img {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.book-detail-info h1 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #333;
  font-size: 28px;
  line-height: 1.3;
}

.book-meta {
  display: grid;
  gap: 12px;
  margin-bottom: 25px;
}

.book-meta-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.book-meta-label {
  font-weight: 600;
  color: #555;
  min-width: 120px;
}

.book-meta-value {
  color: #333;
}

.publisher-link {
  color: #27ae60;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.3s ease;
}

.publisher-link:hover {
  color: #219150;
  text-decoration: underline;
}

.book-price {
  font-size: 24px;
  font-weight: 700;
  color: #27ae60;
  margin: 20px 0;
}

.book-description {
  margin: 25px 0;
  line-height: 1.6;
  color: #555;
}

.book-description h3 {
  margin-bottom: 15px;
  color: #333;
}

.book-actions {
  display: flex;
  gap: 15px;
  margin-top: 30px;
}

.btn-add-to-cart {
  background: #27ae60;
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
  max-width: 200px;
}

.btn-add-to-cart:hover {
  background: #219150;
  transform: translateY(-2px);
}

.btn-add-to-cart:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #95a5a6;
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary:hover {
  background: #7f8c8d;
  transform: translateY(-2px);
}

/* ========== Modal ========== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal.show .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #eee;
  background: #f8f9fa;
}

.modal-header h2 {
  margin: 0;
  color: #333;
  font-size: 22px;
}

.modal-close {
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 25px;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.publisher-info {
  display: grid;
  gap: 15px;
}

.publisher-info-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.publisher-info-label {
  font-weight: 600;
  color: #555;
  min-width: 100px;
  flex-shrink: 0;
}

.publisher-info-value {
  color: #333;
  line-height: 1.5;
}

.publisher-website {
  color: #27ae60;
  text-decoration: none;
}

.publisher-website:hover {
  text-decoration: underline;
}

/* ========== Notifications ========== */

#notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1100;
}

.notification {
  background: #27ae60;
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateX(400px);
  transition: transform 0.3s ease;
  min-width: 300px;
}

.notification.show {
  transform: translateX(0);
}

.notification.error {
  background: #e74c3c;
}

.notification.warning {
  background: #f39c12;
}

.notification.info {
  background: #3498db;
}

/* ========== Responsive Design for Book Detail ========== */

@media (max-width: 768px) {
  .book-detail {
    grid-template-columns: 1fr;
    gap: 25px;
    padding: 20px;
  }

  .book-detail-image img {
    max-width: 300px;
  }

  .book-detail-info h1 {
    font-size: 24px;
  }

  .book-actions {
    flex-direction: column;
  }

  .btn-add-to-cart,
  .btn-secondary {
    max-width: none;
  }

  .modal-content {
    width: 95%;
  }

  .modal-header,
  .modal-body {
    padding: 20px;
  }

  .publisher-info-item {
    flex-direction: column;
    gap: 5px;
  }

  .publisher-info-label {
    min-width: auto;
  }
}

@media (max-width: 480px) {
  .breadcrumb {
    font-size: 12px;
  }

  .book-detail {
    padding: 15px;
  }

  .book-detail-info h1 {
    font-size: 20px;
  }

  .book-meta-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .book-meta-label {
    min-width: auto;
  }

  .btn-add-to-cart,
  .btn-secondary {
    padding: 12px 20px;
    font-size: 14px;
  }

  .notification {
    min-width: auto;
    margin: 0 10px 10px 0;
  }
}

/* ---------- ������� ---------- */
.cart-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: white;
  border-radius: 12px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cart-item-image {
  flex-shrink: 0;
}

.cart-item-image img {
  width: 80px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
}

.cart-item-info {
  flex-grow: 1;
}

.cart-item-info h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: #333;
}

.cart-item-price {
  font-size: 16px;
  font-weight: bold;
  color: #27ae60;
  margin: 5px 0;
}

.cart-item-publisher {
  font-size: 14px;
  color: #666;
  margin: 5px 0;
}

.cart-item-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quantity-controls button {
  width: 30px;
  height: 30px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quantity-controls button:hover:not(:disabled) {
  background: #f0f0f0;
}

.quantity-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quantity {
  font-weight: bold;
  min-width: 30px;
  text-align: center;
}

.item-total {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

.remove-btn {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.remove-btn:hover {
  background: #c0392b;
}

.cart-summary {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-top: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 16px;
}

.summary-row:last-of-type {
  font-size: 20px;
  font-weight: bold;
  color: #27ae60;
  border-top: 1px solid #eee;
  padding-top: 15px;
  margin-top: 15px;
}

.cart-actions {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: all 0.3s;
}

.btn-primary {
  background: #27ae60;
  color: white;
}

.btn-primary:hover {
  background: #219150;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.empty-state h2 {
  color: #666;
  margin-bottom: 15px;
}

.empty-state p {
  color: #999;
  margin-bottom: 25px;
}

@media (max-width: 768px) {
  .cart-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .cart-item-controls {
    flex-direction: row;
    align-items: center;
    width: 100%;
    justify-content: space-between;
  }

  .cart-actions {
    flex-direction: column;
  }
}

/* ---------- ������ ������� � ��������� ---------- */
.cart-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  background: #27ae60;
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.cart-icon:hover {
  background: #219150;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.cart-icon:active {
  transform: translateY(0);
}

.cart-icon-text {
  margin-right: 8px;
  font-size: 14px;
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #e74c3c;
  color: white;
  font-size: 12px;
  font-weight: bold;
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid white;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.cart-count.hidden {
  display: none;
}

/* ������������ ��� ������ ������� */
@media (max-width: 768px) {
  .cart-icon {
    padding: 6px 10px;
    font-size: 13px;
  }

  .cart-icon-text {
    margin-right: 6px;
    font-size: 13px;
  }

  .cart-count {
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .cart-icon-text {
    display: none;
  }

  .cart-icon {
    padding: 8px;
    width: 40px;
    height: 40px;
  }

  .cart-icon::before {
    content: "";
    font-size: 16px;
  }
}

/* --- Стили для футера --- */
.footer {
  background: #222;
  color: #f3f4f6;
  padding: 32px 0 24px 0;
  text-align: center;
  margin-top: 40px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

.footer-contacts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
  font-size: 1.1em;
  align-items: center;
}

.footer-contacts span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-contacts a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-contacts a:hover {
  color: #f39c12;
}

/* --- Уведомления --- */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 16px;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease-in-out;
  max-width: 400px;
}

.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-success {
  background: #10b981;
  color: white;
}

.notification-error {
  background: #ef4444;
  color: white;
}

.notification-info {
  background: #3b82f6;
  color: white;
}

@media (max-width: 768px) {
  .notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}
