/**
 * プロジェクト編集モーダル - 古代ローマの武器庫スタイル（月桂樹の色を反映）
 * 濃い深緑の葉、鮮やかな黄色の花、赤褐色の新芽
 */

/* ========== モーダルコンテナ ========== */
#editModal {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#editModal[aria-hidden="true"] {
  opacity: 0;
  visibility: hidden;
}

#editModal[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

/* ========== モーダルコンテンツ（クリアブルー・統一感重視） ========== */
#editModal .dialog {
  max-width: 420px;
  width: 85%;
  max-height: 90vh;
  background:
    linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 18px;
  box-shadow:
    0 16px 40px rgba(15, 23, 42, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  border: 1px solid rgba(186, 230, 253, 1);
  animation: editModalAppear 0.4s ease-out;
}

@keyframes editModalAppear {
  0% {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 上下の淡い焚き火の光 */
#editModal .dialog::before,
#editModal .dialog::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 0;
}

#editModal .dialog::before {
  top: 0;
  height: 70px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, transparent 100%);
}

#editModal .dialog::after {
  bottom: 0;
  height: 60px;
  background:
    linear-gradient(0deg, rgba(224, 242, 254, 0.5) 0%, transparent 100%);
}

/* スクロールバーのスタイル（焚き火色） */
#editModal .dialog::-webkit-scrollbar {
  width: 16px;
}

#editModal .dialog::-webkit-scrollbar-track {
  background: rgba(241, 245, 249, 0.8);
  border-radius: 8px;
  margin: 4px;
  border: none;
}

#editModal .dialog::-webkit-scrollbar-thumb {
  background: #bae6fd;
  border-radius: 8px;
  border: 2px solid #fff;
  box-shadow: none;
}

#editModal .dialog::-webkit-scrollbar-thumb:hover {
  background: #7dd3fc;
  box-shadow: none;
}

/* ========== ヘッダー ========== */
#editModal .row:first-child {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(186, 230, 253, 0.6);
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 2;
  box-shadow: none;
}

#editModal .row:first-child strong {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #0369a1;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: "Noto Sans JP", sans-serif;
  text-shadow: none;
  animation: titleGlow 3s ease-in-out infinite;
  position: relative;
}

/* タイトル周りの装飾はシンプルに（ラウレル削除） */
#editModal .row:first-child strong::before,
#editModal .row:first-child strong::after {
  content: none;
}

@keyframes titleGlow {
  0%, 100% {
    text-shadow: 
      0 0 10px rgba(217, 165, 32, 0.7),
      0 0 20px rgba(217, 165, 32, 0.4),
      2px 2px 4px rgba(0, 0, 0, 0.8);
  }
  50% {
    text-shadow: 
      0 0 15px rgba(217, 165, 32, 0.9),
      0 0 30px rgba(217, 165, 32, 0.6),
      0 0 45px rgba(217, 165, 32, 0.4),
      2px 2px 4px rgba(0, 0, 0, 0.8);
  }
}

#editModal #editClose {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(186, 230, 253, 0.8);
  background: #f0f9ff;
  color: #0ea5e9;
  font-size: 16px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  line-height: 1;
  padding: 0;
  position: relative;
  z-index: 2;
  box-shadow: none;
}

#editModal #editClose:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
  transform: rotate(90deg) scale(1.1);
  box-shadow: 
    0 0 15px rgba(217, 165, 32, 0.6),
    0 3px 6px rgba(217, 165, 32, 0.4),
    inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

/* ========== ボディセクション ========== */
#editModal .mb-8 {
  padding: 16px 20px;
  position: relative;
  z-index: 2;
  background: #ffffff;
  backdrop-filter: blur(3px);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid rgba(224, 242, 254, 1);
  box-shadow: none;
}

/* サブセクションの余白 */
#editModal .mb-4 {
  margin-bottom: 8px;
}

/* ========== セクションタイトル ========== */
#editModal .section-title {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 700;
  color: #0369a1;
  font-family: "Noto Sans JP", sans-serif;
  display: flex;
  align-items: center;
  gap: 4px;
  text-shadow: none;
  position: relative;
  padding-left: 0;
}

/* コンパクトなセクションタイトル */
#editModal .section-title-compact {
  margin: 0 0 2px 0;
  font-size: 10px;
}

/* セクションタイトルの左アイコンはHTML側の絵文字をそのまま利用 */
#editModal .section-title::before {
  content: none;
}

#editModal .section-hint-inline {
  font-size: 11px;
  color: #0ea5e9;
  margin-left: 6px;
  opacity: 0.9;
  text-shadow: none;
}

