/* --- 基本構造（オリジナルを維持） --- */
* {
  box-sizing: border-box;
}

body {
  background: rgb(199, 232, 248);
  height: 100%;
  font-family: "Kosugi Maru", sans-serif;
  margin: 0;
}

html {
  height: 100%;
}

img {
  max-width: 100%;
  height: auto;
}

.clearfix:before,
.clearfix:after {
  content: "";
  display: table;
}
.clearfix:after {
  clear: both;
}
.clearfix {
  zoom: 1;
}

#search,
#contents,
#data,
#banner {
  margin-left: auto;
  margin-right: auto;
  padding: 20px;
  overflow: auto;
  max-width: 1280px;
  background: white;
}

#search .container,
#contents .container,
#data .container {
  width: 100%;
}

/* --- レイアウト（フロート構造を維持） --- */
#contents .container #map_etc {
  width: 70%;
  float: left;
}

#contents .container #sidemenu {
  width: 30%;
  float: right;
}

#contents .container #gmap3 {
  width: 100%;
  height: 650px;
}

/* --- 【重要】リストマークを完全に消す設定 --- */
#sidemenu ul {
  list-style: none !important;
  padding: 0;
  margin: 0;
}

#sidemenu li {
  list-style: none !important;
}

/* --- 施設名検索（サイズ調整） --- */
#search_box {
  text-align: center;
  padding: 10px 0;
}
#search_box input[type="text"] {
  padding: 10px;
  font-size: 18px;
  width: 300px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
#search_box input[type="button"] {
  padding: 10px 20px;
  font-size: 18px;
  cursor: pointer;
  background: #036eb7;
  color: white;
  border: none;
  border-radius: 4px;
}

/* --- 地区ボタン --- */
#contents .container #sidemenu #region .chiku li {
  width: 47%;
  margin-left: 2.5%;
  margin-bottom: 2.5%;
  float: left;
}

.check_radio_box label {
  line-height: 40px;
  height: 40px;
  display: block;
  font-size: 18px;
  font-weight: bold;
  padding-left: 0.4em;
  cursor: pointer;
  border-radius: 5px;
}

.check_radio_box input {
  transform: scale(1.5);
  margin-right: 0.5em;
}

/* 地区カラー */
.nakahiro {
  background-color: #fce2b4;
  color: #1d2088;
}
.kannon {
  background-color: #c9e3f6;
  color: #1d2088;
}
.koi {
  background-color: #d8e9c7;
  color: #1d2088;
}
.huruta {
  background-color: #fae1ec;
  color: #1d2088;
}
.kougo {
  background-color: #d8a9b8;
  color: #1d2088;
}
.inokuchi {
  background-color: #faee00;
  color: #1d2088;
}

/* ジャンルエリア --- */
#contents .container #sidemenu #junle .junle {
  width: 47%;
  margin-left: 2.5%;
  margin-bottom: 2.5%;
  float: left;
}
#contents .container #sidemenu #junle .junle h3 {
  line-height: 40px;
  height: 40px;
  font-size: 20px;
  text-align: center;
  color: #fff;
  margin-bottom: 5%;
}
#contents .container #sidemenu #junle .junle h3.ika {
  background-color: #036eb7;
}
#contents .container #sidemenu #junle .junle h3.kaigo {
  background-color: #0dac67;
}

#contents .container #sidemenu #junle .junle ul li {
  line-height: 40px;
  height: 40px;
  border-radius: 10px;
  width: 95%;
  margin-left: 2.5%;
  margin-bottom: 5%;
}

/* ジャンルカラー */
.ika {
  background-color: #009fe8;
  color: #fff;
}
.shika {
  background-color: #f7b52c;
  color: #fff;
}
.yakkyoku {
  background-color: #00913a;
  color: #fff;
}
.kyotaku {
  background-color: #7e946f;
  color: #fff;
}
.houmonkango {
  background-color: #a068a2;
  color: #fff;
}
.tuushoriha {
  background-color: #ea5f00;
  color: #fff;
}
.tuushokaigo {
  background-color: #b98a00;
  color: #fff;
}
.ninchishou {
  background-color: #4d4397;
  color: #fff;
}
.houmonkaigo {
  background-color: #e50012;
  color: #fff;
}
.short {
  background-color: #74c5be;
  color: #fff;
}
.houmonriha {
  background-color: #c5d11f;
  color: #fff;
}

/* --- 【修正】テーブル改善：ウィンドウ幅を縮めても潰れない設定 --- */
.tableWrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 10px 0;
  border: 1px solid #ddd;
  /* スクロールバーがテーブルの枠線に被らないよう余白を設ける */
  padding-bottom: 5px;
}

/* --- 【追加】横スクロールを促すカスタムスクロールバー --- */
/* スマホでは標準のスワイプ操作が直感的なため、主にPCブラウザ向けにスクロールバーをカスタマイズ */
.tableWrapper::-webkit-scrollbar {
  height: 12px; /* スクロールバーの太さをしっかり確保 */
}
.tableWrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 6px;
}
.tableWrapper::-webkit-scrollbar-thumb {
  background: #036eb7; /* サイトのテーマカラーに合わせた青 */
  border-radius: 6px;
  border: 2px solid #f1f1f1; /* バーとトラックの間に少し隙間を作る */
}
.tableWrapper::-webkit-scrollbar-thumb:hover {
  background: #1d2088; /* ホバー時は少し濃い青に */
}

