/* ============================================================
   AMANAH OFFICIAL — Komponen (design system v2)
   File : public/assets/css/components.css
   Header, bottom nav, kartu produk, footer, tombol WA, grid produk.
   ============================================================ */

/* ══════════ HEADER ══════════ */
.site-header {
  position: sticky; top: 0; z-index: 900;
  background: var(--brand-grad);
  color: #fff;
}
.site-header a { color: inherit; }

/* Baris atas (desktop) */
.sh-top { display: none; font-size: 13px; }
.sh-top-inner { display: flex; align-items: center; justify-content: space-between; height: 34px; }
.sh-top-left, .sh-top-right { display: flex; align-items: center; gap: 18px; }
.sh-top a, .sh-top-follow { display: inline-flex; align-items: center; gap: 6px; opacity: .95; }
.sh-top a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.sh-top .ic { width: 15px; height: 15px; }
.sh-sep { width: 1px; height: 13px; background: rgba(255, 255, 255, .5); }

.sh-account { position: relative; }
.sh-account-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; color: #fff; font-size: 13px; padding: 4px 0;
}
.sh-account .avatar { background: rgba(255, 255, 255, .25); color: #fff; }
.sh-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 190px; padding: 6px 0;
  background: var(--surface); color: var(--ink);
  border-radius: var(--r); box-shadow: var(--shadow-3);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility .15s;
  z-index: 950;
}
.sh-menu::before { /* jembatan hover antara tombol & menu */
  content: ''; position: absolute; left: 0; right: 0; top: -10px; height: 10px;
}
.sh-account:hover .sh-menu,
.sh-account.open .sh-menu { opacity: 1; visibility: visible; transform: none; }
.sh-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 14px; color: var(--ink); opacity: 1;
}
.sh-menu a:hover { background: var(--brand-50); color: var(--brand); text-decoration: none; }
.sh-menu .ic { width: 18px; height: 18px; color: var(--muted); }
.sh-menu a:hover .ic { color: var(--brand); }
.sh-menu-danger { border-top: 1px solid var(--line); margin-top: 4px; }

/* Bar utama */
.sh-main-inner {
  display: flex; align-items: center; gap: 10px;
  height: 56px;
}
.sh-logo { display: none; flex-shrink: 0; }
.sh-logo img { height: 52px; width: auto; }

.sh-search-wrap { flex: 1; min-width: 0; }
.sh-search {
  display: flex; align-items: center;
  background: var(--surface); border-radius: var(--r-sm);
  padding: 3px; box-shadow: 0 1px 2px rgba(0, 0, 0, .09);
}
.sh-search input {
  flex: 1; min-width: 0; height: 34px;
  border: 0; outline: 0; background: transparent;
  padding: 0 10px; font-size: 14px; color: var(--ink);
}
.sh-search input::placeholder { color: var(--muted); }
.sh-search input::-webkit-search-cancel-button { display: none; }
.sh-search-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 34px; border: 0; border-radius: var(--r-xs);
  background: var(--brand); color: #fff;
}
.sh-search-btn:hover { background: var(--brand-dark); }
.sh-hot { display: none; }

.sh-cart {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex-shrink: 0; color: #fff;
}
.sh-cart .cart-badge {
  position: absolute; top: 2px; right: 0;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; border: 2px solid var(--brand);
  background: var(--surface); color: var(--brand);
  font-size: 11px; font-weight: 700; line-height: 16px;
  align-items: center; justify-content: center;
}

@media (min-width: 768px) {
  .sh-top { display: block; }
  .sh-logo { display: block; }
  .sh-main-inner { height: 92px; gap: 28px; }
  .sh-search input { height: 38px; }
  .sh-search-btn { width: 64px; height: 36px; }
  .sh-hot { display: flex; gap: 14px; margin-top: 6px; font-size: 12px; overflow: hidden; height: 18px; }
  .sh-hot a { opacity: .9; white-space: nowrap; }
  .sh-hot a:hover { opacity: 1; }
  .sh-cart { width: 56px; }
}
@media (min-width: 1024px) {
  .sh-logo img { height: 64px; }
}

/* Sembunyikan header & promo strip legacy bila masih ter-render di view lama */
.topbar { display: none !important; }

/* ══════════ BOTTOM NAV (mobile) ══════════ */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: var(--bottom-nav-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgba(36, 26, 40, .05);
}
.bn-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; color: var(--muted);
}
.bn-item .ic { width: 22px; height: 22px; }
.bn-item.active { color: var(--brand); }
.bn-item.active .ic { stroke-width: 2.4; }

body.has-bottom-nav { padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); }

@media (min-width: 768px) {
  .bottom-nav { display: none; }
  body.has-bottom-nav { padding-bottom: 0; }
}

/* ══════════ TOMBOL WA MELAYANG ══════════ */
.wa-float {
  width: 48px !important; height: 48px !important;
  right: 14px !important;
  bottom: calc(var(--bottom-nav-h) + 14px + env(safe-area-inset-bottom)) !important;
  background: #25D366 !important; color: #fff !important;
  font-size: 0 !important;
  display: flex !important; align-items: center; justify-content: center;
  box-shadow: var(--shadow-2) !important;
}
@media (min-width: 768px) {
  .wa-float { width: 56px !important; height: 56px !important; right: 24px !important; bottom: 24px !important; }
}

