/* ====================== */
/* БАЗОВЫЕ СТИЛИ И РЕСЕТ */
/* ====================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Arial", sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: #141414;
  color: #333;
  line-height: 1.6;
  overflow-x: hidden;
}

body.menu-open {
  overflow: hidden;
  padding-right: 15px;
}

/* ====================== */
/* ШАПКА САЙТА */
/* ====================== */
/* ШАПКА САЙТА - Перенесено в header.css */

body.project-page {
  padding-top: 60px;
}

/* ====================== */
/* БУРГЕР-МЕНЮ */
/* ====================== */
/* БУРГЕР-МЕНЮ - Перенесено в header.css */

/* ====================== */
/* БОКОВОЕ МЕНЮ */
/* ====================== */
/* БОКОВОЕ МЕНЮ - Перенесено в header.css */

/* ====================== */
/* КАТАЛОГ ПРОЕКТОВ */
/* ====================== */
.projects-catalog {
  padding: 25px 20px 60px;
  max-width: 1700px;
  margin: 0 auto;
  background: #141414;
  color: white;
}

.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  flex-wrap: wrap;
  gap: 20px;
}

.catalog-header h1 {
  font-size: 2.5rem;
  color: #dab672;
}

.catalog-container {
  display: flex;
  gap: 40px;
}

.filters-sidebar {
  flex: 0 0 280px;
  background: #1a1a1a;
  border-radius: 10px;
  padding: 25px;
  height: fit-content;
  border: 1px solid #333;
}

.filter-group {
  margin-bottom: 30px;
}

.filter-group h3 {
  color: #dab672;
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.filter-button {
  padding: 10px 15px;
  background: transparent;
  color: #aaa;
  border: 2px dashed #333;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  min-width: 80px;
  text-align: center;
  white-space: normal;
}

.filter-button:hover {
  border-color: #555;
  color: #fff;
}

.filter-button.active {
  border: 2px solid #dab672;
  color: #dab672;
  background: rgba(218, 182, 114, 0.1);
  box-shadow: 0 0 10px rgba(218, 182, 114, 0.3);
}

/* СЛАЙДЕР ДИАПАЗОНА */
.range-slider {
  position: relative;
  height: 5px;
  background: #333;
  border-radius: 5px;
  margin-top: 15px;
  margin-left: 0;
  margin-right: 0;
}

.slider-track {
  position: absolute;
  height: 100%;
  background: #dab672;
  border-radius: 5px;
  z-index: 1;
  left: 0;
  right: 0;
}

.range-slider input[type="range"] {
  position: absolute;
  top: -5px;
  left: -9px;
  width: calc(100% + 18px);
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  pointer-events: none;
  z-index: 2;
  margin: 0;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dab672;
  border: 2px solid #222;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.3s;
  position: relative;
  z-index: 3;
}

.range-slider input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 5px rgba(218, 182, 114, 0.2);
}

.range-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dab672;
  border: 2px solid #222;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.3s;
  position: relative;
  z-index: 3;
}

.slider-min,
.slider-max {
  position: absolute;
}

.range-values {
  display: flex;
  justify-content: space-between;
  color: #aaa;
  font-size: 0.9rem;
  margin-bottom: 5px;
}

/* КНОПКА СБРОСА */
.btn-reset {
  width: 100%;
  padding: 12px;
  background: #333;
  color: #dab672;
  border: 1px solid #dab672;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-reset:hover {
  background: rgba(218, 182, 114, 0.1);
}

/* ПОИСК */
.search-container {
  position: relative;
  width: 100%;
  max-width: 400px;
}

#search-input {
  width: 100%;
  padding: 12px 20px 12px 45px;
  border-radius: 30px;
  border: 1px solid #333;
  background: #222;
  color: white;
  font-size: 1rem;
  transition: all 0.3s;
}

#search-input:focus {
  outline: none;
  border-color: #dab672;
  box-shadow: 0 0 0 2px rgba(218, 182, 114, 0.3);
}

.search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  fill: #aaa;
}

/* ====================== */
/* СТИЛИ ДЛЯ ЭЛЕМЕНТОВ КОРЗИНЫ (отсутствующие в catalog.css) */
/* ====================== */

/* ЭЛЕМЕНТЫ КОРЗИНЫ - Перенесено в header.css */

/* Стили для водяных знаков (если используются) */
.watermark-upload.required,
.watermark-text.required {
  border: 2px solid #e74c3c;
  border-radius: 8px;
  padding: 8px;
}

