/* ===== ОСНОВНЫЕ СТИЛИ СЕКЦИИ СРАВНЕНИЯ ===== */
.comparison-section {
  padding: 2rem 1rem;
  max-width: 1400px;
  margin: 20px auto;
  width: 100%; /* Добавьте это */
  box-sizing: border-box; /* Важно для правильного расчета ширины */
}

/* ===== СТИЛИ ФИЛЬТРОВ ===== */
.comparison-filters {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-small);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  width: 100%; /* Добавьте это */
  box-sizing: border-box; /* Важно */
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: center;
  width: 100%; /* Добавьте это */
}

.filter-group {
  flex: 1;
  min-width: 200px;
  max-width: calc(25% - 1rem); /* Ограничиваем максимальную ширину */
}

.filter-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  margin-left: 3px;
}

.filter-select,
.filter-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--chat-input);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.2);
}

.filter-select[multiple] {
  height: 120px;
  padding: 0.5rem;
}

.filter-select option {
  padding: 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.25rem;
}

.filter-select option:checked {
  background: var(--accent-primary);
  color: white;
}

.filter-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    color: #2d3748;
}

.filter-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 210, 255, 0.4);
}

/* ===== КОНТЕЙНЕР СРАВНЕНИЯ И КАРТОЧКИ МАГАЗИНОВ ===== */
/* Добавьте это чтобы контейнер с карточками тоже сохранял ширину */
.comparison-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
  width: 100%; /* Добавьте это */
}

.store-card {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: var(--shadow-small);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
}

.store-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-light-strong);
}

.store-header {
  padding: 1rem 1.5rem;
  color: white;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.store-name {
  font-weight: 700;
  font-size: 1.5rem;
}

.product-count {
  background: white;
  padding: 0.25rem 0.75rem;
  border: 1px;
  border-radius: 16px;
  border-color: var(--accent-primary);
  font-size: 1.1rem;
  font-weight: 600;
}

/* ===== СПИСОК ПРОДУКТОВ В КАРТОЧКЕ ===== */
.products-list {
  padding: 0;
  margin: 0;
  list-style: none;
  overflow-y: auto;
  max-height: 500px;
}

.product-item-comparison {
  position: relative;
  padding: 0;
  border-radius: 12px;
  background: var(--card-bg);
  margin-bottom: 1rem;
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid var(--border-light);
}

.product-item-comparison:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-small);
}

.product-main-content {
  padding: 1rem 1rem 0 1rem;
  display: block;
  color: inherit;
  text-decoration: none;
}

.product-name {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.product-price {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--price-gradient);
  margin-bottom: 0.5rem;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.toggle-specs-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  height: 24px;
  width: 80%;
  margin: auto;
  margin-bottom: 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.8rem;
}

.toggle-specs-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.product-specs {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  background: var(--border-light);
}

.product-specs.show {
  max-height: 300px;
}

.product-specs-inner {
  padding: 1rem;
}

.product-spec {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.product-spec-name {
  font-weight: 500;
  color: var(--text-secondary);
}

.product-spec-value {
  color: var(--text-primary);
}

.product-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.no-products {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
}

/* ===== ИНДИКАТОР ЗАГРУЗКИ ===== */
.loading-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 210, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--accent-primary);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.sort-indicator {
  margin-left: 0.5rem;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* ===== СТИЛИ МНОЖЕСТВЕННОГО ВЫБОРА ===== */
.filter-select.multiple {
  height: auto;
  min-height: 38px;
  padding: 0;
}

.filter-select.multiple option {
  padding: 8px 12px;
  cursor: pointer;
}

.filter-select.multiple option:hover {
  background-color: #f5f5f5;
}

.filter-select.multiple option:checked {
  background-color: #e3f2fd;
  font-weight: 500;
}

.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: "▼";
  font-size: 12px;
  color: #666;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.selected-stores {
  display: none;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  min-height: 38px;
  margin-bottom: 5px;
}

.selected-stores .selected-count {
  font-size: 14px;
  color: #333;
}

/* ==== Улучшенный фильтр по диапазону ==== */
.filter-group {
    margin-bottom: 25px;
    padding: 18px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e1e5eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.filter-label {
    display: block;
    margin-bottom: 15px;
    font-weight: 600;
    color: #2d3748;
    font-size: 15px;
}

.range-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
}

.range-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.range-input-label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.range-input {
    width: 100%;
    padding: 10px 5px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #2d3748;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.range-input:focus {
    border-color: #4a6cf7;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.15);
}

.range-separator {
    color: #94a3b8;
    font-weight: 600;
    margin: 0 5px;
    padding-top: 18px;
}

/* Стили для текстового фильтра */
.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #2d3748;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5568' 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 12px center;
    background-size: 16px;
}

.filter-select:focus {
    border-color: #4a6cf7;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.15);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .range-filter {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .range-separator {
        align-self: center;
        margin: 0;
        padding-top: 0;
    }
}

/* ===== КАСТОМНЫЙ МУЛЬТИСЕЛЕКТ ===== */
.custom-multiselect {
  position: relative;
  width: 100%;
  min-width: 200px; /* Сохраните минимальную ширину */
}

.select-trigger {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--chat-input);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.select-trigger:hover {
  border-color: var(--accent-primary);
}

.select-trigger.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.2);
}

.select-options {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--header-bg);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  margin-top: 0.5rem;
  box-shadow: var(--shadow);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
}

.select-options.show {
  display: block;
}

.select-search {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 0.5rem;
}

