/* ============================= */
/* サイトコンテンツカラー */
/* ============================= */

:root {
    --background-main: #f0f0f0;
    --text-main: #333;
    --text-secondary: #555;
    --button-bg: #333;
    --button-hover-bg: #444;
    --error-color: #800000;
    --message-color: #00008b;
    --border-color: #ccc;
    --popup-bg: white;
    --overlay-bg: rgba(0, 0, 0, 0.5);
    --search-bg: #f9f9f9;
}

/* ============================= */
/* 基本スタイル */
/* ============================= */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

html {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    flex-grow: 1;
    min-height: 0vh;
    margin: 0;
    padding-top: 35px;
    background-color: var(--background-main);
    font-family: Arial, sans-serif;
    text-align: center;
    animation: fadeIn 2s ease-in-out;
}

footer {
    margin-top: auto;
}

/* ============================= */
/* 各OS・各ブラウザのデフォルトカラー制御 */
/* ============================= */

/* フォーカス時アウトライン色 */
:focus {
    outline: 2px solid var(--button-bg);
}

/* フォーム要素フォーカス背景色とテキスト色 */
input:focus, select:focus, textarea:focus {
    background-color: var(--popup-bg);
    color: var(--text-main);
    border-color: var(--border-color);
}

/* 【iOS Safari】プルダウンメニュー内文字色 */
select,
select option {
    color: var(--text-main);  /* メニュー内テキスト色 */
    background-color: var(--popup-bg);  /* メニュー背景色 */
}

/* 【Chrome/Firefox/Edge】プルダウン選択肢ホバー時背景色 */
select option:hover {
    background-color: var(--button-bg);  /* ホバー時背景色 */
    color: #fff;  /* ホバー時文字色 */
}

/* 【iOS Safari】プルダウン選択ハイライト色 */
select:focus option:checked {
    background-color: var(--button-bg);  /* ハイライト背景色 */
    color: #fff;  /* ハイライト時文字色 */
}

/* プルダウンメニューのカスタムデザイン */
select {
    appearance: none;          /* ChromeネイティブUI無効化 */
    -webkit-appearance: none;  /* SafariネイティブUI無効化 */
    -moz-appearance: none;     /* FirefoxネイティブUI無効化 */
    background-color: var(--popup-bg);  /* 通常背景色 */
    color: var(--text-main);            /* 通常文字色 */
    border: 1px solid var(--border-color);
    padding: 8px;
    cursor: pointer;
}

/* プルダウンメニューの選択肢カスタマイズ */
select option {
    background-color: var(--popup-bg);  /* 通常背景色 */
    color: var(--text-main);            /* 通常文字色 */
}

/* プルダウンメニューの選択肢ホバー時 */
select option:hover {
    background-color: var(--button-bg);  /* ホバー時背景色 */
    color: #fff;                         /* ホバー時文字色 */
}

/* 【iOS Safari】テキスト選択ハイライト色 */
::selection {
    background-color: var(--button-bg);
    color: #fff;
}

/* 【iOS Safari】リンクやボタンのタップ時ハイライト色無効化 */
a, button, input, textarea, select {
    -webkit-tap-highlight-color: transparent;
}