.required-label {
  color: #e74c3c;
  font-weight: bold;
}

.filename-truncate {
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin: 8px auto 0;
  text-align: center;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-size: 0.9em;
}

/* СЕТКА ПРОЕКТОВ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  margin-bottom: 30px;
  max-height: 900px;
  width: 1500px;
  padding-top: 5px
}

.projects-row {
  display: contents;
  flex-wrap: wrap;
  margin-bottom: 25px;
  gap: 25px;
  width: 100%;
}

/* КАРТОЧКИ ПРОЕКТОВ */
.catalog-card {
  flex: 1;
  min-width: calc(33.33% - 25px);
  background: #2a2a2a;
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid #333;
  display: flex;
  flex-direction: column;
  height: auto;
  align-self: start;

}

.catalog-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  border-color: #dab672;

}

.project-image-container {
  position: relative;
  height: 250px;
  overflow: hidden;

}

.project-image-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.5s ease;

}

.project-area {
  position: absolute;
  bottom: 15px;
  left: 15px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  backdrop-filter: blur(2px);
  z-index: 10;
}

.project-title-container {
  padding: 10px 15px 10px;
}

.project-title-name {
  font-size: 1.2rem;
  color: #ffffff;
  margin: 0;
  text-align: center;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.catalog-card:hover .project-title-name {
  color: #dab672;
}

.project-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: linear-gradient(135deg,
      rgba(40, 40, 40, 0.8),
      rgba(30, 30, 30, 0.9));
  backdrop-filter: blur(4px);
  border: 1px solid rgba(218, 182, 114, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  margin-bottom: 15px;
  position: relative;
  overflow: hidden;
  align-items: center;
}

.project-meta::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #dab672, transparent);
}

.project-includes {
  color: #ccc;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.project-price {
  color: #dab672;
  font-weight: bold;
  white-space: nowrap;
  flex-shrink: 0;
}

.project-info {
  padding: 15px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* КНОПКА ДОБАВЛЕНИЯ В КОРЗИНУ */
.add-to-cart {
  display: block;
  width: 100%;
  padding: 10px;
  background: #dab672;
  color: #000;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
  margin-top: auto;
}

.add-to-cart:hover {
  background: #c9a45e;
}

.add-to-cart.in-cart {
  background: #333;
  border: 1px solid #dab672;
  color: #dab672;
}

.add-to-cart.in-cart:hover {
  background: #444;
}

/* ПАГИНАЦИЯ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  /* Ensure vertical alignment */
  gap: 10px;
  margin-top: 50px;
  margin-left: 0;
}

#page-numbers {
  display: flex;
  gap: 5px;
}

.pagination-button,
.page-number {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #2a2a2a;
  color: #fff;
  border: 1px solid #333;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 600;
  padding: 0;
  font-size: 1rem;
}

.pagination-button:hover:not(:disabled),
.page-number:hover:not(.active) {
  background: #333;
  color: #dab672;
  border-color: #dab672;
}

.page-number.active {
  background: #dab672;
  color: #000;
  border-color: #dab672;
}

.pagination-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #222;
  color: #555;
  border-color: #333;
}

/* КАСТОМНЫЙ ПРОЕКТ */
.custom-project-container-catalog {
  max-width: 1700px;
  margin: 0 auto;
  width: 100%;
  max-height: 500px;
  height: 100%;
}

.custom-project-cta {
  background: #222;
  border-radius: 10px;
  padding: 25px;
  margin: 40px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #333;
  gap: 40px;
}

.cta-content {
  flex: 1;
}

.cta-content h3 {
  color: #dab672;
  font-size: 2rem;
  margin-bottom: 20px;
}

.cta-content p {
  color: #ccc;
  font-size: 1.2rem;
  margin-bottom: 30px;
  line-height: 1.6;
}