.select-search-input {
  width: 100%;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--chat-input);
  color: var(--text-primary);
}

.select-all {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 0.5rem;
}

.select-option {
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 0.15rem;
  padding: 0 5px;
}

.select-option:hover {
  background: rgba(0, 210, 255, 0.1);
  border-radius: 7px;
}

.select-option.selected {
  background: var(--accent-primary);
  color: white;
  border-radius: 7px;
  padding: 0 5px;
}

.options-list {
  max-height: 200px;
  overflow-y: auto;
}

/* ===== СТИЛИ ДЛЯ КНОПКИ "ЗАГРУЗИТЬ ЕЩЕ" ===== */
.load-more-item {
  list-style: none;
  padding: 1rem;
  border-top: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.03);
}

.load-more-btn {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.25);
  position: relative;
  overflow: hidden;
}

.load-more-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 210, 255, 0.4);
  background: linear-gradient(45deg, #00c6ff, #ff2d75);
}

.load-more-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(0, 210, 255, 0.3);
}

.load-more-btn:disabled {
  background: var(--text-secondary);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.7;
}

.load-more-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.load-more-btn:hover::before {
  left: 100%;
}

/* ===== СТИЛИ ДЛЯ КОНКРЕТНЫХ МАГАЗИНОВ ===== */
.store-card[data-website="Ozon"] .store-header {
  background: rgba(0, 42, 255, 0.45);
  color: #ffffff;
  border-color: rgba(0, 82, 255, 0.2);
}

.store-card[data-website="Ozon"] .product-count {
  color: rgba(0, 42, 255, 0.45);
}

.store-card[data-website="Wildberries"] .store-header {
  background: rgba(170, 0, 170, 0.45);
  color: #ffffff;
  border-color: rgba(170, 0, 170, 0.2);
}

.store-card[data-website="Wildberries"] .product-count {
  color: rgba(170, 0, 170, 0.45);
}

.store-card[data-website="Citilink"] .store-header {
  background: rgba(255, 69, 0, 0.45);
  color: #ffffff;
  border-color: rgba(255, 76, 0, 0.2);
}

.store-card[data-website="Citilink"] .product-count {
  color: rgba(255, 69, 0, 0.45);
}

.store-card[data-website="DNS"] .store-header {
  background: rgba(255, 128, 0, 0.45);
  color: #ffffff;
  border-color: rgba(255, 135, 0, 0.2);
}

.store-card[data-website="DNS"] .product-count {
  color: rgba(255, 128, 0, 0.45);
}

.store-card[data-website="YandexMarket"] .store-header {
  background: rgba(255, 0, 86, 0.45);
  color: #ffffff;
  border-color: rgba(221, 48, 13, 0.2);
}

.store-card[data-website="YandexMarket"] .product-count {
  color: rgba(255, 0, 86, 0.45);
}

.store-card[data-website="OnlineTrade"] .store-header {
  background: rgba(194, 77, 0, 0.45);
  color: #ffffff;
  border-color: rgba(221, 93, 13, 0.2);
}

.store-card[data-website="OnlineTrade"] .product-count {
  color: rgba(194, 77, 0, 0.45);
}

/* ===== АНИМАЦИИ ===== */
.store-card.moving {
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 10;
}

/* ===== СТИЛИ ДЛЯ СВЕТЛОЙ ТЕМЫ ===== */
html.light-theme .store-card {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

html.light-theme .store-card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

html.light-theme .load-more-item {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.02);
}

html.light-theme .load-more-btn {
  background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.25);
}

html.light-theme .load-more-btn:hover {
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
  background: linear-gradient(45deg, #0066cc, #ff6b6b);
}

html.light-theme .load-more-btn:active {
  box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
}

html.light-theme .load-more-btn:disabled {
  background: var(--text-secondary);
}

/* ===== АДАПТИВНЫЕ СТИЛИ ===== */
/* Обновите медиа-запросы */
@media (max-width: 1200px) {
  .filter-group {
    max-width: calc(33.33% - 1rem); /* 3 в строке */
  }
}

@media (max-width: 900px) {
  .filter-group {
    max-width: calc(50% - 1rem); /* 2 в строке */
  }
}

@media (max-width: 600px) {
  .filter-group {
    max-width: 100%; /* 1 в строке */
    min-width: 100%;
  }

  .comparison-filters {
    padding: 1rem;
  }
}

@media (max-width: 768px) {
  .comparison-container {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }

  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

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

  .filter-select.multiple {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 300px;
    height: auto;
    max-height: 60vh;
    z-index: 1001;
  }

  .select-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
  }

  .select-overlay.show {
    display: block;
  }

  .selected-stores {
    display: block;
  }

  .filter-select.multiple {
    display: none;
  }

  .filter-select.multiple.show {
    display: block;
  }

  .select-options {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 300px;
    max-height: 60vh;
  }

  .select-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  .select-overlay.show {
    display: block;
  }
}

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

  .comparison-filters {
    padding: 1rem;
  }

  .store-header {
    padding: 0.75rem 1rem;
  }

  .product-item-comparison {
    padding: 0.75rem 1rem;
  }

  /* Адаптивные стили для кнопки "Загрузить еще" */
  .load-more-container {
    padding: 0.75rem;
  }

  .load-more-btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
}

.sort-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    color: #2d3748;
}

.sort-button:hover {
    border-color: #3498db;
}

.sort-icon {
    margin-left: 8px;
    font-weight: bold;
}
