.catalog-container {
  display: flex;

  min-height: 100vh;
}

/* Sidebar Filters */

.filters-sidebar {
  width: 280px;

  background: white;

  padding: 24px;

  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.05);

  position: sticky;

  top: 20px;

  height: fit-content;

  max-height: calc(100vh - 40px);

  overflow-y: auto;
}

.filters-header {
  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 24px;

  padding-bottom: 16px;

  border-bottom: 2px solid #f0f0f0;
}

.filters-header h2 {
  font-size: 20px;

  font-weight: 600;

  color: #333;
}

.clear-all-btn {
  background: none;

  border: none;

  color: #667eea;

  font-size: 13px;

  cursor: pointer;

  text-decoration: underline;

  font-weight: 500;
}

.clear-all-btn:hover {
  color: #764ba2;
}

.filter-group {
  margin-bottom: 24px;
}

.filter-group label {
  display: block;

  font-size: 13px;

  font-weight: 600;

  color: #555;

  text-transform: uppercase;

  letter-spacing: 0.5px;

  margin-bottom: 8px;
}

.filter-group select {
  width: 100%;

  padding: 10px 12px;

  border: 2px solid #e0e0e0;

  border-radius: 8px;

  font-size: 14px;

  cursor: pointer;

  background: white;

  transition: border-color 0.2s;
}

.filter-group select:focus {
  outline: none;

  border-color: #667eea;
}

.active-filters {
  margin-top: 16px;

  padding-top: 16px;

  border-top: 1px solid #f0f0f0;
}

.filter-tag {
  display: inline-flex;

  align-items: center;

  gap: 6px;

  background: #e8eaf6;

  color: #5c6bc0;

  padding: 6px 10px;

  border-radius: 20px;

  font-size: 12px;

  margin: 4px 4px 4px 0;
}

.filter-tag button {
  background: none;

  border: none;

  color: #5c6bc0;

  cursor: pointer;

  font-size: 16px;

  line-height: 1;

  padding: 0;

  margin-left: 4px;
}

/* Main Content */

.main-content {
  flex: 1;

  padding: 0 32px 32px 32px;

  max-width: calc(100% - 280px);
}

/* Search Bar */

.search-section {
  background: white;

  padding: 24px;

  border-radius: 12px;

  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);

  margin-bottom: 24px;
}

.search-wrapper {
  position: relative;

  max-width: 600px;
}

.search-input {
  width: 100%;

  padding: 14px 48px 14px 48px;

  border: 2px solid #e0e0e0;

  border-radius: 10px;

  font-size: 16px;

  transition: all 0.3s;
}

.search-input:focus {
  outline: none;

  border-color: #667eea;

  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.search-icon {
  position: absolute;

  left: 16px;

  top: 50%;

  transform: translateY(-50%);

  color: #999;

  font-size: 18px;
}

.clear-search {
  position: absolute;

  right: 16px;

  top: 50%;

  transform: translateY(-50%);

  background: none;

  border: none;

  color: #999;

  cursor: pointer;

  font-size: 20px;

  display: none;
}

.clear-search.active {
  display: block;
}

.autocomplete-dropdown {
  position: absolute;

  top: 100%;

  left: 0;

  right: 0;

  background: white;

  border: 1px solid #e0e0e0;

  border-radius: 8px;

  margin-top: 4px;

  max-height: 400px;

  overflow-y: auto;

  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);

  display: none;

  z-index: 100;
}

.autocomplete-dropdown.active {
  display: block;
}

.autocomplete-item {
  padding: 12px 16px;

  cursor: pointer;

  display: flex;

  align-items: center;

  gap: 12px;

  border-bottom: 1px solid #f5f5f5;

  transition: background 0.2s;
}

.autocomplete-item:hover {
  background: #f8f9fa;
}

.autocomplete-item img {
  width: 48px;

  height: 48px;

  object-fit: cover;

  border-radius: 6px;
}