.btn-custom {
  display: inline-block;
  background: #dab672;
  color: #000;
  font-weight: bold;
  padding: 15px 40px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.btn-custom:hover {
  background: transparent;
  color: #dab672;
  border-color: #dab672;
  transform: translateY(-3px);
}

.cta-image {
  flex: 1;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.cta-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.5s ease;
}

.custom-project-cta:hover .cta-image img {
  transform: scale(1.05);
}

/* ====================== */
/* КОРЗИНА */
/* ====================== */
/* ВИДЖЕТ КОРЗИНЫ - Перенесено в header.css */

/* ====================== */
/* ВИДЖЕТ МЕССЕНДЖЕРОВ - Перенесено в footer.css */

/* ====================== */
/* ПОДВАЛ (FOOTER) */
/* ====================== */
footer {
  background: #0f0f0f;
  color: #aaa;
  padding: 60px 20px 0;
  border-top: 1px solid #222;
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  padding-bottom: 40px;
}

.footer-column {
  flex: 1;
  min-width: 250px;
}

.footer-column h3 {
  color: #dab672;
  font-size: 1.8rem;
  margin-bottom: 20px;
}

.footer-column h4 {
  color: #fff;
  font-size: 1.3rem;
  margin-bottom: 20px;
  position: relative;
  padding-bottom: 10px;
}

.footer-column h4::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 2px;
  background: #dab672;
}

.footer-column p {
  line-height: 1.7;
  margin-bottom: 20px;
}

.footer-column ul {
  list-style: none;
  padding: 0;
}

.footer-column ul li {
  margin-bottom: 12px;
  position: relative;
  padding-left: 20px;
}

.footer-column ul li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #dab672;
}

.footer-column a {
  color: #aaa;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-column a:hover {
  color: #dab672;
}

.social-icons {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}

