/* KHT v15: /spare-parts/, /spare-part-category/<cat>/ and one spare part (mockup parts.html). Loaded after site.css. */

/* ---------- admin-only tools: small, plain, out of the way ---------- */
.kht-admin-image-slot, .kht-admin-term-image-slot { position: relative; }
.kht-front-image-upload, .kht-front-term-image-upload {
  position: absolute; left: 8px; bottom: 8px; z-index: 5;
  border: 0; border-radius: 999px; padding: 5px 11px; cursor: pointer;
  background: rgba(255,255,255,.94); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line);
  font: 500 12px/1.4 "IBM Plex Sans", "IBM Plex Sans Thai", sans-serif; white-space: nowrap;
}
.spare-visibility-panel {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 24px; font-size: 13px;
}
.spare-visibility-panel strong { display: block; font-weight: 600; color: var(--ink); }
.spare-visibility-panel span { color: var(--ink-3); }
.spare-visibility-toggle {
  height: 34px; padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--ink); color: #fff; font: inherit; font-size: 13px;
}
.spare-visibility-toggle.is-off { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.spare-visibility-toggle:disabled { opacity: .6; cursor: wait; }
.admin-note { font-size: 13px; color: var(--ink-3); margin-top: 4px; }

/* ---------- categories ---------- */
.spare-cats { padding-top: 0; }
.spare-cats .products { margin-top: 20px; }
.product h3 { margin-top: 2px; }
.product p { font-size: 14px; margin-top: 2px; }
.product .count { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.cat-card.active .ph { box-shadow: 0 0 0 2px var(--ink); }

/* ---------- parts list: notice for visitors while it is switched off, else search form + table ---------- */
.spare-list { padding-top: 0; }
.list-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.list-head p { font-size: 13px; color: var(--ink-3); }
.notice { font-size: 15px; color: var(--ink-2); }
.notice p { max-width: 620px; }

.filter-panel { padding: 20px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.filter-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 16px; align-items: end; }
.filter-label { display: block; font-size: 11.5px; letter-spacing: .04em; color: var(--ink-3); margin-bottom: 6px; }
.filter-grid input, .filter-grid select {
  width: 100%; height: 40px; padding: 0 12px; border: 0; border-radius: var(--r-sm);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line);
  font: inherit; font-size: 14px; color: var(--ink);
}
.filter-grid input:focus, .filter-grid select:focus { outline: none; box-shadow: inset 0 0 0 1px var(--ink); }
.filter-actions { display: flex; gap: 8px; }
.filter-actions .btn { border: 0; cursor: pointer; font-family: inherit; }

.part-list-wrap { margin-top: 20px; overflow-x: auto; }
.part-list-table { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 13px; }
.part-list-table th, .part-list-table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.part-list-table thead th { font-weight: 600; color: var(--ink); border-bottom-color: var(--ink); white-space: nowrap; }
.part-list-table td { color: var(--ink-2); max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.part-list-table td.part-no, .part-list-table td.part-name { color: var(--ink); }
.part-list-table td a:hover { text-decoration: underline; text-underline-offset: 3px; }
.part-list-table .detail-link { white-space: nowrap; color: var(--ink-3); }
.spare-list > .wrap > .notice:not(.spare-hidden-notice) { margin-top: 20px; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 24px; font-size: 13px; }
.pagination .page-numbers { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); }
.pagination .page-numbers.current { background: var(--ink); color: #fff; box-shadow: none; }
.pagination .page-numbers.dots { box-shadow: none; }

/* ---------- one spare part ---------- */
.part-head { padding-bottom: clamp(48px, 7vw, 96px); }
.detail-photo { position: relative; background: #f4f4f2; border-radius: var(--r-lg); aspect-ratio: 1; overflow: hidden; }
.detail-photo img { position: absolute; inset: 6%; width: 88%; height: 88%; object-fit: contain; mix-blend-mode: multiply; }
.gallery-wrap { display: grid; gap: 10px; }
.thumb-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.thumb-grid .thumb { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: #f4f4f2; cursor: pointer; opacity: .6; transition: opacity .2s ease; }
.thumb-grid .thumb:hover, .thumb-grid .thumb.active { opacity: 1; }
.thumb-grid .thumb.active { box-shadow: inset 0 0 0 2px var(--ink); }
.thumb-grid .thumb img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; padding: 8%; }
.thumb-grid .kht-front-image-upload { left: 4px; right: 4px; bottom: 4px; padding: 3px 5px; font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; }
.part-info h1 { margin-top: 8px; font-size: clamp(26px, 3.4vw, 36px); }
.part-number-lg { margin-top: 6px; font-size: 14px; color: var(--ink-3); font-family: "IBM Plex Sans", sans-serif; letter-spacing: .02em; }
.info-grid { margin: 24px 0 0; border-top: 1px solid var(--line); font-size: 14px; }
.info-grid .info { display: grid; margin: 0; font-size: 14px; grid-template-columns: 180px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.info-grid dt { color: var(--ink-3); }
.info-grid dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.section-bar { margin-top: 32px; font-size: 13px; font-weight: 400; color: var(--ink-3); letter-spacing: .02em; }
.spec-wrap { margin-top: 10px; }
.spec-table { min-width: 0; }
.spec-table th { font-weight: 400; color: var(--ink-3); white-space: normal; width: 40%; }
.spec-table td { white-space: normal; color: var(--ink); }
.part-content { margin-top: 20px; font-size: 15px; color: var(--ink-2); }
.part-content > p { margin: 0 0 12px; }

@media (max-width: 900px) {
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-grid > div:first-child, .filter-actions { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .filter-grid { grid-template-columns: 1fr; }
  .info-grid .info { grid-template-columns: 1fr; gap: 0; }
}
