/* =====================================================================
   KATALOG.CSS — style halaman katalog.html
   Kartu produk & bintang rating juga dipakai di detail.html
   (bagian "Produk Terkait"), jadi file ini dimuat di kedua halaman.
   ===================================================================== */

/* =====================================================================
   1. HEADER HALAMAN
   ===================================================================== */
.page-header {
  position: relative;
  overflow: hidden;
  /* Naik ke belakang navbar transparan, sama seperti hero di landing */
  margin-top: calc(var(--nav-h) * -1);
  padding: calc(var(--nav-h) + var(--space-12)) 0 var(--space-10);
  text-align: center;
}
.ph-blob-1 { width: 380px; height: 380px; top: -160px; left: -100px; opacity: 0.35; }
.ph-blob-2 { width: 340px; height: 340px; top: -120px; right: -100px; opacity: 0.22; }
.page-header-inner { position: relative; z-index: 1; }
.page-header h1 { margin-bottom: var(--space-3); font-size: clamp(2rem, 1.3rem + 3vw, 3.25rem); }
.page-header p { max-width: 560px; margin-inline: auto; font-size: 1.0625rem; color: var(--text-muted); }

/* =====================================================================
   2. AREA KATALOG & TOOLBAR
   ===================================================================== */
.catalog-section { padding-bottom: var(--space-24); }
.catalog-section > .container { max-width: 1320px; }

.catalog-toolbar {
  position: sticky;
  top: calc(var(--nav-h) + 10px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  background: rgba(18, 18, 26, 0.72);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.toolbar-row { display: flex; align-items: center; gap: var(--space-3); }

/* ---------- Search ---------- */
.search-box { position: relative; flex: 1; min-width: 0; }
.search-box .input { padding-left: 2.9rem; padding-right: 2.9rem; }
.search-icon {
  position: absolute; left: 1rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  transition: color var(--transition);
}
.search-box:focus-within .search-icon { color: var(--primary-light); }
.search-box input[type="search"]::-webkit-search-cancel-button { display: none; } /* pakai tombol clear sendiri */
.search-clear {
  position: absolute; right: 0.6rem; top: 50%;
  transform: translateY(-50%);
  display: grid; place-items: center;
  width: 28px; height: 28px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  transition: all var(--transition);
}
.search-clear:hover { color: var(--text); background: rgba(255, 255, 255, 0.14); }

/* ---------- Sort ---------- */
.sort-box { position: relative; flex-shrink: 0; min-width: 210px; }
.sort-box .input { padding-left: 2.8rem; cursor: pointer; }
.sort-icon {
  position: absolute; left: 1rem; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--text-dim);
  pointer-events: none;
}

/* ---------- Chip kategori ---------- */
.toolbar-row-chips { min-width: 0; }
.chips {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  flex-shrink: 0;
  padding: 0.55rem 1rem;
  font-size: 0.875rem; font-weight: 600; white-space: nowrap;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: all var(--transition);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
.chip.active {
  color: #fff;
  background: var(--gradient);
  border-color: transparent;
  box-shadow: 0 8px 22px -8px rgba(124, 58, 237, 0.7);
}
.chip-count {
  min-width: 20px; padding: 1px 6px;
  font-size: 0.6875rem; font-weight: 700; text-align: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}
.chip-count:empty { display: none; }
.chip.active .chip-count { background: rgba(255, 255, 255, 0.25); }

.result-info { min-height: 1.5em; margin: 0 var(--space-1) var(--space-5); font-size: 0.875rem; color: var(--text-muted); }
.result-info strong { color: var(--text); }

/* =====================================================================
   3. GRID PRODUK (1 → 2 → 3 → 4 kolom)
   ===================================================================== */
.catalog-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-6); }
@media (min-width: 640px)  { .catalog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .catalog-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .catalog-grid { grid-template-columns: repeat(4, 1fr); } }

/* =====================================================================
   4. KARTU PRODUK
   ===================================================================== */