.social-icons a {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.social-icons a:hover {
  background: #dab672;
  transform: translateY(-3px);
}

.social-icons img {
  width: 20px;
  height: 20px;
  filter: invert(0.8);
}

.footer-bottom {
  border-top: 1px solid #222;
  padding: 20px 0;
  text-align: center;
  font-size: 0.9rem;
}

/* ====================== */
/* УВЕДОМЛЕНИЯ И ОШИБКИ */
/* ====================== */
.no-results {
  padding: 40px 20px;
  text-align: center;
  color: #aaa;
}

.no-results p {
  margin-bottom: 20px;
}

/* ====================== */
/* АДАПТАЦИЯ КАТАЛОГА - КОМПАКТНАЯ ВЕРСИЯ */
/* ====================== */

/* ====================== */
/* БАЗОВЫЕ ИСПРАВЛЕНИЯ ДЛЯ ВСЕХ УСТРОЙСТВ */
/* ====================== */

/* ВАЖНО: Сохраняем оригинальные фоны */
.projects-catalog {
  background: #141414 !important;
  /* Сохраняем оригинальный фон */
  overflow-x: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

.catalog-container {
  box-sizing: border-box;
}

.projects-grid {
  box-sizing: border-box;
  /* Убираем фиксированную ширину для десктопа */
  width: auto !important;
  /* Убираем фиксированную высоту, чтобы сетка адаптировалась */
  max-height: none !important;
  /* Используем auto-rows для компактного размещения */
  grid-auto-rows: minmax(auto, max-content);
  /* Уменьшаем gap между карточками */
  gap: 20px;
}

.pagination {
  margin-left: 0;
  justify-content: center;
}

.catalog-card {
  width: 100%;
  box-sizing: border-box;
  background: #2a2a2a !important;
  /* Сохраняем оригинальный фон карточек */
  /* Делаем карточки более компактными */
  height: auto;
  min-height: 0;
  /* Позволяем карточке сжиматься */
  flex-shrink: 0;
}

/* Гарантируем отсутствие горизонтального скролла */
body,
.projects-catalog,
.catalog-container,
.projects-grid {
  max-width: 100vw;
  overflow-x: hidden !important;
}

/* ====================== */
/* МОБИЛЬНЫЕ ТЕЛЕФОНЫ (до 767px) */
/* ====================== */
@media (max-width: 767px) {
  /* Общие настройки */

  body {
    font-size: 15px;
    line-height: 1.5;
  }

  /* Контейнер каталога */
  .projects-catalog {
    padding: 15px 12px 40px;
    background: #141414 !important;
  }

  /* Заголовок и поиск */
  .catalog-header {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 20px;
    gap: 15px;
  }

  .catalog-header h1 {
    font-size: 1.8rem;
    text-align: center;
    margin: 0;
  }

  .search-container {
    max-width: 100%;
  }

  /* Боковые фильтры - вертикальная компоновка */
  .catalog-container {
    flex-direction: column;
    gap: 20px;
  }

  .filters-sidebar {
    width: 100%;
    flex: none !important;
    padding: 18px;
    margin: 0;
    background: #1a1a1a !important;
  }

  /* Сетка кнопок фильтров */
  .filter-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }

  .filter-button {
    min-width: 0;
    padding: 10px 12px;
    font-size: 0.85rem;
    background: transparent !important;
    word-break: break-word;
  }

  /* Адаптация слайдера площади */
  .range-values {
    font-size: 0.85rem;
  }

  .range-slider {
    margin: 10px 0;
  }

  /* Сетка проектов - компактная */
  .projects-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
    width: 100% !important;
    margin-bottom: 20px;
  }

  @media (min-width: 376px) and (max-width: 767px) {
    .projects-grid {
      grid-template-columns: repeat(2, 1fr) !important;
      gap: 15px !important;
    }
  }

  /* Карточки проектов - максимально компактные */
  .catalog-card {
    height: auto;
    min-height: 320px;
    background: #2a2a2a !important;
  }

  .project-image-container {
    height: 160px;
  }

  .project-title-container {
    padding: 8px 12px 6px;
    min-height: 40px;
  }

  .project-title-name {
    font-size: 1rem;
    padding: 0;
    line-height: 1.2;
    max-height: 2.4em;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .project-meta {
    padding: 6px 8px;
    font-size: 0.85rem;
    margin: 0 0px 10px;
    min-height: 36px;
    border-radius: 6px;
  }

  .project-info {
    padding: 10px 12px 12px;
    min-height: 0;
  }

  .add-to-cart {
    margin-top: 8px;
    padding: 10px;
    font-size: 0.9rem;
    min-height: 40px;
  }

  /* Пагинация */
  .pagination {
    flex-wrap: wrap;
    gap: 6px;
  }

  .pagination-button,
  .page-number {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  /* Блок индивидуального проекта */
  .custom-project-cta {
    flex-direction: column;
    text-align: center;
    padding: 18px 15px;
    margin: 20px 12px;
    gap: 18px;
    background: #222 !important;
  }

  .cta-content h3 {
    font-size: 1.4rem;
    margin-bottom: 12px;
  }

  .cta-content p {
    font-size: 0.95rem;
    margin-bottom: 18px;
  }

  .btn-custom {
    padding: 10px 25px;
    font-size: 0.95rem;
  }

  .cta-image {
    order: -1;
  }

  /* Шапка и меню */
  .menu-toggle {
    right: 12px;
    top: 8px;
    width: 44px;
    height: 44px;
  }

  .burger-icon {
    font-size: 24px;
  }

  .side-menu {
    width: 300px;
    right: -300px;
    background: linear-gradient(135deg, #1a1a1a 0%, #222222 100%) !important;
  }

  .cart-container {
    padding-right: 55px;
  }

  /* Виджет мессенджеров */
  .messenger-widget {
    bottom: 15px;
    right: 15px;
  }

  .widget-button {
    width: 50px;
    height: 50px;
  }

  .messenger-icon {
    width: 45px;
    height: 45px;
  }

  /* Поддержка Safe Area для iOS */
  @supports (padding: max(0px)) {
    .projects-catalog {
      padding-left: max(12px, env(safe-area-inset-left));
      padding-right: max(12px, env(safe-area-inset-right));
    }

    .menu-toggle {
      right: max(12px, env(safe-area-inset-right));
      top: max(8px, env(safe-area-inset-top));
    }

    .messenger-widget {
      bottom: max(15px, env(safe-area-inset-bottom));
      right: max(15px, env(safe-area-inset-right));
    }
  }
}

/* ====================== */
/* ПЛАНШЕТЫ (768px - 1023px) */
/* ====================== */
@media (min-width: 768px) and (max-width: 1023px) {
  .projects-catalog {
    padding: 20px 15px 50px;
    background: #141414 !important;
  }

  /* Фильтры и проекты в одной строке */
  .catalog-container {
    flex-direction: row;
    gap: 20px;
    align-items: flex-start;
  }

  .filters-sidebar {
    flex: 0 0 220px;
    position: static;
    /* Removed sticky to allow full expansion */
    max-height: none;
    /* Removed height constraint */
    overflow-y: visible;
    /* Removed scroll */
    background: #1a1a1a !important;
  }

  /* Сетка проектов - 2 колонки, компактная */
  .projects-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
    width: calc(100% - 240px) !important;
    max-height: none;
  }

  /* Карточки проектов - компактные */
  .project-image-container {
    height: 190px;
  }

  .catalog-card {
    min-height: 360px;
    background: #2a2a2a !important;
  }

  .project-title-container {
    min-height: 45px;
    padding: 10px 12px 8px;
  }

  .project-title-name {
    font-size: 1.1rem;
    line-height: 1.2;
  }

  .project-meta {
    min-height: 40px;
    padding: 8px 10px;
    margin: 0 0px 10px;
    font-size: 0.9rem;
  }

  .project-info {
    padding: 12px 15px 15px;
  }

  .add-to-cart {
    padding: 10px;
    font-size: 0.95rem;
    min-height: 42px;
  }

  /* Пагинация с учетом ширины фильтров */
  .pagination {
    gap: 8px;
  }

  .pagination-button,
  .page-number {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  /* Блок индивидуального проекта */
  .custom-project-cta {
    margin: 30px 15px;
    padding: 20px;
    background: #222 !important;
  }

  /* iPad Mini вертикальная ориентация */

}

/* ====================== */
/* НОУТБУКИ (1024px - 1279px) */
/* ====================== */
@media (min-width: 1024px) and (max-width: 1279px) {
  .projects-catalog {
    max-width: 1200px;
    padding: 25px 20px 60px;
    background: #141414 !important;
  }

  .catalog-container {
    gap: 25px;
  }

  .filters-sidebar {
    flex: 0 0 240px;
    background: #1a1a1a !important;
  }

  /* Сетка проектов - 3 колонки, компактная */
  .projects-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    width: calc(100% - 265px) !important;
    gap: 25px !important;
    max-height: none;
  }

  /* Карточки проектов - компактные */
  .project-image-container {
    height: 200px;
  }

  .catalog-card {
    min-height: 380px;
    background: #2a2a2a !important;
  }

  .project-title-container {
    min-height: 50px;
    padding: 12px 15px 10px;
  }

  .project-title-name {
    font-size: 1.2rem;
    line-height: 1.25;
  }

  .project-meta {
    min-height: 45px;
    padding: 10px 12px;
    margin: 0 0px 12px;
    font-size: 0.95rem;
  }

  .project-info {
    padding: 15px 18px 18px;
  }

  .add-to-cart {
    padding: 12px;
    font-size: 1rem;
    min-height: 44px;
  }

  .pagination {
    gap: 10px;
  }

  .custom-project-cta {
    margin: 35px 20px;
    background: #222 !important;
  }
}

/* ====================== */
/* БОЛЬШИЕ МОНИТОРЫ (1280px - 1439px) */
/* ====================== */
@media (min-width: 1280px) and (max-width: 1439px) {
  .projects-catalog {
    max-width: 1400px;
    padding: 30px 25px 70px;
    background: #141414 !important;
  }

  .catalog-container {
    gap: 30px;
  }

  .filters-sidebar {
    flex: 0 0 260px;
    background: #1a1a1a !important;
  }

  /* Сетка проектов - 3 колонки, оптимальная высота */
  .projects-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    width: calc(100% - 290px) !important;
    gap: 30px !important;
    max-height: none;
  }

  /* Карточки проектов */
  .project-image-container {
    height: 220px;
  }

  .catalog-card {
    min-height: 400px;
    background: #2a2a2a !important;
  }

  .project-title-container {
    min-height: 55px;
    padding: 14px 15px 12px;
  }

  .project-title-name {
    font-size: 1.3rem;
  }

  .project-meta {
    min-height: 48px;
    padding: 12px 14px;
    margin: 0 0px 14px;
    font-size: 1rem;
  }

  .pagination {
    gap: 12px;
  }

  /* MacBook Air 13" */
  @media (max-height: 900px) {
    .filters-sidebar {
      max-height: calc(100vh - 90px);
    }

    .project-image-container {
      height: 200px;
    }

    .catalog-card {
      min-height: 380px;
    }
  }
}

/* ====================== */
/* ОЧЕНЬ БОЛЬШИЕ ЭКРАНЫ (1440px и больше) */
/* ====================== */
@media (min-width: 1440px) {
  .projects-catalog {
    max-width: 1700px;
    padding: 35px 30px 80px;
    background: #141414 !important;
  }

  .catalog-container {
    gap: 35px;
  }

  .filters-sidebar {
    flex: 0 0 280px;
    background: #1a1a1a !important;
  }

  /* Сетка проектов - 4 колонки, оптимальные промежутки */
  .projects-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    width: calc(100% - 315px) !important;
    gap: 30px !important;
    max-height: none;
  }

  /* Карточки проектов */
  .project-image-container {
    height: 240px;
  }

  .catalog-card {
    min-height: 420px;
    background: #2a2a2a !important;
  }

  .project-title-container {
    min-height: 60px;
    padding: 15px 15px 12px;
  }

  .project-title-name {
    font-size: 1.4rem;
  }

  .project-meta {
    min-height: 50px;
    padding: 12px 15px;
    margin: 0 0px 15px;
  }

  .pagination {
    gap: 15px;
  }

  /* Мониторы с высоким разрешением */
  @media (min-width: 1920px) {
    .projects-grid {
      grid-template-columns: repeat(4, 1fr) !important;
      gap: 35px !important;
    }

    .project-image-container {
      height: 260px;
    }

    .catalog-card {
      min-height: 450px;
    }
  }
}

