/*ログイン画面*/
/* ログイン画面モードのbody */
body.login-mode {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

/* アプリ画面モードのbody（ログイン後） */
body.app-mode {
  display: flex; /* 真ん中寄せを解除 */
  height: 100vh;
  margin: 0;
  overflow: hidden;
}

/* ログインのコンテナ（枠） */
.login-box {
  width: 800px;
  padding: 20px;
  justify-content: center;
  align-items: center;
}

/* タイトル部分 */
h1 {
  font-size: 24px;
  font-weight: normal;
  margin-bottom: 5px;
}

/* タイトルの下の青い線 */
.title-line {
  border-bottom: 2px solid #5d99d6;
  margin-bottom: 50px;
}

/* 入力欄のグループ（ラベルと入力欄を横並びに） */
.input-group {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

/* 入力ボックス */
body.login-mode .input-group input {
  width: 350px;
  padding: 8px;
  border: 2px solid #001f3f;
  font-size: 18px;
}
/* .input-group-auto textarea {
  width: 500px;
  padding: 8px;
  max-height: 400px;
  overflow-y: auto;
  border: 2px solid #001f3f;
  font-size: 16px;
} */

/* ログインボタン */
.login-btn {
  display: block;
  width: 300px;
  height: 60px;
  margin: 60px auto 0;
  background-color: #5d99d6;
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

/* メッセージ（エラーなど） */
#message {
  height: 20px;
  text-align: center;
  color: red;
  margin-top: 10px;
}

/* ログイン画面のコンテナを明示的に指定 */
#login-screen {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* メイン画面（ログイン後）のレイアウト */
#main-screen {
  width: 100%;
  height: 100vh;
}

.app-layout {
  display: flex;
  height: 100%;
  width: 100vw;
}

.sidebar {
  width: 250px;
  height: 100%;
  max-height: 100vh;
  background-color: #5d99d6;
  transition: width 0.3s;
  overflow: hidden; /* 💡 親要素からは絶対にハミ出させない */
  white-space: nowrap;

  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
/* ヘッダー部分（メニューと◁） */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background-color: #beeefd;
}
.sidebar-menuButton {
  padding: 20px;
}
.sidebar > details {
  flex-grow: 1;       /*  画面の余った縦幅をすべてこのエリアに割り当てる */
  flex-shrink: 1;     /*  画面が狭くなったら自分が縮む */
  min-height: 0;      /*  これがないと中身のボタンの高さ分、無限に下に伸びてしまいます */
  overflow-y: auto;   /*  縦幅を超えたら、このメニューエリアの中だけでスクロールバーを出す */
  overflow-x: hidden; /* 横スクロールは禁止 */
}
#menu-list {
  width: 100%;
}
/* 💡 スクロールバー全体のカスタマイズ設定 */
.sidebar > details {
  /* 1. バー自体の太さを指定（auto, thin, none から選べます） */
  scrollbar-width: thin; 
  /* 2. 色の指定（「動くツマミの色」 「背景の溝の色」 の順番で書く） */
  scrollbar-color: #beeefd transparent; 
}
/* Google Chrome や Edge などのための細かい調整（Webkit用） */
.sidebar > details::-webkit-scrollbar {
  width: 6px; /* 縦スクロールバーの横幅（細めに設定） */
}
/* つまみ部分（ドラッグして動かすところ） */
.sidebar > details::-webkit-scrollbar-thumb {
  background-color: #beeefd; /* つまみの色（ヘッダーと同じ水色に） */
  border-radius: 10px;       /* 角を丸めてやさしい印象に */
}
/* つまみをホバー（マウスを乗せた）したとき */
.sidebar > details::-webkit-scrollbar-thumb:hover {
  background-color: #8bb9e7; /* ホバー時は少し濃い青にして分かりやすく */
}
/* 溝の部分（背景） */
.sidebar > details::-webkit-scrollbar-track {
  background: transparent;   /* 背景は透明にしてサイドバーに馴染ませる */
}

