/*-----------------------------------------------------
  モーダルUI Final Tone Integrated 2
  指示書2025-11-03 p.4準拠（完全統合版）
  改訂日：2025-11-05
-----------------------------------------------------*/

.ih-modal {
  display: none !important;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  padding: 1.5rem;
  font-family: "Noto Sans JP", sans-serif;
  color: #222;
}

.ih-modal.open {
  display: flex !important;
}

.ih-modal__inner {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  max-width: 640px;
  width: 100%;
  padding: 1.25rem 1.5rem;
  position: relative;
  animation: fadeIn 0.25s ease-out;
}

/*-----------------------------------------------------
  閉じるボタン（Font Awesome ×）
-----------------------------------------------------*/
.ih-modal__close:not(.btn-secondary) {
  position: absolute;
  top: 0.8rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #555;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: all 0.2s ease;
}
.ih-modal__close:not(.btn-secondary):hover {
  background: rgba(0,0,0,0.06);
  color: #000;
}
.ih-modal__close i {
  font-size: 18px;
  line-height: 1;
}

/*-----------------------------------------------------
  ヘッダー・タイトル
-----------------------------------------------------*/
.ih-modal__header {
  margin-bottom: 0.5rem;
}
.ih-modal__header .modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #222;
  margin: 0 0 0.5rem;
}

/*-----------------------------------------------------
  登録者表示
-----------------------------------------------------*/
.ih-modal__meta {
  margin: 0.25rem 0 0.75rem;
  font-size: 0.9rem;
  color: #222;
}
.ih-modal__meta .ih-modal__label {
  font-weight: 600;
  margin-right: 0.3rem;
}

/*-----------------------------------------------------
  区切り線
-----------------------------------------------------*/
.ih-modal-sep {
  border: none;
  border-top: 1px solid #ccc;
  margin: 1rem 0;
}

/*-----------------------------------------------------
  入力フィールド
-----------------------------------------------------*/
.acf-fields .acf-field {
  margin-bottom: 1rem;
}
.acf-fields .acf-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: #222;
}
.acf-fields input[type="text"],
.acf-fields input[type="url"],
.acf-fields textarea {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
  background: #fff;
  color: #222;
}

/*-----------------------------------------------------
  重要ラベルボタン風トグル
-----------------------------------------------------*/
.important-toggle {
  display: inline-block;
  background: #f6f7f9;
  border: 1px solid #ccc;
  border-radius: 20px;
  padding: 0.3rem 0.9rem;
  font-size: 0.9rem;
  color: #222;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.important-toggle:hover {
  background: #e4e8ee;
  border-color: #bbb;
}
.important-toggle input {
  display: none;
}
.important-toggle input:checked + span,
.important-toggle input:checked ~ span {
  background: #d80c18;
  border-color: #d80c18;
  color: #fff;
  border-radius: 20px;
  padding: 0.3rem 0.9rem;
}

/*-----------------------------------------------------
  タグボタン風カテゴリ（構造：label > input）
-----------------------------------------------------*/
.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
}
.category-list label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f6f7f9;
  border: 1px solid #ccc;
  border-radius: 20px;
  padding: 0.3rem 0.9rem;
  font-size: 0.9rem;
  color: #222;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.category-list label:hover {
  background: #e4e8ee;
  border-color: #bbb;
}
.category-list input[type="checkbox"] {
  display: none;
}
.category-list input[type="checkbox"]:checked + span,
.category-list input[type="checkbox"]:checked ~ span {
  background: #003f88;
  border-color: #003f88;
  color: #fff;
  border-radius: 20px;
  padding: 0.3rem 0.9rem;
}

/*-----------------------------------------------------
  ボタン列
-----------------------------------------------------*/
.ih-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.2rem;
}

/* 保存ボタン */
.btn-primary {
  background: #003f88;
  border: 1px solid #003f88;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.45rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-primary:hover {
  background: #0053b3;
  border-color: #0053b3;
}

/* キャンセルボタン */
.btn-secondary,
.ih-modal__close.btn {
  background: #fff;
  border: 1px solid #ccc;
  color: #222;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.45rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover,
.ih-modal__close.btn:hover {
  background: #ccc;
  color: #fff;
}

/*-----------------------------------------------------
  モバイル対応
-----------------------------------------------------*/
@media (max-width: 640px) {
  .ih-modal__inner {
    max-width: none;
    width: 100%;
    height: 100%;
    border-radius: 0;
    padding: 1rem;
  }
  .ih-form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}

/*-----------------------------------------------------
  フェードイン
-----------------------------------------------------*/
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
