/* ============================================================
   Zalin Labs - 3d.css (G404 - Marketplace 3D MVP)
   PATCH G407 (keputusan Boss RK-Q7AQ6G, opsi a): preview =
   galeri gambar angle ala CGTrader; CSS model-viewer dihapus,
   diganti CSS galeri (stage + thumbnail + tombol navigasi).
   Komponen khusus halaman /3d. Token warna memakai variabel
   global dari /styles.css (dark navy + aksen periwinkle).
   ============================================================ */

.m3d-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(5, 6, 15, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-light);
}

.m3d-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.m3d-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.m3d-brand-img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.m3d-brand-name { font-size: 1.02rem; letter-spacing: -0.01em; }

.m3d-nav-links { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }

.m3d-nav-link {
  font-size: 0.92rem;
  color: var(--text-muted-light);
  font-weight: 500;
  transition: color 0.18s ease;
}
.m3d-nav-link:hover { color: var(--text-light); }
.m3d-nav-link.active { color: var(--accent); font-weight: 600; }

.m3d-wrap { padding-top: 40px; padding-bottom: 64px; flex: 1 0 auto; }

.m3d-loading {
  color: var(--text-muted-light);
  padding: 60px 0;
  text-align: center;
}

/* ---------- katalog ---------- */
.m3d-hero { padding: 18px 0 30px; }

.m3d-hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.m3d-hero p {
  margin-top: 10px;
  max-width: 620px;
  color: var(--text-muted-light);
  font-size: 0.98rem;
}

.m3d-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 18px;
}

.m3d-card {
  background: var(--bg-card-dark);
  border: 1px solid var(--line-light);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.m3d-card:hover {
  transform: translateY(-3px);
  border-color: rgba(107, 124, 255, 0.45);
  box-shadow: var(--shadow-glow);
}

.m3d-card-viewer {
  height: 190px;
  background:
    radial-gradient(120% 90% at 50% 10%, rgba(107, 124, 255, 0.12) 0%, rgba(13, 19, 34, 0) 60%),
    var(--bg-dark-2);
}
.m3d-card-viewer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.m3d-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }

.m3d-card-cat {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.m3d-card-title { font-size: 1.06rem; font-weight: 700; letter-spacing: -0.01em; }

.m3d-card-price { font-size: 1rem; font-weight: 700; color: var(--text-light); }

.m3d-card-actions { margin-top: auto; padding-top: 10px; display: flex; gap: 10px; }

.m3d-badge-soon {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted-light);
  border: 1px dashed var(--line-light);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ---------- detail ---------- */
.m3d-back {
  display: inline-block;
  color: var(--text-muted-light);
  font-size: 0.9rem;
  margin-bottom: 18px;
}
.m3d-back:hover { color: var(--accent); }

.m3d-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr);
  gap: 26px;
  align-items: start;
}

.m3d-viewer-wrap {
  background:
    radial-gradient(120% 90% at 50% 10%, rgba(107, 124, 255, 0.14) 0%, rgba(13, 19, 34, 0) 60%),
    var(--bg-card-dark);
  border: 1px solid var(--line-light);
  border-radius: var(--radius);
  overflow: hidden;
}

.m3d-viewer-note {
  padding: 10px 16px;
  font-size: 0.8rem;
  color: var(--text-muted-light);
  border-top: 1px solid var(--line-light);
}

/* ---------- galeri gambar angle (G407) ---------- */
.m3d-gallery-stage { position: relative; }

.m3d-gallery-stage img#m3d-gal-main {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #eceef2;
}

.m3d-gal-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(8, 10, 20, 0.55);
  color: #ffffff;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.m3d-gal-btn:hover { background: rgba(8, 10, 20, 0.78); }
.m3d-gal-btn.prev { left: 12px; }
.m3d-gal-btn.next { right: 12px; }
.m3d-gal-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.m3d-gal-count {
  position: absolute;
  left: 12px;
  top: 12px;
  background: rgba(8, 10, 20, 0.62);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.m3d-gallery-thumbs {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
}

.m3d-gal-thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 48px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: none;
  opacity: 0.72;
}
.m3d-gal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m3d-gal-thumb:hover { opacity: 1; }
.m3d-gal-thumb.active { border-color: var(--accent); opacity: 1; }
.m3d-gal-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- video turntable 360 (G412) ---------- */
.m3d-gallery-stage video#m3d-gal-vid {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #eceef2;
}
.m3d-thumb-vid { position: relative; }
.m3d-thumb-vid .m3d-play-ico {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: #ffffff;
  background: rgba(8, 10, 20, 0.42);
  pointer-events: none;
}

.m3d-info { display: flex; flex-direction: column; gap: 14px; }