/* ====================== */
/* ИСПРАВЛЕНИЯ ДЛЯ ДЕСКТОПНОЙ ВЕРСИИ */
/* ====================== */
@media (min-width: 1024px) {
  .projects-grid {
    max-height: none !important;
  }

  .project-title-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
  }

  .project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .project-info {
    padding: 15px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .add-to-cart {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ====================== */
/* СПЕЦИФИЧНЫЕ УСТРОЙСТВА */
/* ====================== */

/* iPhone SE и подобные маленькие устройства */
@media (max-width: 376px) {
  .projects-catalog {
    padding: 12px 10px 35px;
  }

  .catalog-header h1 {
    font-size: 1.5rem;
  }

  .filter-options {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .filter-button {
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .project-image-container {
    height: 140px;
  }

  .catalog-card {
    min-height: 300px;
  }

  .project-title-name {
    font-size: 0.95rem;
  }

  .custom-project-cta {
    margin: 15px 10px;
    padding: 15px 12px;
    gap: 15px;
  }
}

/* iPhone 12 Pro, 13, 14 */
@media (min-width: 390px) and (max-width: 430px) {
  .project-image-container {
    height: 170px;
  }

  .catalog-card {
    min-height: 340px;
  }
}

/* Устройства в ландшафтной ориентации */
@media (max-height: 600px) and (orientation: landscape) {
  .projects-catalog {
    padding: 10px 12px 25px;
  }

  .catalog-header h1 {
    font-size: 1.4rem;
    margin-bottom: 10px;
  }

  .project-image-container {
    height: 140px;
  }

  .catalog-card {
    min-height: 280px;
  }

  .filter-options {
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 5px;
  }

  .filter-button {
    padding: 6px 8px;
    font-size: 0.75rem;
  }
}

/* ====================== */
/* ДОПОЛНИТЕЛЬНЫЕ ИСПРАВЛЕНИЯ */
/* ====================== */

/* Убираем скроллбары у элементов с прокруткой */
.filters-sidebar::-webkit-scrollbar,
.projects-grid::-webkit-scrollbar {
  width: 4px;
  display: none;
}

.filters-sidebar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Исправление для кнопки сброса */
.btn-reset {
  width: 100%;
  margin-top: 15px;
  padding: 12px;
  font-size: 0.95rem;
  background: #333 !important;
  color: #dab672 !important;
  border: 1px solid #dab672 !important;
}

/* Гарантируем компактное отображение */
.catalog-card .project-meta {
  flex-shrink: 0;
}

.catalog-card .project-title-container {
  flex-shrink: 0;
}

.catalog-card .add-to-cart {
  flex-shrink: 0;
}

/* Убираем лишние отступы между строками grid */
.projects-grid {
  align-items: start;
  /* Выравниваем карточки по верхнему краю */
}

/* ====================== */
/* ПОДДЕРЖКА REDUCED MOTION */
/* ====================== */
@media (prefers-reduced-motion: reduce) {

  .catalog-card,
  .filter-button,
  .add-to-cart,
  .btn-custom {
    transition: none !important;
    animation: none !important;
  }
}

/* ====================== */
/* АДАПТАЦИЯ ШАПКИ И ФУТЕРА ДЛЯ КАТАЛОГА */
/* ====================== */

/* 1. МОБИЛЬНЫЕ УСТРОЙСТВА (до 767px) */
@media (max-width: 767px) {

  /* Шапка */
  .header-container {
    padding: 0 10px;
  }

  .logo {
    font-size: 20px;
    padding-left: 10px;
  }

  .cart-container {
    padding-right: 55px;
  }

  .header-permanent+.menu-toggle {
    top: 10px;
    right: 15px;
  }

  .menu-toggle {
    width: 40px;
    height: 40px;
    top: 15px;
    right: 15px;
  }

  .burger-icon {
    font-size: 24px;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  /* Убираем тень на мобильных для меню и корзины */
  .menu-toggle,
  .side-menu,
  .cart-widget {
    box-shadow: none !important;
  }

  /* Боковое меню */
  .side-menu {
    width: 85%;
    max-width: 300px;
    right: -85%;
    box-shadow: none !important;
    background: linear-gradient(135deg, #1a1a1a 0%, #222222 100%) !important;
  }

  /* Корзина - полный экран на мобильных */
  .cart-widget {
    width: 100% !important;
    max-width: 100% !important;
    right: -100% !important;
    box-shadow: none !important;
  }

  .cart-widget.active {
    right: 0 !important;
  }

  .footer-column {
    min-width: 100%;
  }

  /* Виджет мессенджеров */
  .messenger-widget {
    bottom: 15px;
    right: 15px;
  }

  .widget-button {
    width: 50px;
    height: 50px;
  }

  .messenger-icon {
    width: 45px;
    height: 45px;
  }

  /* Поддержка Safe Area для iOS */
  @supports (padding: max(0px)) {
    .menu-toggle {
      right: max(12px, env(safe-area-inset-right));
      top: max(8px, env(safe-area-inset-top));
    }

    .messenger-widget {
      bottom: max(15px, env(safe-area-inset-bottom));
      right: max(15px, env(safe-area-inset-right));
    }
  }
}

/* 2. ПЛАНШЕТЫ (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {

  /* Боковое меню */
  .side-menu {
    width: 350px;
  }

  /* Корзина - полный экран на планшетах */
  .cart-widget {
    width: 100% !important;
    max-width: 100% !important;
    right: -100% !important;
  }

  .cart-widget.active {
    right: 0 !important;
  }

  /* Виджет мессенджеров */
  .messenger-widget {
    bottom: 25px;
    right: 25px;
  }

  /* iPad Mini вертикальная ориентация */
  @media (max-height: 1024px) and (orientation: portrait) {
    /* Дополнительные стили при необходимости */
  }
}

/* 3. IPAD PRO (1024px - 1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {

  /* Боковое меню */
  .side-menu {
    width: 320px;
  }

  /* Корзина - стандартная ширина */
  .cart-widget {
    width: 400px !important;
    max-width: 400px !important;
    right: -400px !important;
  }

  .cart-widget.active {
    right: 0 !important;
  }
}

/* 4. ДЕСКТОПЫ (1200px и больше) */
@media (min-width: 1200px) {

  /* Корзина - стандартная ширина */
  .cart-widget {
    width: 400px !important;
    max-width: 400px !important;
    right: -400px !important;
  }

  .cart-widget.active {
    right: 0 !important;
  }
}

/* 5. ЛАНДШАФТНАЯ ОРИЕНТАЦИЯ */
@media (max-height: 600px) and (orientation: landscape) {

  /* Корзина - стандартная ширина */
  .cart-widget {
    width: 400px !important;
    max-width: 400px !important;
    right: -400px !important;
  }

  .cart-widget.active {
    right: 0 !important;
  }
}

/* 6. УСТРОЙСТВО Surface Pro 7 (912x1368) */
@media (min-width: 912px) and (max-width: 1368px) {

  /* Корзина - стандартная ширина */
  .cart-widget {
    width: 400px !important;
    max-width: 400px !important;
    right: -400px !important;
  }

  .cart-widget.active {
    right: 0 !important;
  }
}

/* 7. REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {

  .menu-item,
  .close-btn,
  .cart-icon,
  .menu-toggle,
  .widget-button {
    transition: none !important;
    animation: none !important;
  }
}

/* 8. iPhone SE и подобные маленькие устройства */
@media (max-width: 376px) {
  .menu-toggle {
    right: 12px;
    top: 8px;
  }

  .cart-container {
    padding-right: 55px;
  }

}

/* 9. Устройства в ландшафтной ориентации - специфика */
@media (max-height: 600px) and (orientation: landscape) {
  .menu-toggle {
    top: 8px;
    right: 12px;
  }
}