/* ============================= */
/* ボタンのスタイル */
/* ============================= */
button {
    transition: 0.3s ease-in-out;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ============================= */
/* ヘッダー・フッター */
/* ============================= */
header {
    width: 100%;
    background-color: var(--text-main);
    color: white;
    text-align: center;
    padding: 10px 0;
}

footer {
    width: 100%;
    background-color: transparent;
    color: white;
    text-align: center;
    line-height: 0;
    padding: 10px 0;
    margin: 0;
    bottom: 0;
}

/* ============================= */
/* admin_tool.php と password_update.php に対する設定 */
/* ============================= */

body.admin-tool,
body.password-update {
    min-height: hidden;
    overflow-x: hidden;
}

/* ============================= */
/* コンテナの設定 */
/* ============================= */

.container {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
}

/* ============================= */
/* container に overflow を追加して、スクロールを制御 */
/* ============================= */

.container.admin-tool-container {
    overflow: hidden;
}


.category-name {
    font-weight: bold;
}


/* ============================= */
/* 小さなブランドロゴのスタイル */
/* ============================= */

.brand-logo {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-main);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* ============================= */
/* ロゴのスタイル設定 */
/* ============================= */

.logo {
    font-size: 5em;
    color: var(--text-main);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
}

/* ============================= */
/* システムタイトルのスタイル設定 */
/* ============================= */

.system_title {
    font-size: 1.2em;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.5;
    margin-bottom: 20px;
}




/* ============================= */
/* 検索機能エリアのスタイル */
/* ============================= */

.search-container {
    margin: 10px auto 20px;
    padding: 10px;
    background-color: var(--search-bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
  height: 1000px;
    max-width: 85%;
    text-align: center;
    position: relative;
}

/* ============================= */
/* 検索結果のカテゴリ名のスタイル */
/* ============================= */

.category-name {
    font-weight: bold;
}

/* ============================= */
/* 検索フォームのスタイル */
/* ============================= */

.search-form {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* ============================= */
/* ラジオボタンのスタイル */
/* ============================= */

.radio-group {
    display: flex;
    align-items: center;
    gap: 3px;
}

.radio-group input[type="radio"] {
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    background-color: #fff;
    appearance: none;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 2px transparent;
    position: relative;
}

.radio-group input[type="radio"]:checked {
    background-color: transparent;
    border-color: var(--text-secondary);
    box-shadow: 0 0 0 4px rgba(85, 85, 85, 0.2);
}

.radio-group input[type="radio"]:checked::before {
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    margin-left: -3px;
    border-radius: 50%;
    background-color: var(--text-secondary);
}

/* ============================= */
/* ラジオボタンのラベル */
/* ============================= */

.radio-group label {
    font-size: 14px;
    color: var(--text-main);
    cursor: pointer;
    margin-right: 10px;
}

/* ============================= */
/* テキスト入力フィールドのスタイル */
/* ============================= */

input[type="text"] {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    height: 15px;
}

/* ============================= */
/* オートコンプリートドロップダウンのスタイル */
/* ============================= */

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px); /* 検索バーの直下に配置 */
  left: 0;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 100%; /* 親要素に合わせる */
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  font-size: 14px;
  display: none; /* 初期状態では非表示 */
}

.autocomplete-item {
  padding: 8px 10px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.autocomplete-item:hover {
  background-color: #f0f0f0;
}

/* ============================= */
/* ボタンスタイル */
/* ============================= */

.search-form button {
  padding: 8px 15px;
  background-color: #333;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px; /* 文字サイズを変更 */
  height: 30px;
  line-height: 15px; /* 中央揃え */
}

.search-form button:hover {
  background-color: #444;
}

/* ============================= */
/* Undoボタンのスタイル */
/* ============================= */

.search-form button#undo-button {
  padding: 8px 15px;
  background-color: #333;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  height: 30px;
  line-height: 15px;
}

.search-form button#undo-button:hover {
  background-color: #444;
}

/* ============================= */
/* 検索結果エリア */
/* ============================= */

.results-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin: 20px auto;
  width: 95%;
  max-width: 1200px;
  height: auto;
  overflow-y: auto;
}

/* ============================= */
/* 結果エリアのスタイル */
/* ============================= */

.result-area {
  flex: 1 1 calc(48% - 10px);
  position: relative;
  margin-bottom: 15px;
  max-height: 200px;
  padding: 15px;
  background-color: #f9f9f9;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
}

/* ============================= */
/* 結果エリア内のテキスト */
/* ============================= */

.result-area ul {
  text-align: left; /* 左詰め */
  padding-left: 20px; /* 左余白を追加 */
  margin: 0; /* 外側の余白をリセット */
  list-style-position: inside; /* 箇条書きのインデント調整 */
}

/* ============================= */
/* 結果エリアのヘッダー部分（項目バー） */
/* ============================= */

.result-header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to right, #666, #aaa); /* グラデーション */
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.9em;
  color: #fff;
  z-index: 10;
}

/* ============================= */
/* モーダルエリアスタイル */
/* ============================= */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

/* ============================= */
/* モーダルエリアスタイル */
/* ============================= */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--overlay-bg);
  z-index: 1000;
}

.modal-content {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  text-align: left;
  background-color: var(--popup-bg);
  border-radius: 4px;
  padding: 16px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  z-index: 1001;
}

/* ============================= */
/* モーダルヘッダー */
/* ============================= */

.modal-header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to right, #666, #aaa);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.9em;
  color: #fff;
  z-index: 10;
}

/* ============================= */
/* 閉じるボタン */
/* ============================= */

.modal-content .close-button {
  padding: 4px 8px;
  font-size: 0.8em;
  background-color: var(--button-bg);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.modal-content .close-button:hover {
  background-color: var(--button-hover-bg);
}

/* ============================= */
/* スクロール禁止クラス */
/* ============================= */

.no-scroll {
  overflow: hidden;
}

/* ============================= */
/* レスポンシブ対応 */
/* ============================= */

@media (max-width: 768px) {
  .result-area {
    flex: 1 1 100%;
  }
}

/* ============================= */
/* スマートフォン縦画面時の検索バー（三行表示） */
/* ============================= */

@media (max-width: 540px) and (orientation: portrait) {
  .search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .search-form input[type="text"] {
    width: 95%;
  }

  .radio-group {
    justify-content: center;
  }

  .search-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
  }
}