.m3d-info h1 {
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.m3d-price-big { font-size: 1.5rem; font-weight: 800; color: var(--accent); }

.m3d-desc { color: var(--text-muted-light); font-size: 0.95rem; }

.m3d-specs {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  font-size: 0.9rem;
  border: 1px solid var(--line-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--bg-dark-2);
}
.m3d-specs dt { color: var(--text-muted-light); }
.m3d-specs dd { color: var(--text-light); font-weight: 600; margin: 0; }

.m3d-buy {
  border: 1px solid var(--line-light);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--bg-dark-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.m3d-buy label { font-size: 0.86rem; color: var(--text-muted-light); font-weight: 600; }

.m3d-input {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--bg-dark);
  color: var(--text-light);
  font-family: var(--font);
  font-size: 0.95rem;
}
.m3d-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.m3d-buy-note { font-size: 0.8rem; color: var(--text-muted-light); }

.m3d-msg {
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.88rem;
  border: 1px solid var(--line-light);
  background: var(--bg-card-dark);
  color: var(--text-light);
}
.m3d-msg.err { border-color: rgba(255, 99, 99, 0.45); }
.m3d-msg.ok { border-color: rgba(94, 204, 138, 0.45); }

.m3d-refcode {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(107, 124, 255, 0.12);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
}

/* ---------- pesanan ---------- */
.m3d-order-box {
  max-width: 640px;
  margin: 0 auto;
  border: 1px solid var(--line-light);
  border-radius: var(--radius);
  padding: 26px;
  background: var(--bg-card-dark);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.m3d-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.86rem;
  width: max-content;
}
.m3d-status.pending { color: #f0c36c; border: 1px solid rgba(240, 195, 108, 0.4); }
.m3d-status.paid { color: #5ecc8a; border: 1px solid rgba(94, 204, 138, 0.45); }
.m3d-status.unknown { color: var(--text-muted-light); border: 1px solid var(--line-light); }

.m3d-order-rows { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 0.92rem; }
.m3d-order-rows dt { color: var(--text-muted-light); }
.m3d-order-rows dd { margin: 0; font-weight: 600; }

.m3d-actions-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- footer ---------- */
.m3d-footer {
  border-top: 1px solid var(--line-light);
  background: var(--bg-dark-2);
  margin-top: auto;
}
.m3d-foot-inner { padding: 18px 24px; }
.m3d-foot-inner p { color: var(--text-muted-light); font-size: 0.85rem; }
.m3d-foot-link { color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .m3d-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .m3d-nav { min-height: 58px; }
  .m3d-nav-links { gap: 14px; }
  .m3d-wrap { padding-top: 24px; }
  .m3d-grid { grid-template-columns: 1fr; }
  .m3d-gal-btn { width: 34px; height: 34px; font-size: 1.2rem; }
  .m3d-order-box { padding: 20px; }
}

/* G441: tombol Beranda di navbar 3D (ke zalinlabs.com) */
.m3d-nav-home { display: inline-flex; align-items: center; gap: 5px; }
.m3d-home-ico { display: none; }
@media (max-width: 560px) {
  .m3d-home-label { display: none; }
  .m3d-home-ico { display: inline-block; }
}

/* ============================================================
   G473: bar filter kategori aktif di katalog utama (?cat= dari
   chips halaman /3d/rumah/) - dark, konsisten tema marketplace.
   ============================================================ */
.m3d-catbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  margin: 0 0 18px;
  border: 1px solid rgba(124, 108, 255, 0.35);
  border-radius: 12px;
  background: rgba(124, 108, 255, 0.08);
}

.m3d-catbar-label {
  font-size: 13.5px;
  font-weight: 600;
  color: #cfc9ff;
}

.m3d-catbar-clear {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #dfe1ee;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.m3d-catbar-clear::before {
  content: "\2715";
  font-size: 11px;
  line-height: 1;
}

.m3d-catbar-clear:hover {
  background: #6c5ce7;
  border-color: #6c5ce7;
  color: #ffffff;
}

/* ============================================================
   G473 QA FIX (bug warisan terverifikasi live di /3d/ 390px):
   navbar m3d di layar kecil - brand overlap menu + toggle bahasa
   jatuh menimpa. Solusi: nav boleh wrap, brand nowrap, links
   menyusul di baris berikutnya secara rapi tanpa overlap.
   ============================================================ */
@media (max-width: 620px) {
  .m3d-nav {
    flex-wrap: wrap;
    row-gap: 4px;
    padding-top: 12px;
    padding-bottom: 12px;
    justify-content: flex-start;
  }
  .m3d-brand {
    flex: 0 0 100%;
    max-width: 100%;
  }
  .m3d-brand-name { white-space: nowrap; }
  .m3d-nav-links {
    flex: 0 0 100%;
    max-width: 100%;
    gap: 10px 16px;
    justify-content: flex-start;
    row-gap: 8px;
  }
  .m3d-nav-link { font-size: 0.88rem; white-space: nowrap; }
}