/* --- 【修正版】スクロールを促すメッセージ --- */
.scroll-hint-msg {
  position: sticky;
  left: 0;
  bottom: 10px; /* ★追加：表が長い場合、画面下部にピタッと追従する */
  width: 100%;
  box-sizing: border-box;
  padding-right: 10px;
  text-align: right;
  color: #036eb7;
  font-size: 13px;
  font-weight: bold;
  margin-top: 15px; /* ★変更：上の表との間に少しゆとりを持たせる */
  margin-bottom: 2px; /* スクロールバーとの隙間 */
  opacity: 1;
  z-index: 10;
  pointer-events: none;
  transition:
    opacity 0.5s ease,
    visibility 0.5s;
  animation: slide-x 1.5s infinite ease-in-out;
}

.scroll-hint-msg.hidden {
  opacity: 0;
  visibility: hidden;
}

@keyframes slide-x {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-5px);
  }
}

#display_table table {
  /* 100%に固定せず中身の幅を優先させ、必要に応じて横スクロールさせる */
  width: auto;
  min-width: 100%;
  border-collapse: collapse;
}

#display_table th,
#display_table td {
  border: 1px solid #ddd;
  padding: 10px 8px;
  text-align: center;
  /* 記号列でも最低限の幅を確保し、文字が縦に並ぶのを防ぐ */
  min-width: 60px;
}

/* PC版：PR列の幅確保（Perlで付与した col-pr クラスを使用） */
.col-pr {
  min-width: 450px !important;
  text-align: left !important;
  line-height: 1.7;
  padding: 15px !important;
  background-color: #fdfdfd;
  white-space: normal; /* 折り返しを確実に */
}

/* 名称と住所も潰れすぎないように保護 */
#display_table td:nth-child(1),
#display_table td:nth-child(2) {
  min-width: 160px;
  text-align: left;
}

#display_table thead th {
  position: sticky;
  top: 0;
  background: #f9f9f9;
  z-index: 5;
  box-shadow: 0 1px 0 #ddd;
}

/* --- ボタン・ナビ --- */
.print-button {
  display: inline-block;
  padding: 5px 15px;
  background: #666;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  margin: 10px 0;
}

#back-to-map {
  position: fixed;
  right: 0;
  top: 50%;
  writing-mode: vertical-rl;
  text-orientation: upright;
  background-color: #036eb7;
  padding: 10px;
  text-decoration: none;
  color: #fff;
  font-weight: bold;
  border-radius: 5px 0 0 5px;
  z-index: 999;
}

/* --- レスポンシブ (1049px以下) --- */
@media screen and (max-width: 1049px) {
  #contents .container #map_etc {
    width: 100%;
    float: none;
  }
  #contents .container #sidemenu {
    margin-top: 1em;
    width: 100%;
    float: none;
    clear: both;
  }
  #contents .container #sidemenu #region .chiku li,
  #contents .container #sidemenu #junle .junle {
    width: 49%;
    margin: 0.5%;
  }
}

/* --- スマホ専用：カード型レイアウト --- */
@media screen and (max-width: 1049px) {
  .card-wrapper {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 20px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  }

  .card-row {
    display: flex;
    border-bottom: 1px solid #eee;
    padding: 8px 0;
  }

  .card-row:last-child {
    border-bottom: none;
  }

  .card-label {
    width: 40%;
    font-weight: bold;
    color: #1d2088;
    font-size: 14px;
    background: #f0f7ff;
    padding: 5px;
    border-radius: 4px;
    margin-right: 10px;
    display: flex;
    align-items: center;
  }

  .card-value {
    width: 60%;
    font-size: 15px;
    padding: 5px;
    word-break: break-all;
  }

  /* スマホ版PR行の最適化（Perl側で col-pr クラスが付いた行を縦並びにする） */
  .card-row.col-pr {
    flex-direction: column;
  }
  .card-row.col-pr .card-label,
  .card-row.col-pr .card-value {
    width: 100%;
    margin-bottom: 5px;
  }
}

/* 初期表示：アコーディオンを閉じる設定 */
.tableWrapper,
.card-wrapper {
  display: none;
  margin-top: 5px;
}

/* --- 印刷時の微調整（ブラウザ標準印刷用） --- */
@media print {
  .print-button,
  #back-to-map,
  #sidemenu,
  #search {
    display: none !important;
  }
  #contents,
  #map_etc {
    width: 100% !important;
    float: none !important;
  }
  .tableWrapper {
    overflow: visible !important;
  }
  table {
    zoom: 0.8;
  }
}

.result-count {
  font-size: 16px;
  font-weight: bold;
  margin: 10px 0 15px;
  padding: 10px;
  background: #f5f8fc;
  border-left: 5px solid #036eb7;
}

/* スマホ版：親要素のセクション見出し */
.card-section-title {
  background-color: #036eb7; /* 青色 */
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  padding: 8px 10px;
  margin-top: 15px; /* 上の項目との間に余白を作って区切りを強調 */
  margin-bottom: 5px;
  border-radius: 4px;
  text-align: center;
  letter-spacing: 1px;
}

/* 親要素がない「その他の情報」用の色変更（グレー系に） */
.card-section-title.title-other {
  background-color: #6c757d;
}

/* 見出し直後の罫線を消す */
.card-section-title + .card-row {
  border-top: none;
}
