/* ==========================================================================
   Variation Swatches — テキストラベルボタン
   WooCommerce バリエーション選択の <select> をボタン UI に変換する。
   商品個別ページ（single product）でのみ読み込み。
   ========================================================================== */

/* --- 非表示の元 <select> ラッパー ---------------------------------------- */
.iothonpo-swatches-hidden-select {
  display: none !important;
  position: absolute;
  visibility: hidden;
}

/* --- スウォッチコンテナ --------------------------------------------------- */
.iothonpo-swatches-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}

/* --- 個別スウォッチボタン ------------------------------------------------- */
.iothonpo-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 36px;
  padding: 6px 16px;
  border: 2px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.iothonpo-swatch-inner {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: #333;
  white-space: nowrap;
}

/* --- ホバー状態 ---------------------------------------------------------- */
.iothonpo-swatch:hover:not(.iothonpo-swatch--disabled) {
  border-color: #999;
}

/* --- 選択状態 ------------------------------------------------------------ */
.iothonpo-swatch--selected {
  border-color: var(--ast-global-color-0, #1a73e8);
  background-color: rgba(26, 115, 232, 0.06);
}

.iothonpo-swatch--selected .iothonpo-swatch-inner {
  color: var(--ast-global-color-0, #1a73e8);
}

/* --- 無効（在庫切れ / 利用不可）状態 ------------------------------------- */
.iothonpo-swatch--disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: #e0e0e0;
  background-color: #f5f5f5;
  position: relative;
}

.iothonpo-swatch--disabled::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 4px;
  right: 4px;
  height: 1px;
  background-color: #999;
  transform: rotate(-12deg);
}

/* --- フォーカス状態（キーボードナビゲーション） -------------------------- */
.iothonpo-swatch:focus-visible {
  outline: 2px solid var(--ast-global-color-0, #1a73e8);
  outline-offset: 2px;
}

/* --- Astra テーマとの統合 ------------------------------------------------ */
.variations td.value .iothonpo-swatches-container + .reset_variations {
  display: inline-block;
  margin-top: 8px;
}

/* --- モバイル対応 --------------------------------------------------------- */
@media (max-width: 600px) {
  .iothonpo-swatch {
    min-width: 40px;
    min-height: 32px;
    padding: 4px 12px;
  }

  .iothonpo-swatch-inner {
    font-size: 13px;
  }

  .iothonpo-swatches-container {
    gap: 6px;
  }
}
