/* ============================================
   状態選択モーダル (一覧画面用)
   eyecatch.twig のpmOverlay 系を抽出して共通化
   ============================================ */

.pm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100000;
  justify-content: center;
  align-items: center;
  padding: 16px;
}
.pm-overlay--show { display: flex; }

.pm-modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
  position: relative;
  animation: pmSlideUp 0.25s ease;
}
@keyframes pmSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.pm-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: rgba(0,0,0,0.06);
  border: none;
  border-radius: 50%;
  font-size: 18px;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.2s;
}
.pm-close:hover { background: rgba(0,0,0,0.12); }

.pm-header {
  display: flex;
  gap: 14px;
  padding: 20px 16px 14px;
  border-bottom: 1px solid #eee;
}
.pm-img {
  width: 90px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f5f5f5;
  border: 1px solid #eee;
}
.pm-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pm-info { flex: 1; min-width: 0; }
.pm-name {
  font-size: 14px;
  font-weight: 700;
  color: #222;
  line-height: 1.4;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pm-stock-label {
  font-size: 12px;
  color: #888;
}

.pm-variants {
  padding: 12px 16px;
  max-height: 300px;
  overflow-y: auto;
}
.pm-variant {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid #eee;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.pm-variant:hover { border-color: #ce0000; background: #fef8f8; }
.pm-variant--selected {
  border-color: #ce0000;
  background: #fef2f2;
}
.pm-variant--nostock {
  opacity: 0.45;
  cursor: not-allowed;
}
.pm-variant__left { flex: 1; min-width: 0; }
.pm-variant__name {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pm-variant__stock {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}
.pm-variant__price {
  font-size: 15px;
  font-weight: 800;
  color: #d10000;
  white-space: nowrap;
}

.pm-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid #eee;
  background: #fafafa;
  border-radius: 0 0 14px 14px;
}
.pm-qty {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.pm-qty__btn {
  width: 34px;
  height: 36px;
  border: none;
  background: #f5f5f5;
  font-size: 18px;
  font-weight: 700;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.pm-qty__btn:hover { background: #e8e8e8; }
.pm-qty__btn:disabled { color: #ccc; cursor: default; }
.pm-qty__val {
  width: 36px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  background: #fff;
  -moz-appearance: textfield;
}
.pm-qty__val::-webkit-inner-spin-button { -webkit-appearance: none; }

.pm-add-btn {
  flex: 1;
  height: 40px;
  background: #ce0000;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.pm-add-btn:hover { background: #b00000; }
.pm-add-btn:disabled { background: #ccc; cursor: not-allowed; }
.pm-add-btn--done { background: #28a745; }

.pm-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #28a745;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 99999;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  pointer-events: none;
}
.pm-toast--show {
  opacity: 1;
  transform: translateY(0);
}
.pm-toast--error { background: #dc3545; }
