/* =============================================
   WAStore Marketplace — CSS
   Minimalis · Clean · Mobile-first
   ============================================= */

:root {
  --green:      #25D366;
  --green-dark: #1aad52;
  --green-soft: #f0fdf4;
  --text:       #111827;
  --text-2:     #6b7280;
  --text-3:     #9ca3af;
  --border:     #e5e7eb;
  --bg:         #ffffff;
  --bg-2:       #f9fafb;
  --bg-3:       #f3f4f6;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06);
  --shadow:     0 2px 8px rgba(0,0,0,.08);
  --font:       'Plus Jakarta Sans', sans-serif;
  --max-w:      1120px;
  --transition: .15s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button, input, select { font-family: inherit; }
ul { list-style: none; }

/* ── Utility ── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Navbar ── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  height: 52px;
}
.nav-inner {
  display: flex; align-items: center; gap: 8px; height: 100%;
}
.brand {
  display: flex; align-items: center; gap: 7px;
  font-weight: 700; font-size: .95rem; letter-spacing: -.01em;
  margin-right: auto;
}
.brand svg { flex-shrink: 0; }
.nav-marketplace {
  padding: 5px 12px; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 500; color: var(--text-2);
  transition: color var(--transition), background var(--transition);
}
.nav-marketplace:hover,
.nav-marketplace.active { color: var(--green-dark); background: var(--green-soft); }
.nav-cta {
  padding: 6px 14px; border-radius: var(--radius-sm);
  background: var(--green); color: #fff;
  font-size: .82rem; font-weight: 600;
  transition: background var(--transition);
}
.nav-cta:hover { background: var(--green-dark); }

/* ── Hero / Search bar ── */
.mkt-hero {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 24px 0 20px;
}
.mkt-hero h1 {
  font-size: 1.25rem; font-weight: 700; margin-bottom: 4px;
}
.mkt-hero p { font-size: .85rem; color: var(--text-2); margin-bottom: 16px; }

.search-wrap {
  display: flex; gap: 8px;
}
.search-input-group {
  position: relative; flex: 1;
}
.search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-3); pointer-events: none;
}
.search-input {
  width: 100%; padding: 9px 12px 9px 34px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .9rem; background: #fff; outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--green); }
.search-btn {
  padding: 9px 18px; background: var(--green); color: #fff;
  border: none; border-radius: var(--radius-sm); font-size: .88rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background var(--transition);
}
.search-btn:hover { background: var(--green-dark); }

/* ── Category chips ── */
.cat-scroll {
  display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 2px;
  scrollbar-width: none;
}
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-chip {
  flex-shrink: 0; padding: 5px 13px;
  border: 1.5px solid var(--border); border-radius: 20px;
  font-size: .8rem; font-weight: 500; color: var(--text-2);
  background: #fff; cursor: pointer; white-space: nowrap;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.cat-chip:hover { border-color: var(--green); color: var(--green-dark); }
.cat-chip.active {
  border-color: var(--green); background: var(--green-soft);
  color: var(--green-dark);
}

/* ── Section layout ── */
.mkt-main { padding: 20px 0 40px; }
.section { margin-bottom: 28px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-title {
  font-size: 1rem; font-weight: 700; letter-spacing: -.01em;
}
.section-link {
  font-size: .78rem; color: var(--green-dark); font-weight: 500;
}
.section-link:hover { text-decoration: underline; }

/* ── Product grid ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 480px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
}
@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ── Product card ── */
.product-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex; flex-direction: column;
}
.product-card:hover {
  box-shadow: var(--shadow); transform: translateY(-1px);
}
.card-img-wrap {
  position: relative; aspect-ratio: 1;
  background: var(--bg-3); overflow: hidden;
}
.card-img {
  width: 100%; height: 100%; object-fit: cover;
  transition: opacity .2s;
}
.card-img.lazy { opacity: 0; }
.card-img.loaded { opacity: 1; }
.card-badge {
  position: absolute; top: 6px; left: 6px;
  background: var(--green); color: #fff;
  font-size: .65rem; font-weight: 700; padding: 2px 6px;
  border-radius: 4px; letter-spacing: .02em;
}
.card-body {
  padding: 8px 10px 10px; flex: 1; display: flex; flex-direction: column;
}
.card-name {
  font-size: .83rem; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 4px; color: var(--text);
}
.card-price {
  font-size: .9rem; font-weight: 700; color: var(--text);
  margin-bottom: 6px;
}
.card-store {
  margin-top: auto;
  display: flex; align-items: center; gap: 5px;
  font-size: .72rem; color: var(--text-2);
}
.store-avatar {
  width: 16px; height: 16px; border-radius: 50%; object-fit: cover;
  background: var(--bg-3); flex-shrink: 0;
}
.store-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.store-name:hover { color: var(--green-dark); text-decoration: underline; }

/* ── Ads banner ── */
.ad-banners {
  margin-bottom: 20px;
}
.ad-banner {
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: var(--bg-2);
  position: relative;
}
.ad-label {
  position: absolute; top: 6px; right: 8px;
  font-size: .6rem; color: var(--text-3); letter-spacing: .04em;
}
.ad-inner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; text-decoration: none; color: inherit;
}
.ad-img {
  width: 60px; height: 60px; object-fit: cover;
  border-radius: var(--radius-sm); background: var(--bg-3); flex-shrink: 0;
}
.ad-text-title { font-size: .85rem; font-weight: 600; margin-bottom: 2px; }
.ad-text-desc  { font-size: .75rem; color: var(--text-2); }

/* ── Ad inline (di dalam product-grid) ── */
.ad-inline-card {
  grid-column: 1 / -1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-2);
  position: relative;
}