/* ========== 大項目グリッド（装備スロット） ========== */
#editModal .grid-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
  margin: 4px 0 8px;
}

#editModal .grid-2col input {
  padding: 10px 12px;
  border: 1px solid #e0f2fe;
  border-radius: 10px;
  font-size: 13px;
  font-family: "Noto Sans JP", sans-serif;
  background: #f0f9ff;
  color: #0c4a6e;
  transition: all 0.3s ease;
  box-shadow: none;
  position: relative;
  text-align: center;
  font-weight: 600;
  min-height: auto;
  height: auto;
  line-height: 1.2;
}

/* 固定装備（月桂樹の深緑背景、金色の枠、光る、月桂樹の装飾） */
#editModal .grid-2col input.input-disabled {
  background: #e0f2fe;
  border-color: #bae6fd;
  border-width: 1px;
  color: #0369a1;
  cursor: not-allowed;
  box-shadow: none;
  animation: none;
  position: relative;
  font-weight: 700;
  padding-right: 24px;
}

#editModal .grid-2col input.input-disabled::after {
  content: '🔒';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  opacity: 0.8;
}

@keyframes equipmentGlow {
  0%, 100% {
    box-shadow: 
      0 0 20px rgba(217, 165, 32, 0.5),
      0 2px 6px rgba(217, 165, 32, 0.3),
      inset 0 1px 3px rgba(217, 165, 32, 0.2),
      inset 0 -1px 3px rgba(0, 0, 0, 0.4);
  }
  50% {
    box-shadow: 
      0 0 30px rgba(217, 165, 32, 0.7),
      0 2px 6px rgba(217, 165, 32, 0.4),
      inset 0 1px 3px rgba(217, 165, 32, 0.3),
      inset 0 -1px 3px rgba(0, 0, 0, 0.5);
  }
}

/* 編集可能な装備（自由入力） */
#editModal .grid-2col input.input-editable {
  background: #ffffff;
  border-color: #cbd5e1;
  border-width: 1px;
  color: #374151;
  cursor: text;
  box-shadow: 
    0 1px 3px rgba(217, 165, 32, 0.1),
    inset 0 1px 2px rgba(0, 0, 0, 0.2);
  position: relative;
  font-weight: 600;
}

#editModal .grid-2col input.input-editable {
  padding-right: 24px;
}

#editModal .grid-2col input.input-editable::after {
  content: '✏️';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  opacity: 0.6;
  pointer-events: none;
}

#editModal .grid-2col input.input-editable:hover {
  border-color: #38bdf8;
  box-shadow: none;
}

#editModal .grid-2col input.input-editable:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.2);
  outline: none;
}

/* ========== サブ項目設定 ========== */
#editModal .mb-4 {
  margin-bottom: 6px;
}

#editModal .project-select-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

#editModal .project-select-row label {
  font-size: 11px;
  font-weight: 600;
  color: #0369a1;
  text-shadow: none;
  white-space: nowrap;
}

#editModal .mb-4 label {
  font-size: 11px;
  font-weight: 600;
  color: #0369a1;
  margin-bottom: 3px;
  display: inline-block;
  text-shadow: none;
  margin-right: 4px;
}

#editModal select {
  width: auto;
  min-width: 120px;
  padding: 8px 32px 8px 12px;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  background: #f0f9ff;
  color: #0c4a6e;
  font-size: 13px;
  font-family: "Noto Sans JP", sans-serif;
  box-shadow: none;
  cursor: pointer;
  appearance: none;
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%230ea5e9%22%20d%3D%22M287%2C197.393L146.2%2C56.693L5.4%2C197.393h281.6z%22%2F%3E%3C%2Fsvg%3E');
  background-repeat: no-repeat;
  background-position: right 10px top 50%;
  background-size: 10px auto;
  transition: border-color 0.2s ease;
  font-weight: 600;
}

#editModal select:hover {
  border-color: #38bdf8;
  box-shadow: none;
}

#editModal select:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.2);
  outline: none;
}

/* サブ項目リスト（3×3グリッド） */
#editModal .subkinds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e0f2fe;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: none;
}

/* 旧スタイル（後方互換性のため残す） */
#editModal .subkinds-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e0f2fe;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: none;
}

#editModal .subkinds-list::-webkit-scrollbar {
  width: 12px;
}

#editModal .subkinds-list::-webkit-scrollbar-track {
  background: rgba(217, 165, 32, 0.15);
  border-radius: 10px;
}

#editModal .subkinds-list::-webkit-scrollbar-thumb {
  background: rgba(217, 165, 32, 0.7);
  border-radius: 10px;
}

