/* =====================================================================
   TEXRON — Katalog & Detail Produk
   Dimuat setelah style.css dan layout.css
   ===================================================================== */

/* ---------------------------------------------------------------------
   TATA LETAK KATALOG
   --------------------------------------------------------------------- */
.catalog {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: var(--sp-6);
  align-items: start;
}

/* Sidebar filter ----------------------------------------------------- */
.filter-panel {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-4));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.filter-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--brand-blue);
  color: #fff;
}
.filter-panel__head h2 {
  margin: 0;
  font-size: var(--fs-lg);
  color: #fff;
}
.filter-panel__head a {
  font-size: var(--fs-sm);
  color: var(--brand-yellow);
  white-space: nowrap;
}
.filter-panel__head a:hover { color: #fff; }

.filter-group {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--line-soft);
}
.filter-group:last-child { border-bottom: 0; }

.filter-group__title {
  display: block;
  margin-bottom: var(--sp-3);
  font-family: var(--font-head);
  font-size: var(--fs-base);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink);
}

.filter-list { max-height: 250px; overflow-y: auto; }
.filter-list li + li { margin-top: 2px; }

.filter-option {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  cursor: pointer;
}
.filter-option:hover { background: var(--surface-alt); color: var(--brand-blue); }
.filter-option input { accent-color: var(--brand-blue); flex: none; }
.filter-option .count {
  margin-left: auto;
  font-size: var(--fs-xs);
  color: var(--ink-muted);
}
.filter-option.is-checked { color: var(--brand-blue); font-weight: 600; }

/* Area hasil --------------------------------------------------------- */
.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.catalog-toolbar__count { font-size: var(--fs-sm); color: var(--ink-muted); }
.catalog-toolbar__count strong { color: var(--ink); }

.catalog-toolbar__right { display: flex; align-items: center; gap: var(--sp-3); }
.catalog-toolbar select { min-width: 190px; }

.filter-toggle { display: none; }

/* Overlay panel filter — selalu fixed agar tidak ikut menempati sel grid.
   Kalau hanya fixed di media query mobile, di desktop ia menjadi grid item
   dan mendorong daftar produk ke kolom sidebar. */
.filter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 20, 50, .5);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s var(--ease);
  z-index: 125;
}
.filter-overlay.is-visible { opacity: 1; visibility: visible; }

/* Chip filter aktif */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.active-filters .chip {
  background: var(--brand-blue-100);
  border-color: transparent;
  color: var(--brand-blue);
  font-weight: 500;
}
.active-filters .chip svg { width: 13px; height: 13px; }
.active-filters .chip:hover { background: var(--brand-red-100); color: var(--brand-red-700); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-5);
}

/* Di katalog ada sidebar filter yang memakan ruang, jadi tiga kolom
   supaya kartunya tidak terlalu sempit. */
.catalog .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------------------------------------------------------------------
   KARTU PRODUK
   --------------------------------------------------------------------- */
.product-card { display: flex; flex-direction: column; height: 100%; }
.product-card .card__body { display: flex; flex-direction: column; flex: 1; }
.product-card .card__actions { margin-top: auto; }

.product-card__badges {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 1;
}

.product-card__docs {
  display: flex;
  gap: 5px;
  margin-bottom: var(--sp-3);
}

/* ---------------------------------------------------------------------
   DETAIL PRODUK
   --------------------------------------------------------------------- */
.product-detail {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: var(--sp-7);
  align-items: start;
}

/* Galeri -------------------------------------------------------------- */
.gallery__main {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.gallery__main img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: var(--sp-6);
}

.gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.gallery__thumb {
  aspect-ratio: 1 / 1;
  background: var(--surface-alt);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 5px;
  overflow: hidden;
  transition: border-color .18s var(--ease);
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: contain; }
.gallery__thumb:hover { border-color: var(--brand-blue-300); }
.gallery__thumb.is-active { border-color: var(--brand-red); }

/* Ringkasan ----------------------------------------------------------- */
.product-head__brand {
  display: inline-block;
  font-family: var(--font-head);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand-red);
  margin-bottom: var(--sp-2);
}
.product-head h1 { margin-bottom: var(--sp-3); }