/* ── Load more ── */
.load-more-wrap { text-align: center; margin-top: 20px; }
.btn-load-more {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 24px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: #fff;
  font-size: .85rem; font-weight: 500; cursor: pointer; color: var(--text);
  transition: border-color var(--transition), background var(--transition);
}
.btn-load-more:hover { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.btn-load-more.loading { pointer-events: none; opacity: .6; }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border); border-top-color: var(--green);
  border-radius: 50%; animation: spin .6s linear infinite;
  display: none;
}
.btn-load-more.loading .spinner { display: block; }

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 48px 16px; color: var(--text-2);
}
.empty-state svg { margin: 0 auto 12px; opacity: .35; }
.empty-state p { font-size: .9rem; }

/* ── Detail page ── */
.detail-wrap { padding: 16px 0 40px; }
.detail-img-wrap {
  width: 100%; aspect-ratio: 1; max-width: 420px;
  border-radius: var(--radius); overflow: hidden; background: var(--bg-3);
  margin: 0 auto 16px;
}
.detail-img { width: 100%; height: 100%; object-fit: cover; }
.detail-name {
  font-size: 1.15rem; font-weight: 700; margin-bottom: 6px;
}
.detail-price {
  font-size: 1.3rem; font-weight: 800; color: var(--text);
  margin-bottom: 12px;
}
.detail-desc { font-size: .88rem; color: var(--text-2); line-height: 1.7; margin-bottom: 16px; }
.variant-label { font-size: .8rem; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.variant-options { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.variant-chip {
  padding: 4px 12px; border: 1.5px solid var(--border); border-radius: 20px;
  font-size: .78rem; cursor: pointer; background: #fff;
  transition: all var(--transition);
}
.variant-chip.active { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.btn-order {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px; background: var(--green); color: #fff;
  border: none; border-radius: var(--radius-sm); font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: background var(--transition);
}
.btn-order:hover { background: var(--green-dark); }
.detail-store-card {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
  margin: 16px 0; text-decoration: none; color: inherit;
  transition: box-shadow var(--transition);
}
.detail-store-card:hover { box-shadow: var(--shadow); }
.detail-store-logo {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--bg-3);
}
.detail-store-name { font-size: .9rem; font-weight: 600; }
.detail-store-sub  { font-size: .75rem; color: var(--text-2); }

/* ── Related products ── */
.related-section { margin-top: 24px; }
.related-title { font-size: .95rem; font-weight: 700; margin-bottom: 12px; }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 0; margin-top: 20px;
}
.footer-inner {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center; justify-content: space-between;
  font-size: .77rem; color: var(--text-2);
}
.footer-links { display: flex; gap: 14px; }
.footer-links a:hover { color: var(--green-dark); }
.footer-inner a { transition: color var(--transition); }

/* ── Skeleton loader ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-3) 25%, #ececec 50%, var(--bg-3) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
  border-radius: 4px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes spin    { to { transform: rotate(360deg); } }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tab-btn {
  padding: 8px 16px; font-size: .82rem; font-weight: 600; cursor: pointer;
  border: none; background: none; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn.active { color: var(--green-dark); border-bottom-color: var(--green); }

/* ── No stock badge ── */
.badge-sold { background: var(--bg-3); color: var(--text-3) !important; }

/* ── Responsive tweaks ── */
@media (max-width: 360px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card-price { font-size: .82rem; }
}