.product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  /* "backwards" (BUKAN "both"): setelah selesai, transform kembali normal
     sehingga efek hover (translateY) tetap bekerja. */
  animation: cardIn 0.5s var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}

.product-media { position: relative; }
.product-thumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #1A1A25; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.product-card:hover .product-thumb img { transform: scale(1.07); }

.thumb-fallback { display: grid; place-items: center; width: 100%; height: 100%; color: var(--primary-light); background: var(--gradient-soft); }
.thumb-fallback [data-lucide], .thumb-fallback .lucide { width: 40px; height: 40px; opacity: 0.7; }

.product-cat {
  position: absolute; top: 12px; left: 12px;
  color: var(--text);
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.product-discount {
  position: absolute; top: 12px; right: 12px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #EF4444, #F59E0B);
  border-radius: var(--radius-full);
  box-shadow: 0 6px 16px -4px rgba(239, 68, 68, 0.6);
}

.product-body { display: flex; flex-direction: column; flex: 1; padding: var(--space-5); }
.product-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-3); font-size: 0.8125rem; color: var(--text-muted); }
.rating-num { font-weight: 700; color: var(--text); }
.meta-dot { opacity: 0.5; }

/* Bintang rating: mask SVG + gradient → mendukung isi sebagian (mis. 4.6) */
.stars { display: inline-flex; gap: 2px; }
.star {
  --fill: 100%;
  width: 14px; height: 14px;
  background: linear-gradient(90deg, var(--warning) var(--fill), rgba(255, 255, 255, 0.16) var(--fill));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/%3E%3C/svg%3E") center / contain no-repeat;
}

.product-title {
  margin-bottom: var(--space-2);
  font-size: 1.0625rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-title a { transition: color var(--transition); }
.product-title a:hover { color: var(--primary-light); }
.product-desc {
  margin-bottom: var(--space-5);
  font-size: 0.875rem; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.product-footer {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  margin-top: auto; padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}
.product-price { display: flex; flex-direction: column; min-width: 0; }
.price-now { font-family: var(--font-heading); font-size: 1.1875rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.price-old { font-size: 0.8125rem; color: var(--text-dim); text-decoration: line-through; }

/* =====================================================================
   5. SKELETON KARTU
   ===================================================================== */
.product-card.is-skeleton { cursor: default; }
.product-card.is-skeleton:hover { transform: none; }
.skeleton-thumb { width: 100%; aspect-ratio: 16 / 9; border-radius: 0; }

/* =====================================================================
   6. EMPTY / ERROR STATE
   ===================================================================== */
.empty-state {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  padding: var(--space-16) var(--space-6);
  text-align: center;
  background: var(--card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-xl);
}
.empty-art { width: 200px; max-width: 60%; height: auto; margin-bottom: var(--space-2); animation: float 6s ease-in-out infinite; }
.empty-state h3 { font-size: 1.25rem; }
.empty-state p { max-width: 420px; margin-bottom: var(--space-3); font-size: 0.9375rem; color: var(--text-muted); }

/* =====================================================================
   7. MUAT LEBIH BANYAK
   ===================================================================== */
.load-more-wrap { display: flex; justify-content: center; margin-top: var(--space-10); }
.load-more-count { font-weight: 500; color: var(--text-muted); }

/* =====================================================================
   8. KEYFRAMES
   ===================================================================== */
@keyframes cardIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* =====================================================================
   9. RESPONSIVE
   ===================================================================== */
@media (max-width: 768px) {
  .page-header { padding-bottom: var(--space-8); }
  /* Toolbar tidak lengket di mobile → hemat ruang layar */
  .catalog-toolbar { position: static; padding: var(--space-3); }
}

@media (max-width: 640px) {
  .page-header { padding-top: calc(var(--nav-h) + var(--space-8)); }
  .toolbar-row:first-child { flex-direction: column; align-items: stretch; }
  .sort-box { min-width: 0; }
  .empty-state { padding: var(--space-12) var(--space-5); }
}