.product-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.product-head__excerpt {
  font-size: var(--fs-lg);
  color: var(--ink-muted);
  margin-bottom: var(--sp-5);
}

/* Kotak permintaan penawaran ------------------------------------------ */
.rfq-box {
  padding: var(--sp-5);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-red);
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp-5);
}
.rfq-box__title {
  font-family: var(--font-head);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--sp-1);
}
.rfq-box__note {
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  margin-bottom: var(--sp-4);
}
.rfq-box__row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.rfq-box__actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.rfq-box__actions .btn { flex: 1 1 auto; }

/* Unduhan dokumen ----------------------------------------------------- */
.doc-links { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.doc-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
  transition: all .18s var(--ease);
}
.doc-link:hover { border-color: var(--brand-blue); color: var(--brand-blue); box-shadow: var(--shadow); }
.doc-link svg { width: 20px; height: 20px; color: var(--brand-red); flex: none; }
.doc-link small { display: block; font-weight: 400; color: var(--ink-muted); }

/* Blok konten --------------------------------------------------------- */
.detail-block { margin-top: var(--sp-7); }
.detail-block > h2 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--sp-2);
}
.detail-block .accent-bar { margin-bottom: var(--sp-5); }

.feature-list li {
  position: relative;
  padding-left: 30px;
  margin-bottom: var(--sp-3);
}
.feature-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 9px;
  width: 9px; height: 9px;
  background: var(--brand-yellow);
  transform: skewX(-18deg);
}

.prose { max-width: 72ch; }
.prose h3 { margin-top: var(--sp-5); font-size: var(--fs-xl); }
.prose ul { margin: 0 0 var(--sp-4) var(--sp-5); }
.prose ul li { list-style: disc; margin-bottom: var(--sp-2); }

/* ---------------------------------------------------------------------
   HALAMAN PENAWARAN (KERANJANG RFQ)
   --------------------------------------------------------------------- */
.rfq-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: var(--sp-6);
  align-items: start;
}

.rfq-items { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }

.rfq-item {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 150px 44px;
  gap: var(--sp-4);
  align-items: center;
  padding: var(--sp-4);
  border-bottom: 1px solid var(--line-soft);
}
.rfq-item:last-child { border-bottom: 0; }

.rfq-item__media {
  aspect-ratio: 1 / 1;
  background: var(--surface-alt);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.rfq-item__media img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }

.rfq-item__name {
  font-family: var(--font-head);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.rfq-item__meta { font-size: var(--fs-sm); color: var(--ink-muted); }

.rfq-item__qty { display: flex; align-items: center; gap: var(--sp-2); }
.rfq-item__qty .input { text-align: center; }

.rfq-item__remove {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-muted);
  justify-self: center;
}
.rfq-item__remove:hover { border-color: var(--brand-red); color: var(--brand-red); background: var(--brand-red-100); }
.rfq-item__remove svg { width: 17px; height: 17px; }

.rfq-form {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-4));
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand-blue);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.rfq-form__head { padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line-soft); }
.rfq-form__head h2 { margin: 0; font-size: var(--fs-xl); }
.rfq-form__body { padding: var(--sp-5); }
.rfq-form__foot { padding: var(--sp-4) var(--sp-5); background: var(--surface-alt); border-top: 1px solid var(--line-soft); }

.type-switch { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.type-switch label {
  flex: 1;
  text-align: center;
  padding: var(--sp-3);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .18s var(--ease);
}
.type-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.type-switch label:hover { border-color: var(--brand-blue-300); }
.type-switch input:checked + span { color: inherit; }
.type-switch label.is-active {
  border-color: var(--brand-blue);
  background: var(--brand-blue-100);
  color: var(--brand-blue);
}
/* Radio-nya disembunyikan secara visual, jadi fokus keyboard harus
   ditampilkan lewat labelnya — tanpa ini pengguna keyboard tidak tahu
   pilihan mana yang sedang aktif. */
.type-switch label:has(input:focus-visible),
.type-switch input:focus-visible + span {
  outline: 3px solid var(--brand-yellow);
  outline-offset: 2px;
}

/* Halaman sukses */
.rfq-success {
  max-width: 640px;
  margin-inline: auto;
  text-align: center;
  padding-block: var(--sp-8);
}
.rfq-success__icon {
  width: 76px; height: 76px;
  margin: 0 auto var(--sp-5);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: #e8f6ee;
  color: var(--success);
}
.rfq-success__icon svg { width: 38px; height: 38px; }
.rfq-success__code {
  display: inline-block;
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface-alt);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: var(--fs-lg);
  color: var(--brand-blue);
  margin-bottom: var(--sp-5);
}

