/* ===== Products Page ===== */
.products-page {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: calc(var(--nav-height) + 32px) 24px 80px;
}

.products-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.products-search-wrap {
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: all 0.25s ease;
}

.products-search-wrap:focus-within {
  border-color: rgba(139, 92, 246, 0.45);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.08);
}

.products-search-wrap svg {
  color: var(--text-dim);
  flex-shrink: 0;
}

.products-search {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}

.products-search::placeholder {
  color: var(--text-dim);
}

.products-search-wrap.has-image .products-search,
.products-search-wrap.has-image > svg:first-of-type,
.products-search-wrap.has-image .search-image-btn {
  display: none;
}

.products-search-wrap.has-image .search-image-preview,
.products-search-wrap.has-image .search-image-preview-label,
.products-search-wrap.has-image .search-image-clear,
.products-search-wrap.has-image .search-image-go {
  display: flex;
}

.products-search-wrap .search-image-preview {
  width: 32px;
  height: 32px;
}

.products-search-wrap .search-image-preview-label {
  font-size: 13px;
}

.products-search-wrap .search-image-btn,
.products-search-wrap .products-image-btn {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
}

.products-search-wrap .search-image-go {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-filters {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-filters:hover,
.btn-filters.is-active {
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.1);
  color: var(--purple-light);
}

.products-count {
  padding: 10px 18px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  color: var(--purple-light);
  white-space: nowrap;
}

.products-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px;
  color: var(--text-muted);
}

.active-filter-chip button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

.active-filter-chip button:hover {
  color: var(--text);
}

/* Item Grid */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.item-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.item-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  flex: 1;
}

.item-card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.item-image {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
}

.item-verified {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #4ade80;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

.item-verified svg {
  flex-shrink: 0;
}

.item-image-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
}

.item-image-bg {
  width: 100%;
  height: 100%;
  transition: transform 0.5s ease;
}

.item-card:hover .item-image-bg {
  transform: scale(1.04);
}

.item-body {
  padding: 16px;
}

.item-actions {
  display: flex;
  gap: 8px;
  padding: 0 16px 16px;
}

.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.item-tag {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.item-tag-category {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.item-tag-best {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.item-tag-budget {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.item-tag-random {
  background: rgba(161, 161, 170, 0.12);
  border: 1px solid rgba(161, 161, 170, 0.25);
  color: #a1a1aa;
}

.item-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
}

.item-price {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 0;
}

.btn-view-agents {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-view-agents:hover {
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.08);
  color: var(--purple-light);
}

.btn-item-link {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-item-link:hover {
  border-color: rgba(236, 72, 153, 0.4);
  color: var(--pink-light);
  background: rgba(236, 72, 153, 0.08);
}

.items-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.items-empty h3 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--text);
}

/* ===== Filter Modal ===== */
.filter-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 4, 8, 0.75);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.filter-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.filter-panel {
  width: 100%;
  max-width: 420px;
  max-height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
  background: rgba(14, 14, 20, 0.98);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  transform: scale(0.92) translateY(20px);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.35s ease;
}

.filter-overlay.is-open .filter-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
}

.filter-header h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.filter-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-close:hover {
  color: var(--text);
  border-color: var(--border-hover);
}

.filter-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.filter-section {
  margin-bottom: 28px;
}

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

.filter-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--purple-light);
  margin-bottom: 12px;
}

.filter-categories {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.filter-categories::-webkit-scrollbar {
  width: 4px;
}

.filter-categories::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 4px;
}

.filter-cat-btn {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-cat-btn:hover {
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.06);
}

.filter-cat-btn.is-active {
  border-color: rgba(139, 92, 246, 0.6);
  background: rgba(139, 92, 246, 0.12);
  color: var(--purple-light);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.15);
}

.filter-price-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.filter-input-wrap label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.filter-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.filter-input:focus {
  border-color: rgba(139, 92, 246, 0.45);
}

.filter-select {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23a1a1aa' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.filter-select:focus {
  border-color: rgba(139, 92, 246, 0.45);
}

.filter-footer {
  display: flex;
  gap: 10px;
  padding: 0 24px 24px;
}

.filter-footer .btn {
  flex: 1;
}

.btn-filter-clear {
  background: transparent;
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: var(--purple-light);
}

.btn-filter-clear:hover {
  background: rgba(139, 92, 246, 0.08);
}

.btn-filter-apply {
  background: var(--gradient-btn);
  color: white;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
}

@media (max-width: 1024px) {
  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .products-page {
    padding: calc(var(--nav-height) + var(--safe-top) + 20px) 16px 56px;
  }

  .products-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .products-search-wrap {
    min-width: 0;
    width: 100%;
    border-radius: var(--radius);
    flex-wrap: wrap;
  }

  .products-search-wrap .search-image-btn,
  .products-search-wrap .search-image-go {
    flex: 1 1 auto;
  }

  .btn-filters,
  .products-count {
    width: 100%;
    justify-content: center;
  }

  .products-count {
    text-align: center;
  }

  .items-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .item-body {
    padding: 12px;
  }

  .item-title {
    font-size: 14px;
  }

  .item-price {
    font-size: 17px;
  }

  .btn-view-agents {
    font-size: 12px;
    padding: 10px 12px;
  }

  .filter-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .filter-panel {
    width: 100%;
    max-width: none;
    border-radius: 24px 24px 0 0;
    max-height: min(88vh, 720px);
  }
}

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

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

  .item-actions .btn-view-agents {
    width: 100%;
  }
}