.autocomplete-item-info {
  flex: 1;
}

.autocomplete-item-name {
  font-weight: 500;

  color: #333;

  margin-bottom: 2px;
}

.autocomplete-item-code {
  font-size: 12px;

  color: #999;
}

/* Results Header */

.results-header {
  background: white;

  padding: 20px 24px;

  border-radius: 12px;

  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);

  margin-bottom: 24px;

  display: flex;

  justify-content: space-between;

  align-items: center;

  flex-wrap: wrap;

  gap: 16px;
}

.results-info {
  display: flex;

  align-items: center;

  gap: 16px;
}

.results-count {
  font-size: 16px;

  font-weight: 500;

  color: #333;
}

.view-toggle {
  display: flex;

  gap: 4px;

  background: #f5f5f5;

  padding: 4px;

  border-radius: 8px;
}

.view-btn {
  padding: 8px 12px;

  border: none;

  background: transparent;

  cursor: pointer;

  border-radius: 6px;

  color: #666;

  transition: all 0.2s;

  font-size: 14px;
}

.view-btn.active {
  background: white;

  color: #667eea;

  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sort-controls {
  display: flex;

  align-items: center;

  gap: 8px;
}

.sort-controls label {
  font-size: 14px;

  color: #666;

  font-weight: 500;
}

.sort-controls select {
  padding: 8px 12px;

  border: 2px solid #e0e0e0;

  border-radius: 8px;

  font-size: 14px;

  cursor: pointer;

  background: white;
}

/* Loading and Empty States */

.loading-state,
.empty-state {
  grid-column: 1 / -1;

  text-align: center;

  padding: 60px 20px;
}

.spinner {
  border: 3px solid #f3f3f3;

  border-top: 3px solid #667eea;

  border-radius: 50%;

  width: 50px;

  height: 50px;

  animation: spin 1s linear infinite;

  margin: 0 auto 16px;
}

.empty-state-icon {
  font-size: 64px;

  margin-bottom: 16px;

  opacity: 0.5;
}

.empty-state h3 {
  font-size: 20px;

  color: #333;

  margin-bottom: 8px;
}

.empty-state p {
  color: #999;
}

/* Pagination */

.pagination {
  display: flex;

  justify-content: center;

  align-items: center;

  gap: 8px;

  margin-top: 32px;
}

.pagination button,
.pagination span {
  padding: 10px 16px;

  border: 2px solid #e0e0e0;

  background: white;

  border-radius: 8px;

  cursor: pointer;

  font-size: 14px;

  font-weight: 500;

  color: #333;

  transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
  background: #667eea;

  color: white;

  border-color: #667eea;
}

.pagination button:disabled {
  opacity: 0.4;

  cursor: not-allowed;
}

.pagination .current-page {
  background: #667eea;

  color: white;

  border-color: #667eea;
}

.pagination span {
  border: none;

  background: none;

  cursor: default;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Responsive Design */

@media (max-width: 1400px) {
  .products-grid.view-9 {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 1200px) {
  .products-grid.view-6,
  .products-grid.view-9 {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 992px) {
  .catalog-container {
    flex-direction: column;
  }

  .filters-sidebar {
    width: 100%;

    position: static;

    max-height: none;

    margin-bottom: 20px;
  }

  .main-content {
    max-width: 100%;

    padding: 0 16px 32px 16px;
  }

  .products-grid.view-3,
  .products-grid.view-6,
  .products-grid.view-9 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .products-grid.view-3,
  .products-grid.view-6,
  .products-grid.view-9 {
    grid-template-columns: repeat(2, 1fr);
  }

  .results-header {
    flex-direction: column;

    align-items: stretch;
  }

  .results-info {
    justify-content: space-between;
  }

  .sort-controls {
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .products-grid.view-3,
  .products-grid.view-6,
  .products-grid.view-9 {
    grid-template-columns: 1fr;
  }
}