#editModal .subkinds-list::-webkit-scrollbar-thumb:hover {
  background: rgba(217, 165, 32, 0.9);
}

#editModal .subkind-item {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 0;
  font-size: 13px;
  color: #0c4a6e;
  box-shadow: none;
  transition: all 0.2s ease;
  font-weight: 600;
  position: relative;
  min-height: 40px;
}

#editModal .subkind-item:hover {
  transform: none;
}

#editModal .subkind-item input[type="text"] {
  width: 100%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #334155;
  font-size: 13px;
  font-family: "Noto Sans JP", sans-serif;
  padding: 8px 10px;
  outline: none;
  font-weight: 500;
  text-align: center;
  transition: border-color 0.2s ease;
}

#editModal .subkind-item input[type="text"]::placeholder {
  color: #94a3b8;
}

#editModal .subkind-item input[type="text"]:hover {
  border-color: #38bdf8;
}

#editModal .subkind-item input[type="text"]:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.2);
}

/* 追加ボタンは削除されました */

/* ========== フッターボタン ========== */
#editModal .row.row-end {
  padding: 12px 20px;
  border-top: 1px solid rgba(186, 230, 253, 0.6);
  background: rgba(255, 255, 255, 0.6);
  justify-content: flex-end;
  gap: 4px;
  position: relative;
  z-index: 2;
  box-shadow: none;
}

#editModal .button {
  background: #0ea5e9;
  color: #ffffff;
  border: none;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: none;
  font-family: "Noto Sans JP", sans-serif;
}

#editModal .button:hover {
  background: #0284c7;
  box-shadow: none;
  transform: translateY(-1px);
}

#editModal .button:active {
  transform: translateY(0);
  box-shadow: none;
}

/* モバイル対応 */
@media (max-width: 768px) {
  #editModal .dialog {
    max-width: 95vw;
    width: calc(100% - 16px);
    max-height: 90vh;
    padding: 0;
    margin: 8px;
    border-radius: 8px;
    border-width: 3px;
  }

  #editModal .row:first-child {
    padding: 16px 20px;
    border-width: 3px;
  }

  #editModal .row:first-child strong {
    font-size: 18px;
    gap: 8px;
  }

  #editModal .row:first-child strong::before,
  #editModal .row:first-child strong::after {
    display: none;
  }

  #editModal #editClose {
    width: 32px;
    height: 32px;
    font-size: 20px;
    border-radius: 6px;
    border-width: 3px;
  }

  #editModal .mb-8 {
    padding: 16px 20px;
    margin-bottom: 8px;
    border-width: 3px;
  }

  #editModal .section-title {
    font-size: 14px;
    margin-bottom: 10px;
    gap: 6px;
    padding-left: 24px;
  }

  #editModal .section-title::before {
    width: 20px;
    height: 20px;
  }

  #editModal .grid-2col {
    gap: 4px;
    margin-bottom: 8px;
    max-width: 50%;
    margin-left: auto;
    margin-right: auto;
    column-gap: 14px;
  }

  #editModal .grid-2col input {
    padding: 4px 8px;
    font-size: 13px;
    border-radius: 6px;
    border-width: 3px;
    line-height: 1.2;
    min-height: auto;
  }

  #editModal .mb-4 label {
    font-size: 12px;
    margin-bottom: 4px;
  }

  #editModal select {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 6px;
    border-width: 3px;
    background-position: right 8px top 50%;
    background-size: 10px auto;
  }

  #editModal .subkinds-list {
    padding: 8px;
    margin-bottom: 8px;
    max-height: 120px;
    border-width: 3px;
  }

  #editModal .subkind-item {
    padding: 6px 8px;
    margin-bottom: 4px;
    font-size: 13px;
    border-radius: 4px;
    gap: 6px;
    border-width: 3px;
  }

  #editModal .subkind-item input[type="text"] {
    font-size: 13px;
    background: #fff;
    border: 1px solid rgba(217, 165, 32, 0.3);
    border-radius: 4px;
    padding: 3px 6px;
    color: #1f2937;
  }
  
  #editModal .subkind-item input[type="text"]::placeholder {
    color: #9ca3af;
  }

  #editModal .subkind-item .subkind-icon {
    font-size: 16px;
  }

  #editModal .subkind-item .button-delete {
    padding: 3px 6px;
    font-size: 11px;
    border-radius: 3px;
  }

  #editModal #editSubKindAddBtn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    margin-top: 8px;
    border-width: 3px;
  }

  #editModal .row.row-end {
    padding: 12px 20px;
    gap: 8px;
    border-width: 3px;
  }

  #editModal .button {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 6px;
    border-width: 3px;
  }
}