/* ============================= */
/* スマートフォン縦画面時だけ検索結果リンクの文字サイズを小さくする */
/* ============================= */

@media (max-width: 540px) and (orientation: portrait) {
  .result-area a {
    font-size: 10px;
  }
}

/* ============================= */
/* パスワード入力ボックスのスタイル */
/* ============================= */

input[type="password"] {
    margin: 10px 0;
    padding: 10px;
    font-size: 14px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    width: 250px;
}

/* ============================= */
/* パスワード変更フォームのスタイル */
/* ============================= */

.password-change-form {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ============================= */
/* パスワード入力フィールドのスタイル */
/* ============================= */

.password-change-form input[type="password"],
input[type="file"],
input[type="text"] {
  margin: 10px 0;
  padding: 10px;
  font-size: 14px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  width: 250px;
}

/* ============================= */
/* ボタンコンテナのスタイル設定 */
/* ============================= */

#confirm_buttons_container,
#password_buttons_container {
  display: flex;
  justify-content: center;
  gap: 50px;
  margin-top: 20px;
}

/* ============================= */
/* ボタンのスタイル設定 */
/* ============================= */

button {
  padding: 8px 15px;
  font-size: 12px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  background-color: var(--button-bg);
  color: white;
}

button:hover {
  background-color: var(--button-hover-bg);
}

/* ============================= */
/* 特殊ボタンのスタイル設定（戻る、CSVアップロード、管理ツール） */
/* ============================= */

#admin_tool_button,
#ReturnButton,
#ChangePasswordButton,
#csvButton {
  font-size: 0.8em;
  color: #666;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer;
  margin-top: 10px;
}

#admin_tool_button:hover,
#ReturnButton:hover,
#ChangePasswordButton:hover,
#csvButton:hover {
  background-color: var(--search-bg);
  color: #333;
}

/* ============================= */
/* 戻るボタンのスタイル設定 */
/* ============================= */

#ReturnButton {
  text-decoration: none;
}

/* ============================= */
/* モーダルのボディ */
/* ============================= */

.modal-body {
  max-height: 400px;
  overflow-y: auto;
}

/* ============================= */
/* オーバーフロー処理 */
/* ============================= */

.container.search-container {
  overflow-x: hidden; /* 横スクロールを無効化 */
}

#results-container {
  max-height: 500px; /* 結果表示エリアの最大高さ */
  overflow-y: scroll; /* 結果表示エリアに縦スクロールを追加 */
}

/* ============================= */
/* ポップアップのスタイル設定 */
/* ============================= */

.popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--popup-bg);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

/* ============================= */
/* ポップアップ内のパスワード入力フィールドのスタイル */
/* ============================= */

.popup input[type="password"] {
  padding: 10px;
  font-size: 14px;
  width: 200px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
}

/* ============================= */
/* ポップアップ内のボタンのスタイル */
/* ============================= */

.popup button {
  padding: 10px 20px;
  background-color: var(--button-bg);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  margin: 5px;
}

.popup button:hover {
  background-color: var(--button-hover-bg);
}

/* ============================= */
/* オーバーレイのスタイル設定 */
/* ============================= */

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--overlay-bg);
  z-index: 999;
}

/* ============================= */
/* 並び替えドロップダウンのスタイル */
/* ============================= */

#sortSelect {
  font-size: 14px;
  padding: 8px;
  width: 250px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  margin-top: 20px;
}

/* ============================= */
/* CSVアップロード用のスタイル */
/* ============================= */

#csv_file {
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 8px;
  width: 300px;
}

/* ============================= */
/* 検索結果リンクのスタイル */
/* ============================= */

a {
  color: #333;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

/* ============================= */
/* 検索結果リンクのホバー時のスタイル */
/* ============================= */

a:hover {
  color: #444;
}

/* ============================= */
/* 訪問済みリンクのスタイル */
/* ============================= */

a:visited {
  color: #555;
}

/* ============================= */
/* クリック時のリンクのスタイル */
/* ============================= */

a:active {
  color: #fef7e0 !important; /* 薄いクリーム色 */
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 
               0 0 30px rgba(255, 255, 255, 0.6), 
               0 0 45px rgba(255, 255, 255, 0.4);
}

/* ============================= */
/* CSVアップロードと並び替え機能に関するコメント */
/* ============================= */

/* CSVアップロードと並び替え機能は、CSVのアップロード画面とデータ表示画面で使用されます。 */
/* CSVアップロードはファイルを選択し、サーバーにアップロードする際に使用されます。 */
/* 並び替え機能は、データ一覧をユーザーが選択した基準で並び替えるためのものです。 */

/* ============================= */
/* 最終確認：スタイル適用の整合性チェック */
/* ============================= */

/* すべての要素のスタイルが一貫して適用されているか最終チェック済み */
/* 余分な空行や不要な重複コードは整理済み */