.menu-item-btn {
  /* 1. 横幅を親要素（サイドバー）いっぱいに広げる */
  width: 100%;
  /* 2. もしボタンに余白が必要なら、これを追加 */
  box-sizing: border-box;
  /* 3. 文字を左寄せにする（がたがた感を消すため） */
  text-align: left;
  /* 4. 文字が長すぎた時にボタンを突き破らないようにする */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 10px;
  margin-top: 5px;
  background-color: transparent;
  border: 2px solid #beeefd;
  color: white;
  cursor: pointer;
  font-size: 14px;

  &:focus-visible {
    outline: dashed #00a5a0;
  }
}
.menu-item-btn:hover {
  background-color: #8bb9e7;
}
/* サイドバーが閉じられた時の状態 */
body.sidebar-closed .sidebar {
  width: 40px; /* 閉じた時の幅 */
}
body.sidebar-closed .sidebar-footer,
body.sidebar-closed .sidebar-title,
body.sidebar-closed .details-summary,
body.sidebar-closed .menu-item-btn,
body.sidebar-closed .tenant-item-btn {
  display: none; /* 中身を隠す */
}
body.sidebar-closed .sidebar-header {
  justify-content: center; /* 閉じている時はボタンを真ん中に寄せる */
  padding: 10px 0; /* 横のパディングをなくして中央に配置 */
}

/* ◁ ボタンのスタイル */
.toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;

  &:focus-visible {
    outline: dashed #00a5a0;
  }
}

.details-summary {
  cursor: pointer;
  transition: 0.2s;
  padding: 6px;
  font-size: 20px;
  color: white;

  /* ホバー時のスタイル */
  &:hover {
    cursor: pointer;
    /* background-color: #bee1de; */
    background-color: #8bb9e7;
  }

  /* タブフォーカス時のスタイル */
  &:focus-visible {
    outline: dashed #00a5a0;
  }
}

.sidebar-footer {
  /* margin-top: auto; */
  padding: 20px;
  flex-shrink: 0;
  background-color: #5d99d6;
}

.logout-btn {
  width: 100%;
  padding: 10px;
  background-color: #ff4d4d; /* 警告色（赤） */
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;

  &:focus-visible {
    outline: dashed #00a5a0;
  }
  &:hover {
    cursor: pointer;
    background-color: #cc0000;
  }
}

.main-content {
  flex-grow: 1;
  padding: 40px; /* 余白を広めに取ると見やすくなります */
  background-color: #fff;
  height: 100vh; /* 画面の高さに固定する */
  overflow-y: auto; /* 中身が高さを超えたら、縦スクロールバーを自動で出す */
  box-sizing: border-box;
  flex-direction: column;
}

.input-group-auto {
  display: flex; /* 横並びにする */
  align-items: center; /* 縦方向の真ん中で揃える */
  margin-bottom: 15px; /* 項目ごとの上下のすき間 */
}

.input-group-auto label {
  width: 170px; /* ★重要：ラベルの幅を固定する（文字数に合わせて調整してください） */
  flex-shrink: 0; /* 画面が狭くなってもラベルを潰さない */
  font-weight: bold; /* 文字を太くすると見やすくなります */
}

/* 入力フォーム */
/* .input-group-auto input,
.input-group-auto select {
   width: 500px;
  padding: 5px;         入力欄の中の余白
} */

.num-input-style,
.date-input-style,
.text-input-style {
  min-height: 1.5em;
  height: 30px;
  width: 500px;
  padding: 5px;
  box-sizing: border-box;
  font-size: 16px;
  border: 1px solid #001f3f;
}
select.text-input-style {
  height: auto; /* 高さを固定せず中身に合わせる */
  min-height: 30px; /* 最低限の高さは確保する */
  line-height: 1.5; /* 行間を広げて文字の上下が切れないようにする */
  overflow: hidden; /* はみ出しを隠す（または auto） */
}

