:root {
  --bg: #f4f7f3;
  --surface: #ffffff;
  --green-950: #0c2b1c;
  --green-900: #13452a;
  --green-700: #1f5b3c;
  --green-500: #2f855a;
  --green-400: #48a06e;
  --green-100: #e3f2e9;
  --green-50: #f0f8f3;
  --text: #18281f;
  --muted: #68786f;
  --border: #e2ebe4;
  --accent: #e9a23b;
  --accent-soft: #fdf0da;
  --danger: #d64545;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 2px 12px rgba(13, 45, 26, 0.06);
  --shadow-md: 0 8px 28px rgba(13, 45, 26, 0.10);
  --shadow-lg: 0 20px 60px rgba(13, 45, 26, 0.20);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img { display: block; max-width: 100%; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.hidden { display: none !important; }

/* ============ HERO ============ */
.hero {
  position: relative;
  background:
    radial-gradient(1200px 500px at 80% -20%, rgba(233,162,59,.25), transparent 60%),
    linear-gradient(135deg, var(--green-950), var(--green-700));
  color: #fff;
  padding: 20px 20px 60px;
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 12% 90%, rgba(255,255,255,.06), transparent 40%);
  pointer-events: none;
}
.hero-inner {
  position: relative; z-index: 1;
  max-width: 1080px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  font-size: 36px; line-height: 1;
  width: 60px; height: 60px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 18px;
  backdrop-filter: blur(4px);
}
.brand-name { font-size: 28px; font-weight: 800; letter-spacing: 1.5px; line-height: 1; }
.brand-name .logo-dot { color: var(--accent); }
.brand-tag { color: rgba(255,255,255,0.82); font-size: 14px; margin-top: 4px; }

.hero-search { position: relative; }
.hero-search input {
  width: 100%; padding: 17px 48px 17px 20px;
  border: none; border-radius: 16px;
  font-size: 16px; font-family: inherit; color: var(--text);
  box-shadow: var(--shadow-md);
}
.hero-search input::placeholder { color: var(--muted); }
.hero-search input:focus { outline: 3px solid rgba(233,162,59,.55); outline-offset: 1px; }
.hero-search .search-icon {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 18px; pointer-events: none; opacity: .5;
}

/* ============ CONTAINER ============ */
.container { max-width: 1080px; margin: -52px auto 0; padding: 0 20px; }

/* Toolbar */
.tab-bar {
  display: flex; gap: 0; margin-bottom: 18px;
  background: var(--surface); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.tab {
  flex: 1; padding: 13px 16px;
  background: transparent; color: var(--muted);
  border: none; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 800;
  transition: all .15s; position: relative;
}
.tab + .tab { border-left: 1px solid var(--border); }
.tab.badge::after {
  content: attr(data-count);
  display: inline-block; margin-left: 6px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px;
}
.tab:hover { background: var(--green-50); }
.tab.active { background: var(--green-700); color: #fff; }
.tab.active.badge::after { background: #fff; color: var(--green-700); }

.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--surface); border-radius: 16px;
  padding: 16px 20px; margin-bottom: 22px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.section-title { font-size: 17px; font-weight: 700; }
.section-title .count-chip {
  display: inline-block; background: var(--green-100); color: var(--green-700);
  font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px;
  margin-left: 6px; vertical-align: middle;
}
.sort-wrap { position: relative; }
.sort-wrap select {
  appearance: none; -webkit-appearance: none;
  padding: 11px 36px 11px 16px; border-radius: 11px;
  border: 1px solid var(--border); background: #fff;
  font-family: inherit; font-size: 14px; color: var(--text); cursor: pointer;
}
.sort-wrap::after {
  content: "▾"; position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%); pointer-events: none; color: var(--muted); font-size: 12px;
}

/* ============ GRID ============ */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  cursor: pointer; box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }
.card:active { transform: translateY(-2px) scale(.99); }

.card-img-wrap { position: relative; aspect-ratio: 1 / 1; background: var(--green-50); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.card-img {
  width: 100%; height: 100%; object-fit: contain;
  transition: transform .4s ease;
}
.card:hover .card-img { transform: scale(1.05); }
.card-badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(255,255,255,.92); color: var(--green-700);
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

.card-body { padding: 14px 16px 16px; }
.card-name {
  font-size: 15px; font-weight: 700; margin-bottom: 2px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; display: flex; align-items: center; gap: 5px; }
.card-stock {
  font-size: 12.5px; font-weight: 700; color: var(--green-700);
  background: var(--green-100); display: inline-block; padding: 3px 10px;
  border-radius: 999px; margin-bottom: 10px;
}
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { font-size: 17px; font-weight: 800; color: var(--green-700); }
.price-suffix { font-size: 11px; color: var(--muted); font-weight: 500; }
.wa-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--green-50); color: var(--green-700);
  font-size: 12px; font-weight: 700; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--green-100); white-space: nowrap;
}
.wa-pill svg { flex-shrink: 0; }

