/* ==========================================================================
   Catalog Page — Isracollect Premium E-Commerce
   Complete rewrite — pixel-perfect, premium design
   ========================================================================== */

/* --------------------------------------------------------------------------
   BREADCRUMB
   -------------------------------------------------------------------------- */

.breadcrumb {
  padding: var(--space-md) 0;
}

.breadcrumb__list {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}

.breadcrumb__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.breadcrumb__item + .breadcrumb__item::before {
  content: "/";
  color: var(--border-medium);
  font-size: 12px;
}

.breadcrumb__item a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb__item a:hover {
  color: var(--brand-600);
}

.breadcrumb__item span {
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
}

/* --------------------------------------------------------------------------
   CATALOG LAYOUT
   -------------------------------------------------------------------------- */

.catalog {
  padding-bottom: var(--space-3xl);
}

.catalog__layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: var(--space-xl);
  align-items: start;
}

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

/* --------------------------------------------------------------------------
   SIDEBAR
   -------------------------------------------------------------------------- */

.catalog__sidebar {
  position: sticky;
  top: calc(var(--header-height) + 20px);
  max-height: calc(100vh - var(--header-height) - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);

  /* Thin scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) transparent;
}

.catalog__sidebar::-webkit-scrollbar {
  width: 4px;
}

.catalog__sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.catalog__sidebar::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
}

@media (max-width: 1023px) {
  .catalog__sidebar {
    display: none;
  }
}

.catalog__sidebar-section {
  margin-bottom: var(--space-lg);
}

.catalog__sidebar-section:last-child {
  margin-bottom: 0;
}

.catalog__sidebar-title {
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
  color: var(--text-tertiary);
  margin: 0 0 var(--space-md) 0;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
}

.catalog__category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.catalog__category-link {
  display: block;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
}

.catalog__category-link:hover {
  background: var(--brand-50);
  color: var(--brand-600);
}

.catalog__category-link--active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: var(--font-weight-semibold);
  border-left-color: var(--brand-600);
}

/* --------------------------------------------------------------------------
   CATALOG MAIN
   -------------------------------------------------------------------------- */

.catalog__main {
  min-width: 0;
}

/* --------------------------------------------------------------------------
   CATALOG HEADER
   -------------------------------------------------------------------------- */

.catalog__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.catalog__title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin: 0;
  letter-spacing: var(--letter-spacing-tight);
}

.catalog__count {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
  margin: 0;
  font-weight: var(--font-weight-normal);
}

.catalog__controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.catalog__sort {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' 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 14px center;
  background-size: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 40px 10px 16px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 180px;
  font-family: var(--font-family);
  line-height: 1.4;
}

.catalog__sort:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-xs);
}

.catalog__sort:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* --------------------------------------------------------------------------
   RESULTS SUMMARY
   -------------------------------------------------------------------------- */

.catalog__results-summary {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.catalog__results-category strong {
  color: var(--brand-600);
  font-weight: var(--font-weight-semibold);
}

/* --------------------------------------------------------------------------
   FREE SHIPPING BANNER
   -------------------------------------------------------------------------- */

.catalog__free-shipping {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--accent-green-light);
  color: var(--accent-green);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-lg);
}

.catalog__free-shipping svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   GRID SYSTEM
   -------------------------------------------------------------------------- */

.grid {
  display: grid;
  gap: 20px;
}

.grid--4 {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .grid--4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.catalog__grid {
  margin-bottom: var(--space-xl);
}

/* --------------------------------------------------------------------------
   PRODUCT CARD
   -------------------------------------------------------------------------- */

.product-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.3s ease;
  position: relative;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(37, 99, 235, 0.12);
}

/* Link wrapper */
.product-card__link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  flex: 1;
}

/* Image wrapper */
.product-card__image-wrapper {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-tertiary);
  overflow: hidden;
  margin: 0;
}

/* Image */
.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover .product-card__image {
  transform: scale(1.08);
}

/* Placeholder */
.product-card__image--placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  object-fit: unset;
  transform: none !important;
}

.product-card__image--placeholder i {
  font-size: 48px;
  color: var(--border-medium);
  line-height: 1;
}

/* Badge */
.product-card__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  color: var(--text-inverse);
  letter-spacing: 0.02em;
  line-height: 1.4;
  text-transform: uppercase;
}

.product-card__badge--promo {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

/* Card info */
.product-card__info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

/* Brand */
.product-card__brand {
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  color: var(--text-tertiary);
  margin: 0;
  line-height: 1.3;
}

/* Product name */
.product-card__name {
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pricing */
.product-card__pricing {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-top: auto;
}

.product-card__price {
  font-size: 16px;
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: 1.3;
}

.product-card__price--original {
  text-decoration: line-through;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: var(--font-weight-normal);
}

.product-card__price--promo {
  color: var(--accent-green);
  font-weight: var(--font-weight-bold);
  font-size: 16px;
}

/* Add to cart button */
.product-card__add-to-cart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: calc(100% - 24px);
  margin: 0 12px 12px 12px;
  height: 44px;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
  flex-shrink: 0;
}

.product-card__add-to-cart svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.product-card__add-to-cart:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
  background: linear-gradient(135deg, var(--brand-700), var(--brand-800));
}

.product-card__add-to-cart:active {
  transform: scale(0.97);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

/* --------------------------------------------------------------------------
   EMPTY STATE
   -------------------------------------------------------------------------- */

.catalog__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--text-tertiary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-relaxed);
}

.catalog__empty::before {
  content: "";
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-md);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3Cline x1='8' y1='11' x2='14' y2='11'%3E%3C/line%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.5;
}

/* --------------------------------------------------------------------------
   PAGINATION
   -------------------------------------------------------------------------- */

.catalog__pagination {
  display: flex;
  justify-content: center;
  margin-top: var(--space-2xl);
}

.pagination__list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pagination__link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 4px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.pagination__link:hover {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--brand-600);
}

.pagination__link--active {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: var(--text-inverse);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
  pointer-events: none;
}

.pagination__link--active:hover {
  background: var(--brand-600);
  color: var(--text-inverse);
}

.pagination__link--prev,
.pagination__link--next {
  width: auto;
  padding: 0 16px;
  font-weight: var(--font-weight-medium);
}

/* --------------------------------------------------------------------------
   RESPONSIVE FINE-TUNING
   -------------------------------------------------------------------------- */

/* Mobile: < 640px */
@media (max-width: 639px) {
  .catalog__header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .catalog__controls {
    width: 100%;
  }

  .catalog__sort {
    width: 100%;
    min-width: unset;
  }

  .catalog__title {
    font-size: var(--font-size-xl);
  }

  .product-card__add-to-cart {
    font-size: 12px;
  }

  .pagination__link--prev,
  .pagination__link--next {
    padding: 0 10px;
    font-size: 12px;
  }
}

/* Tablet: 640px - 1023px */
@media (min-width: 640px) and (max-width: 1023px) {
  .catalog__layout {
    gap: 0;
  }
}

/* Desktop: 1024px+ */
@media (min-width: 1024px) {
  .catalog__header {
    margin-bottom: var(--space-xl);
  }
}

/* Large: 1280px+ */
@media (min-width: 1280px) {
  .catalog__layout {
    gap: var(--space-2xl);
  }

  .catalog__sidebar {
    padding: var(--space-xl);
  }

  .grid--4 {
    gap: 24px;
  }

  .product-card__info {
    padding: 20px;
  }

  .product-card__name {
    font-size: 15px;
  }
}