/* ---------------------------------------------------------------------
   RESPONSIF
   --------------------------------------------------------------------- */
@media (max-width: 1240px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .catalog { grid-template-columns: 240px minmax(0, 1fr); gap: var(--sp-5); }
  .rfq-layout { grid-template-columns: minmax(0, 1fr) 330px; }
}

@media (max-width: 900px) {
  /* Sidebar filter sudah jadi panel geser, ruangnya kembali penuh */
  .catalog .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .catalog { grid-template-columns: 1fr; }

  .filter-panel {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(330px, 88vw);
    border-radius: 0;
    border: 0;
    z-index: 130;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .28s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .filter-panel.is-open { transform: translateX(0); }
  .filter-panel__body { flex: 1; overflow-y: auto; }

  .filter-toggle { display: inline-flex; }

  .product-detail { grid-template-columns: 1fr; gap: var(--sp-6); }
  /* minmax(0,1fr): izinkan kolom menyusut; cegah konten lebar (mis. iframe
     peta ber-width tetap) memaksa kolom melebihi lebar layar HP */
  .rfq-layout { grid-template-columns: minmax(0, 1fr); }
  .rfq-form { position: static; }
}

@media (max-width: 760px) {
  .product-grid,
  .catalog .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------------
   KARTU PRODUK DUA KOLOM DI LAYAR KECIL

   Lebar kartu tinggal sekitar 160 px, jadi isinya dirampingkan agar
   tetap terbaca: jarak dirapatkan, judul dikecilkan, dan ringkasan
   disembunyikan karena di lebar segitu ia menjadi beberapa baris
   dan membuat kartu jauh lebih tinggi daripada isinya yang penting.
   --------------------------------------------------------------------- */
@media (max-width: 620px) {
  .product-grid,
  .catalog .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-3);
  }

  .product-card .card__media { aspect-ratio: 1 / 1; }
  .product-card .card__media img { padding: var(--sp-3); }

  .product-card .card__body { padding: var(--sp-3); }
  .product-card .card__brand { font-size: 10px; letter-spacing: .08em; }
  .product-card .card__title { font-size: 0.9375rem; line-height: 1.25; }
  .product-card .card__excerpt { display: none; }

  .product-card .card__meta { gap: 4px; margin-bottom: var(--sp-2); }
  .product-card .card__meta .badge { font-size: 10px; padding: 1px 7px; }
  .product-card__docs { margin-bottom: var(--sp-2); }
  .product-card__docs .badge { font-size: 10px; padding: 1px 6px; }

  .product-card__badges { top: 6px; left: 6px; }
  .product-card__badges .badge { font-size: 10px; padding: 1px 7px; }

  .product-card .card__actions { flex-direction: column; gap: 6px; }
  .product-card .card__actions .btn {
    width: 100%;
    padding: 0.5rem 0.4rem;
    font-size: 0.75rem;
    letter-spacing: .02em;
  }

  .catalog-toolbar { flex-direction: column; align-items: stretch; }
  .catalog-toolbar__right { flex-direction: column; align-items: stretch; }
  .catalog-toolbar select { min-width: 0; width: 100%; }

  .gallery__thumbs { grid-template-columns: repeat(4, 1fr); }

  .rfq-box__row { grid-template-columns: 1fr; }

  .rfq-item {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: var(--sp-3);
  }
  .rfq-item__qty { grid-column: 1 / -1; }
  .rfq-item__remove { grid-column: 1 / -1; justify-self: start; width: auto; padding-inline: var(--sp-3); gap: 6px; }
}
