/* ==========================================================================
   部品：ボタン・バッジ・価格・カード・一覧行・ツールバー・表・メッセージ
   ========================================================================== */

/* --- ボタン ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-shadow: 0 -1px 0 rgb(0 0 0 / 0.15);
  white-space: nowrap;
  cursor: pointer;
}

.btn:hover {
  color: #fff;
  text-decoration: none;
}

.btn--blue {
  background: var(--g-blue);
  border-color: #0b4f8f;
}

.btn--blue:hover {
  background: var(--g-blue-hover);
}

.btn--blue.is-active,
.btn--buy {
  background: var(--g-brand);
  border-color: var(--c-brand-dark);
}

.btn--buy {
  padding: 10px 24px;
  font-size: 15px;
}

.btn--buy:hover {
  background: var(--g-brand-hover);
}

.btn:disabled {
  background: var(--g-gray);
  border-color: #a0a0a0;
  color: #fff;
  cursor: not-allowed;
}

.btn--block {
  width: 100%;
}

.link-button {
  padding: 0;
  background: none;
  border: 0;
  color: var(--c-link);
  font-size: 13px;
  cursor: pointer;
}

.link-button:hover {
  color: var(--c-link-hover);
  text-decoration: underline;
}

/* --- ラベル類 ---------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 2px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

.badge--new {
  background: var(--c-marker);
}

.badge--restock {
  background: #2f84c2;
}

.badge--pickup {
  background: #e0560f;
}

/* 部品の区分（同梱・実装済み・拡張用）。部品表と 3D 表示の吹き出しで使う */
.part-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}

.part-tag--kit {
  color: #2e7031;
}

.part-tag--mounted {
  color: var(--c-brand-dark);
}

.part-tag--option {
  color: #1d4f8f;
}

.chip {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid #bbb;
  border-radius: 2px;
  color: var(--c-text-sub);
  font-size: 11px;
  line-height: 1.6;
}

.chip--easy {
  border-color: var(--c-easy);
  color: var(--c-easy);
  font-weight: 700;
}

.stock {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}

.stock--in { color: var(--c-stock-in); }
.stock--low { color: var(--c-stock-low); }
.stock--preparing { color: var(--c-stock-pre); }
.stock--out,
.stock--discontinued { color: var(--c-stock-out); }

.stock--discontinued {
  background: #eee;
}

.difficulty {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.difficulty__stars {
  color: #f0a000;
  letter-spacing: 0.05em;
}

.price {
  color: var(--c-price);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.price small {
  margin-left: 2px;
  color: var(--c-text-sub);
  font-size: 11px;
  font-weight: normal;
}

.price--large {
  font-size: 20px;
}

.price--xl {
  font-size: 28px;
  line-height: 1.2;
}

.catch {
  color: var(--c-catch);
  font-size: 12px;
}

.catch--large {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
}

/* --- 見出し・パンくず ------------------------------------------------------------ */
.breadcrumb {
  margin-bottom: 12px;
  font-size: 12px;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
}

.breadcrumb li + li::before {
  content: ">";
  margin: 0 8px;
  color: var(--c-muted);
}

.breadcrumb [aria-current] {
  color: var(--c-text-sub);
}

.page-head {
  margin-bottom: 14px;
}

.page-title {
  padding: 2px 0 2px 10px;
  border-left: 6px solid var(--c-marker);
  font-size: 21px;
  line-height: 1.4;
}

.page-lead {
  margin-top: 8px;
  color: var(--c-text-sub);
}

.section {
  margin-top: 32px;
}

.section:first-child {
  margin-top: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 7px 12px;
  border-top: 2px solid var(--c-gnav);
  background: var(--c-bg-sub);
}

.section-head h2,
.section-head h3 {
  font-size: 16px;
}

.section-head--yellow {
  background: var(--c-band-yellow);
}

.section-head--peach {
  background: var(--c-band-peach);
}

.section-head__more {
  color: var(--c-text);
  font-size: 12px;
  white-space: nowrap;
}

/* --- カテゴリタブ・ツールバー ------------------------------------------------------ */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tabs__item {
  padding: 5px 12px;
  background: #fff;
  border: 1px solid var(--c-border-dark);
  border-radius: var(--radius);
  color: var(--c-text);
  font-size: 13px;
}

.tabs__item:hover {
  background: var(--c-brand-tint);
  color: var(--c-text);
  text-decoration: none;
}

.tabs__item.is-active {
  background: var(--c-gnav);
  border-color: var(--c-gnav);
  color: #fff;
}

.tabs__item.is-active .count {
  color: #ddd;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: var(--c-bg-sub);
  border: 1px solid var(--c-border);
  font-size: 13px;
}

.toolbar__count strong {
  margin-right: 2px;
  color: var(--c-price);
  font-size: 18px;
}

.toolbar__sort {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar__sort select {
  height: 30px;
  padding: 0 6px;
  background: #fff;
  border: 1px solid #767676;
  border-radius: var(--radius);
}

.view-toggle {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.view-toggle .btn {
  padding: 4px 12px;
  font-size: 12px;
}

/* --- 商品カード（グリッド） ------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--c-border);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card:hover {
  border-color: var(--c-border-dark);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.08);
}

.card__image {
  display: block;
  background: #f2f2ee;
  border-bottom: 1px solid var(--c-border);
}

/* 写真は切り取らずに全体を見せる（縦横比が正方形でなければ余白が出る） */
.card__image img,
.row__image img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}

.card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
}

.card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 0;
}

.card__badges:empty {
  display: none;
}

.card__name {
  font-size: 14px;
  line-height: 1.45;
}

.card__meta {
  color: var(--c-muted);
  font-size: 11px;
}

.card__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: auto;
  padding-top: 4px;
  font-size: 12px;
}

