:root {
  --bg: #10141a;
  --surface: #181d24;
  --surface-hover: #1f252e;
  --border: #262c35;
  --text: #ece9e4;
  --muted: #7d8590;
  --accent: #c9834a;
  --accent-soft: rgba(201, 131, 74, 0.16);
  --danger-soft: rgba(196, 90, 78, 0.16);
  --danger: #c45a4e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.5;
}

/* Topbar */
.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.brand-logo {
  height: 34px;
  width: auto;
  display: block;
}

.search-bar {
  flex: 1;
  min-width: 0;
}

#searchInput {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  padding: 11px 14px;
}

#searchInput:focus { border-color: var(--accent); }
#searchInput::placeholder { color: var(--muted); }

.sort-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sort-control label {
  color: var(--muted);
  font-size: 0.82rem;
}

#sortSelect {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.88rem;
  padding: 9px 10px;
  outline: none;
}

#sortSelect:focus { border-color: var(--accent); }

/* Layout */
.layout {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 28px;
  padding: 24px;
  align-items: flex-start;
}

/* Sidebar */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 76px;
}

.sidebar-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.86rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  text-align: left;
}

.pill:hover {
  border-color: var(--accent);
  color: var(--text);
}

.pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.pill .count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  opacity: 0.75;
}

/* Content */
.content { flex: 1; min-width: 0; }

.content-meta {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--surface-hover);
}

.card-content {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  flex: 1;
}

.card-img-wrap {
  position: relative;
}

.card-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #101317;
  display: block;
}

.discount-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
}

.card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-category {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  min-height: 2.4em;
}

.price-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 4px;
}

.price-now {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.price-original {
  font-size: 0.74rem;
  color: var(--muted);
  text-decoration: line-through;
  white-space: nowrap;
}

.sold-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

.card-link {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #14171c;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 10px 14px;
  border-radius: 8px;
  transition: opacity 0.15s ease;
}

.card-link:hover { opacity: 0.88; }

/* Empty state */
.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
}

/* Responsive */
@media (max-width: 800px) {
  .layout {
    flex-direction: column;
    padding: 16px;
  }
  .sidebar {
    width: 100%;
    position: static;
  }
  .category-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .topbar-inner {
    flex-wrap: wrap;
    padding: 12px 16px;
  }
  .brand { order: 1; }
  .search-bar { order: 3; flex-basis: 100%; }
  .sort-control { order: 2; margin-left: auto; }
}

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card-body { padding: 10px; }
}

/* ============ Halaman Detail Produk ============ */

.breadcrumb {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 0;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--accent); }

.detail-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 32px;
  margin-top: 20px;
}

.detail-image {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  aspect-ratio: 4 / 3;
}

.detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 4px 0 0;
  line-height: 1.3;
}

.detail-price-row {
  margin-top: 8px;
  gap: 12px;
}

.detail-price-row .price-now {
  font-size: 1.5rem;
}

.detail-price-row .price-original {
  font-size: 0.95rem;
}

.detail-buy-btn {
  margin-top: 16px;
  align-self: flex-start;
  padding: 13px 28px;
  font-size: 0.95rem;
}

/* Body: video + deskripsi */
.detail-body {
  margin-top: 40px;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.video-embed {
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.video-embed--16x9 {
  position: relative;
  aspect-ratio: 16 / 9;
}

.video-embed--16x9 iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-embed--tiktok,
.video-embed--instagram {
  display: flex;
  justify-content: center;
  background: transparent;
}

.video-embed-fallback a {
  color: var(--accent);
  font-size: 0.9rem;
}

.detail-description {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.7;
}

.detail-description p {
  margin: 0 0 14px;
}

.detail-description p:last-child { margin-bottom: 0; }

/* Related products */
.related-section {
  margin-top: 48px;
}

.related-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 16px;
}

.related-grid {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

@media (max-width: 800px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .detail-title { font-size: 1.2rem; }
  .related-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* ============ Sidebar 2 Level (Kategori > Sub-kategori) ============ */

.category-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pill-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chevron {
  font-size: 0.7rem;
  opacity: 0.6;
  width: 12px;
  text-align: center;
}

.subcategory-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
  margin-left: 8px;
}

.pill-sub {
  font-size: 0.8rem;
  padding: 7px 12px;
}

/* ============ Card Actions (2 tombol) ============ */

.card-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  padding: 0 12px 12px;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  transition: opacity 0.15s ease, border-color 0.15s ease;
  min-height: 34px;
  white-space: nowrap;
}

.btn-view {
  color: var(--text);
  background: transparent;
}

.btn-view:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-buy {
  background: var(--accent);
  color: #14171c;
  border-color: var(--accent);
}

.btn-buy:hover { opacity: 0.88; }

.btn-buy svg { flex-shrink: 0; }

/* Breadcrumb & category label di halaman detail juga ikut gaya monospace */
.breadcrumb {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}