/* 全体のリセット */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

body {
  background-color: #f3f3f3;
  color: #111;
}

/* ヘッダー */
header {
  background-color: #131921;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* 左ロゴ */
header .logo h1 {
  color: #ff9900;
  font-size: 22px;
  white-space: nowrap;
}

/* 検索バー中央配置 */
header .search-bar {
  flex: 1;
  display: flex;
  max-width: 600px;
  position: relative; /* サジェストリストの位置の基準点にする */
}

header .search-bar input {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 4px 0 0 4px;
}

header .search-bar button {
  background-color: #febd69;
  border: none;
  padding: 8px 16px;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-weight: bold;
}

header .search-bar button:hover {
  background-color: #f3a847;
}

/* 右アクション */
header .header-actions {
  display: flex;
  gap: 10px;
}

header .header-actions button {
  background-color: #174d8f;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 3px;
  cursor: pointer;
}

header .header-actions button:hover {
  background-color: #485769;
}

/* 検索バー */
#searchArea {
  background: #fff;
  border-radius: 4px;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid #ccc;
}

#searchInput {
  width: 70%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#searchButton {
  background-color: #febd69;
  border: none;
  padding: 8px 16px;
  margin-left: 5px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

#searchButton:hover {
  background-color: #f3a847;
}

/* 共通ボタン */
button {
  background-color: #37475a;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 3px;
  cursor: pointer;
  margin: 5px;
}

button:hover {
  background-color: #0066cc; /* 明るい青に変更して視認性アップ */
}

/*ファイル追加を隠す*/
#fileInput {
  display: none;
}

/*検索欄を隠す*/
.hidden {
  display: none !important;
}

/* style.css の修正箇所 */

/* ギャラリー */
#gallery {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  padding: 20px;
}

#gallery .item {
  background: #fff;
  border-radius: 6px;
  padding: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease-in-out;
  /* ★追加: Flexboxで内部要素を縦に配置 */
  display: flex;
  flex-direction: column;
  position: relative; /* ★削除ボタンの基準にする */
}

#gallery .item:hover {
  transform: scale(1.03);
}

#gallery .item img {
  width: 100%;
  /* ★修正: 高さを自動にし、縦横比を維持 */
  height: auto;
  /* ★追加: 画像が親要素にフィットするようにする */
  display: block;
  border-radius: 4px;
  /* ★追加: オーバーレイとの重なりを防ぐために位置を調整 */
  position: relative;
  z-index: 1;
}
/* 写真カード内のタグ（オーバーレイ） */
#gallery .item .overlay {
  /* ★修正: オーバーレイの表示方法を調整 */
  position: static; /* position: absolute; を static に変更 */
  padding-top: 5px; /* 画像とタグの間に少しスペースを空ける */
  background: none; /* グラデーション背景を削除し、透過にする */
}

#gallery .item span {
  /* ★修正: タグの背景色を調整し、読みやすくする */
  background-color: #e0e0e0; /* 明るいグレーに変更 */
  color: #333; /* 文字色を濃い色に */
  padding: 4px 8px; /* パディングを調整 */
  border-radius: 12px; /* 角を丸くする */
  font-size: 0.8em; /* フォントサイズを小さく */
  display: inline-block; /* インラインブロック要素にする */
}

/* 削除ボタン（灰色の×） */
.delete-button {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(200, 200, 200, 0.9); /* グレー背景 */
  color: #333; /* 濃いグレー文字 */
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  z-index: 2;
}

.delete-button:hover {
  background: rgba(150, 150, 150, 1); /* 濃いグレーに変化 */
  color: #fff; /* ホバー時は白文字で強調 */
}

/*mordal*/
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgb(0, 0, 0);
  background-color: rgba(0, 0, 0, 0.4);
  justify-content: center;
  align-items: center;
}
.modal-content {
  background-color: #fefefe;
  margin: auto;
  padding: 20px;
  border: 1px solid #888;
  width: 90%;
  max-width: 600px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  animation-name: animatetop;
  animation-duration: 0.4s;
}
.modal.is-active {
  display: block;
}

/* モーダル内の画像プレビューのスタイル */
#previewImage {
  width: 100%; /* 親要素の幅いっぱいに広げる */
}

/* サジェストリスト */
#suggestionList {
  position: absolute;
  top: 100%; /* 検索バーのすぐ下に表示 */
  left: 0;
  right: 0;
  background-color: #fff;
  border: 1px solid #ccc;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 10;
  margin-top: 1px;
}

#suggestionList li {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  color: #333; /* 文字色を黒に指定 */
}

#suggestionList li:last-child {
  border-bottom: none;
}

#suggestionList li:hover {
  background-color: #f0f0f0;
}

/* 検索候補にタグがないときのメッセージ */
.no-tag-message {
  color: #fff;
  background-color: #d9534f;
  font-weight: bold;
  text-align: center;
  padding: 8px 12px; /* liとpaddingを合わせる */
}

/* カード色変更用の色選択 */
#gallery .item {
  background: #fff; /* デフォルト白 */
  border-radius: 6px;
  padding: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease-in-out, background 0.3s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}


#mindmapModal .mindmap-modal-content {
  background-color: #131921;
  touch-action: none;
  /* ヘッダーと同じ背景色 */
  margin: auto;
  padding: 0;
  border: 1px solid #888;
  width: 100%;
  height: 100%;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: relative;
}

#mindmapContainer {
  position: relative;
  width: 100%;
  height: 100%;
  border: none;
}

.mindmap-close-btn {
  position: absolute;
  top: 15px;
  right: 25px;
  color: #fff;
  font-size: 35px;
  font-weight: bold;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10;
  padding: 5px 10px;
}

.mindmap-close-btn:hover,
.mindmap-close-btn:focus {
  color: #ff9900;
  text-decoration: none;
}

/* モーダル表示時に背景をスクロールさせない */
body.modal-open {
  overflow: hidden;
}

.node {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #ff9900;
  border: 2px solid white;
  color: white;
  text-align: center;
  font-weight: bold;
  cursor: pointer;
  transform: translate(-50%, -50%);
}