.card__price {
  margin-bottom: 4px;
}

/* --- 商品一覧行（リスト） --------------------------------------------------------- */
.rows {
  border-top: 1px solid var(--c-border);
}

.row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 220px;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--c-border);
}

.row__image {
  display: block;
  align-self: start;
  background: #f2f2ee;
  border: 1px solid var(--c-border);
}

.row__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.row__name {
  font-size: 16px;
  line-height: 1.45;
}

.row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin-top: 4px;
  font-size: 12px;
}

.row__meta div {
  display: flex;
  gap: 6px;
}

.row__meta dt {
  color: var(--c-muted);
}

.row__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}


@media (max-width: 640px) {
  .row {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .row__side {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

/* --- 表 --------------------------------------------------------------------- */
.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 7px 10px;
  border: 1px solid #d6d6d6;
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  background: #eee;
  white-space: nowrap;
}

.data-table tbody tr:nth-child(even) td {
  background: #f8f8f8;
}

.data-table tfoot td {
  background: #fafafa;
  font-weight: 700;
}

.data-table .num {
  text-align: right;
  white-space: nowrap;
}

.data-table--spec th {
  width: 11em;
  background: #f3f3f3;
  font-weight: normal;
}

/* --- メッセージ・通知 ----------------------------------------------------------- */
.message {
  padding: 14px 16px;
  border: 1px solid #b9d3ee;
  background: #f0f6fc;
}

.message p + p {
  margin-top: 10px;
}

.message--warning {
  border-color: #f0d27a;
  background: #fffbe6;
}

.message--error {
  border-color: #ebccd1;
  background: #f2dede;
  color: #a94442;
}

.toast-region {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
}

.toast {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 12px 16px;
  background: #333;
  border-left: 4px solid var(--c-stock-in);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.25);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
}

.toast.is-visible {
  opacity: 1;
  transform: none;
}

.toast--warn {
  border-left-color: var(--c-stock-low);
}

.toast--error {
  border-left-color: var(--c-marker);
}

.toast a {
  color: #ffd27a;
  font-weight: 700;
}

/* --- 基板 3D ビューア -------------------------------------------------------- */
.pcb {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pcb__stage {
  position: relative;
  height: clamp(280px, 52vw, 460px);
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 35%, #fbfbfa 0%, #e9e9e6 60%, #d9dad6 100%);
  border: 1px solid var(--c-border);
}

.pcb--tall .pcb__stage {
  height: clamp(320px, 62vw, 600px);
}

.pcb:fullscreen {
  padding: 12px;
  background: #fff;
}

.pcb:fullscreen .pcb__stage {
  flex: 1;
  height: auto;
}

.pcb__canvas,
.pcb__flat {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.pcb__flat {
  object-fit: contain;
}

.pcb__status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  color: var(--c-text-sub);
  font-size: 13px;
  text-align: center;
}

.pcb__status--error {
  color: #a94442;
}

.pcb__tip {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  max-width: 260px;
  padding: 6px 10px;
  background: rgb(30 30 30 / 0.9);
  border-radius: var(--radius);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
}

.pcb__tip small {
  color: #ccc;
  font-size: 11px;
}

.pcb__tip-kind {
  margin: 2px 0;
}

/* マウスを合わせているときの吹き出しはマウスの邪魔をしない。クリックで固定したらリンクを押せる */
.pcb__tip.is-pinned {
  pointer-events: auto;
  outline: 1px solid rgb(255 255 255 / 0.35);
}

.pcb__tip-hint {
  color: #9a9a9a !important;
}

.pcb__tip a {
  color: #ffd27a;
}

.pcb__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-size: 13px;
}

.pcb__group {
  display: inline-flex;
}

.pcb__btn {
  padding: 4px 12px;
  background: #fff;
  border: 1px solid var(--c-border-dark);
  border-radius: var(--radius);
  color: var(--c-text);
  font-size: 13px;
  cursor: pointer;
}

.pcb__group .pcb__btn {
  border-radius: 0;
}

.pcb__group .pcb__btn + .pcb__btn {
  border-left: 0;
}

.pcb__group .pcb__btn:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.pcb__group .pcb__btn:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.pcb__btn:hover {
  background: var(--c-brand-tint);
}

.pcb__btn.is-active {
  background: var(--c-gnav);
  border-color: var(--c-gnav);
  color: #fff;
}

/* PNG を作っている間 */
.pcb__btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.pcb__save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pcb__check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.pcb__info {
  color: var(--c-text);
  font-size: 12px;
}

.pcb__hint {
  color: var(--c-muted);
  font-size: 11px;
}