/* ══════════ GRID & KARTU PRODUK ══════════ */
.product-grid,
.pgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 640px)  { .product-grid, .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } }
@media (min-width: 900px)  { .product-grid, .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .product-grid, .pgrid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .related-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.product-card-wrap { position: relative; min-width: 0; }
.product-grid > .product-empty { grid-column: 1 / -1; }

.pcard {
  display: flex; flex-direction: column; height: 100%;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
@media (hover: hover) {
  .pcard:hover { border-color: var(--brand); box-shadow: var(--shadow-2); transform: translateY(-1px); }
}

.pcard-img {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--brand-50);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.pcard-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.pcard-ph .ic { width: 40px; height: 40px; color: var(--brand-100); stroke-width: 1.5; }

.pcard-disc {
  position: absolute; top: 0; right: 0; z-index: 2;
  background: #FFE97A; color: var(--brand-dark);
  font-size: 12px; font-weight: 700;
  padding: 2px 6px; border-bottom-left-radius: var(--r-xs);
}
.pcard-badge {
  position: absolute; bottom: 8px; left: 0; z-index: 2;
  background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: 0 var(--r-xs) var(--r-xs) 0;
}

.pcard-body { display: flex; flex-direction: column; gap: 6px; padding: 8px; flex: 1; }
.pcard-name {
  font-size: 13px; font-weight: 400; line-height: 1.35; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: calc(13px * 1.35 * 2);
}
.pcard-price-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px; margin-top: auto; }
.pcard-price { color: var(--price); font-size: 16px; font-weight: 600; }
.pcard-orig { color: var(--muted); font-size: 12px; text-decoration: line-through; }
.pcard-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-2);
  min-height: 16px;
}
.pcard-rating { display: inline-flex; align-items: center; gap: 2px; }
.pcard-rating .ic { color: var(--star); }

/* Tombol kecil di atas kartu */
.pcard-wish,
.pcard-cart {
  position: absolute; z-index: 3;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .92); color: var(--ink-2);
  box-shadow: var(--shadow-1);
  font-size: 0; /* sembunyikan sisa emoji legacy */
}
.pcard-wish { top: 6px; left: 6px; }
.pcard-wish .ic { width: 17px; height: 17px; }
.pcard-wish.active { color: var(--brand); }
.pcard-wish.active .ic { fill: currentColor; }
.pcard-cart { right: 8px; bottom: 8px; background: var(--brand); color: #fff; width: 30px; height: 30px; }
.pcard-cart .ic { width: 18px; height: 18px; stroke-width: 2.5; }
.pcard-cart:hover { background: var(--brand-dark); }
/* beri ruang supaya harga tidak tertimpa tombol keranjang */
.product-card-wrap .pcard-meta { padding-right: 34px; }

/* ══════════ FOOTER ══════════ */
.site-footer {
  background: var(--surface);
  border-top: 4px solid var(--brand);
  margin-top: 32px;
  padding: 32px 0 20px;
  font-size: 13px; color: var(--ink-2);
}
.sf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 16px; }
@media (min-width: 900px) { .sf-grid { grid-template-columns: repeat(4, 1fr); gap: 32px; } }
.site-footer h4 {
  font-size: 12px; font-weight: 700; color: var(--ink);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 12px;
}
.site-footer ul { display: flex; flex-direction: column; gap: 8px; }
.site-footer a:hover { color: var(--brand); }
.sf-contact li a, .sf-contact li span { display: inline-flex; align-items: center; gap: 8px; }
.sf-contact .ic { width: 16px; height: 16px; color: var(--brand); }
.sf-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.sf-pill {
  padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-xs);
  font-size: 11px; font-weight: 600; color: var(--ink-2); background: var(--bg);
}
.sf-mt { margin-top: 18px; }
.sf-note { line-height: 1.5; }
.sf-social { display: flex; gap: 10px; margin-top: 14px; }
.sf-social a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
}
.sf-social a:hover { border-color: var(--brand); }
.sf-bottom {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  border-top: 1px solid var(--line); margin-top: 28px; padding-top: 18px; color: var(--muted);
}
.sf-bottom img { height: 40px; width: auto; }
@media (min-width: 640px) { .sf-bottom { flex-direction: row; justify-content: space-between; text-align: left; } }
.sh-notif { position: relative; }
.sh-notif b { background: #fff; color: var(--brand); font-size: 11px; border-radius: 9px; padding: 0 6px; line-height: 16px; margin-left: 2px; }
.sh-bell { width: 40px; }

/* ══════════ HALAMAN STATIS (legacy .page-hero) diselaraskan ke v2 ══════════ */
.page-hero {
  background: var(--surface) !important;
  padding: 18px 0 20px !important;
  border-bottom: 1px solid var(--line);
  min-height: 0 !important;
}
.page-hero::before, .page-hero::after { display: none !important; }
.page-hero h1 { color: var(--ink) !important; font-size: clamp(22px, 3vw, 30px) !important; margin: 6px 0 4px !important; }
.page-hero p { color: var(--ink-2) !important; font-size: 15px !important; }
.page-hero .page-breadcrumb, .page-hero .page-breadcrumb a, .page-hero .page-breadcrumb span { color: var(--muted) !important; font-size: 13px; }
.page-hero .page-breadcrumb a:hover { color: var(--brand) !important; }
.page-content { padding-top: 24px !important; padding-bottom: 32px !important; }