/* Sold */
.card.is-sold { opacity: .92; }
.card.is-sold .card-img { filter: grayscale(.55) brightness(.92); }
.sold-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.28);
}
.sold-tag {
  background: #e14b4b; color: #fff; font-size: 14px; font-weight: 800;
  padding: 8px 18px; border-radius: 999px; letter-spacing: 1px;
  box-shadow: 0 4px 14px rgba(0,0,0,.3); text-transform: uppercase;
}
.card.is-sold .price { color: #a94646; }
.sold-note {
  background: var(--accent-soft); color: #8a5a12; padding: 14px 16px;
  border-radius: 12px; font-size: 14px; margin-top: 4px; text-align: center;
}
.modal-img-sold { filter: grayscale(.5) brightness(.94); }

/* ============ EMPTY ============ */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-emoji { font-size: 52px; margin-bottom: 14px; }
.empty h3 { font-size: 18px; color: var(--text); margin-bottom: 4px; }

/* ============ SKELETON ============ */
.skeleton {
  border-radius: var(--radius); background: #fff; overflow: hidden;
  border: 1px solid var(--border);
}
.sk-img { aspect-ratio: 1/1; background: linear-gradient(90deg,#eef3ee,#e3ece5,#eef3ee); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.sk-line { height: 14px; border-radius: 6px; margin: 12px 16px; background: linear-gradient(90deg,#eef3ee,#e3ece5,#eef3ee); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.sk-line.short { width: 50%; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ============ LOAD MORE ============ */
.load-more-wrap { text-align: center; margin: 30px 0 10px; }
.btn { border: none; cursor: pointer; font-family: inherit; font-size: 15px; font-weight: 700; border-radius: 12px; transition: background .15s, transform .1s; }
.btn:active { transform: scale(.97); }
.btn-ghost { background: #fff; color: var(--green-700); padding: 14px 32px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--green-50); }
.btn-ghost:disabled { opacity: .6; cursor: default; }

/* ============ FOOTER ============ */
.footer { text-align: center; padding: 44px 20px 70px; color: var(--muted); font-size: 13px; }

/* ============ MODAL DETAIL ============ */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 22, 15, .65); backdrop-filter: blur(3px); animation: fadeIn .2s; }
.modal-card {
  position: relative; background: #fff; border-radius: 24px 24px 0 0;
  width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto;
  z-index: 1; box-shadow: var(--shadow-lg); animation: slideUp .3s cubic-bezier(.22,1,.36,1);
}
.modal-close {
  position: fixed; top: 14px; right: 14px;
  width: 42px; height: 42px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.5); color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer; z-index: 3;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(0,0,0,.65); }
.modal-img { width: 100%; max-height: 46vh; object-fit: contain; display: block; background: #f0f5f1; }
.modal-content { padding: 24px; }
.modal-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green-100); color: var(--green-700);
  font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  margin-bottom: 12px;
}
.modal-content h3 { font-size: 24px; font-weight: 800; line-height: 1.25; margin-bottom: 6px; }
.modal-age { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.modal-stock {
  display: inline-block; background: var(--green-100); color: var(--green-700);
  font-size: 13.5px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  margin-bottom: 14px;
}
.modal-price-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.modal-price { font-size: 28px; font-weight: 800; color: var(--green-700); }
.modal-price-sub { color: var(--muted); font-size: 14px; }
.modal-desc { color: #3b4a41; margin-bottom: 24px; white-space: pre-wrap; font-size: 15px; }
.btn-wa {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #25d366; color: #fff; padding: 16px 20px;
  font-size: 16px; font-weight: 800; border-radius: 16px;
  text-decoration: none; width: 100%; transition: background .15s;
}
.btn-wa:hover { background: #1fb958; }
.btn-wa svg { flex-shrink: 0; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(40px); opacity: .6 } to { transform: translateY(0); opacity: 1 } }

/* ============ RESPONSIVE ============ */
@media (min-width: 560px) {
  .modal { align-items: center; padding: 20px; }
  .modal-card { border-radius: 24px; }
  .modal-img { max-height: 380px; }
}

@media (max-width: 520px) {
  .hero { padding: 14px 16px 52px; }
  .brand-gap, .hero-inner { gap: 14px; }
  .brand-logo { font-size: 26px; width: 44px; height: 44px; border-radius: 13px; }
  .brand-name { font-size: 20px; letter-spacing: 1px; }
  .brand-tag { font-size: 12px; }
  .hero-search input { padding: 13px 42px 13px 16px; font-size: 14px; border-radius: 13px; }
  .container { margin-top: -36px; padding: 0 14px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-name { font-size: 13.5px; }
  .price { font-size: 15px; }
  .card-body { padding: 12px 13px 14px; }
  .toolbar { flex-direction: column; gap: 10px; align-items: stretch; padding: 14px; }
  .toolbar .sort-wrap select { width: 100%; }
  .modal-content h3 { font-size: 21px; }
  .modal-desc { font-size: 13.5px; margin-bottom: 18px; }
}