.textarea-style {
  min-height: 1.5em;
  max-height: 150px;
  height: 30px;
  width: 500px;
  padding: 8px;
  box-sizing: border-box;
  font-size: 16px;
  overflow-y: auto;
  resize: none;
  border: 1px solid #001f3f;
}

.content-textarea-style {
  min-height: 200px;
  height: 200px;
  width: 100%;
  padding: 8px;
  box-sizing: border-box;
  font-size: 16px;
  overflow-y: auto;
  resize: none;
  border: 1px solid #001f3f;
}

.item-save-btn {
  margin-top: 10px;
  width: 100px;
  height: 50px;
  font-size: 18px;
  background-color: #43c36b;
  color: white;
  border: none;
  /* border-radius: 4px; */
  cursor: pointer;
  font-weight: bold;
  display: none;

  &:hover {
    background-color: #396246;
  }
}
.edit-mode .item-save-btn {
  display: block; /* 保存ボタンを出す */
}

.edit-mode .item-search-btn,
.edit-mode .item-edit-start-btn {
  display: none; /* 検索と編集ボタンを隠す */
}

.item-delete-btn {
  /* margin-top: 10px;
  margin-left: 10px;
  margin-bottom: 20px; */
  width: 200px;
  height: 50px;
  font-size: 18px;
  background-color: rgb(243, 1, 1);
  color: white;
  border: none;
  /* border-radius: 4px; */
  cursor: pointer;
  font-weight: bold;

  &:hover {
    background-color: rgb(157, 0, 0);
  }
}

.item-add-btn {
  /* margin-top: 10px; */
  /* margin-left: 10px; */
  /* margin-bottom: 20px; */
  width: 200px;
  height: 50px;
  font-size: 18px;
  background-color: #5d99d6;
  color: white;
  border: none;
  /* border-radius: 4px; */
  cursor: pointer;
  font-weight: bold;

  &:hover {
    background-color: #395d81;
  }
}

.item-cancel-btn {
  margin-top: 10px;
  margin-left: 10px;
  width: 120px;
  height: 50px;
  font-size: 18px;
  background-color: #aaaaaa;
  color: white;
  border: none;
  /* border-radius: 4px; */
  cursor: pointer;
  font-weight: bold;

  &:hover {
    background-color: #6b6b6b;
  }
}

.item-csv-btn {
  /* margin-top: 10px;
  margin-left: 10px;
  margin-bottom: 20px; */
  width: 300px;
  height: 50px;
  font-size: 18px;
  background-color: #aaaaaa;
  color: white;
  border: none;
  /* border-radius: 4px; */
  cursor: pointer;
  font-weight: bold;

  &:hover {
    background-color: #6b6b6b;
  }
}

.item-edit-start-btn {
  width: 70px;
  height: 50px;
  font-size: 18px;
  background-color: #43c36b;
  color: white;
  border: none;
  /* border-radius: 4px; */
  cursor: pointer;
  font-weight: bold;

  &:hover {
    background-color: #396246;
  }
}
.item-search-btn {
  width: 70px;
  height: 50px;
  font-size: 18px;
  background-color: #aaaaaa;
  color: white;
  border: none;
  /* border-radius: 4px; */
  cursor: pointer;
  font-weight: bold;

  &:hover {
    background-color: #6b6b6b;
  }
}
.item-clear-btn {
  width: 150px;
  height: 50px;
  font-size: 18px;
  background-color: #aaaaaa;
  color: white;
  border: none;
  /* border-radius: 4px; */
  cursor: pointer;
  font-weight: bold;

  &:hover {
    background-color: #6b6b6b;
  }
}

#admin-button-wrapper {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.form-action-area {
  display: flex;
  flex-direction: row; /* 横並びを強制 */
  align-items: center;
  gap: 10px; /* ボタン同士の間隔 */
  margin-top: 15px;
}

#controls {
  display: none;
  flex-shrink: 0;
  margin-top: 10px;
}

#form-container {
  flex-grow: 1;
  overflow-y: auto;
  padding-bottom: 50px;
}

.search-filter-area {
  display: flex;
  align-items: center; /* 垂直方向の真ん中寄せ */
  gap: 8px; /* 要素間の隙間 */
  margin-bottom: 20px;
}

/* 年月入力とドロップダウンの両方に適用 */
.month-picker,
.date-selector {
  height: 36px;
  padding: 0 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box; /* borderやpaddingを高さに含める */
  vertical-align: middle;
  cursor: pointer;
}

.month-picker:focus,
.date-selector:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.filter-clear-btn {
  /* margin-top: 10px;
  margin-left: 10px;
  margin-bottom: 20px; */
  width: 100px;
  height: 35px;
  font-size: 16px;
  background-color: #aaaaaa;
  color: white;
  border: none;
  /* border-radius: 4px; */
  cursor: pointer;
  font-weight: bold;

  &:hover {
    background-color: #6b6b6b;
  }
}

.tenant-search-area {
  position: relative; /* 子要素（リスト）が浮くための基準点になります */
  margin-bottom: 20px;
}
.tenant-suggestion-list {
  position: absolute; /* 浮かせます */
  top: 100%; /* 入力欄のすぐ下に配置 */
  left: 0;
  width: 250px;
  z-index: 1000; /* 他の要素よりも手前に表示されるようにする */

  /* 以下、見た目の調整 */
  background-color: white;
  border: 1px solid #ccc;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  cursor: pointer;
}
.tenant-search-input {
  min-height: 1.5em;
  height: 30px;
  width: 250px;
  padding: 5px;
  margin-right: 10px;
  box-sizing: border-box;
  font-size: 16px;
  border: 1px solid #001f3f;
}
.search-reset-btn {
  /* margin-top: 10px;
  margin-left: 10px;
  margin-bottom: 20px; */
  width: 100px;
  height: 30px;
  font-size: 16px;
  background-color: #aaaaaa;
  color: white;
  border: none;
  /* border-radius: 4px; */
  cursor: pointer;
  font-weight: bold;

  &:hover {
    background-color: #6b6b6b;
  }
}

.code-search-area {
  margin-bottom: 20px;
}
.code-search-input {
  min-height: 1.5em;
  height: 30px;
  width: 250px;
  padding: 5px;
  margin-right: 10px;
  box-sizing: border-box;
  font-size: 16px;
  border: 1px solid #001f3f;
}
.code-search-btn {
  /* margin-top: 10px;
  margin-left: 10px;
  margin-bottom: 20px; */
  width: 100px;
  height: 30px;
  font-size: 16px;
  background-color: #aaaaaa;
  color: white;
  border: none;
  /* border-radius: 4px; */
  cursor: pointer;
  font-weight: bold;

  &:hover {
    background-color: #6b6b6b;
  }
}

/* sidebar内テナントリストのスタイル */
.tenant-list-group {
  list-style: none;
  padding: 0; /* 字下げはボタンのpaddingで調整する方が綺麗です */
  margin: 0;
  display: flex; /* 縦に並べるための設定 */
  flex-direction: column;
}

.tenant-item-btn {
  display: block; /* ブロック要素にして縦に積む */
  width: 100%; /* 横幅いっぱい */
  padding: 10px 20px; /* 押しやすいように余白を確保 */
  cursor: pointer;
  font-size: 0.9em;
  color: #333;
  background-color: #beeefd;
  border: none;
  border-bottom: 3px solid #5d99d6; /* 境界線 */
  text-align: left;
  box-sizing: border-box;
  transition: background-color 0.2s;
}

.tenant-item-btn:hover {
  background-color: #96c6d4;
  color: white;
}

.menu-wrapper {
  display: flex;
  flex-direction: column; /* 子要素（ボタンとリスト）を縦に並べる */
  width: 100%;
}
