/* app.css : CasFW4 Bootstrap5ベース共通スタイル */

/* --- 全体 --- */
body {
   font-family: "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
   background-color: #f8f9fa;
   color: #212529;
}

/* --- ナビバー --- */
.navbar {
   height: 52px; /* 全体高さを固定 */
}

.navbar-brand {
   font-size: 1rem;
   padding-top: 0;
   padding-bottom: 0;
   line-height: 52px; /* 高さ中央に合わせる */
}

/* --- メニュー項目 --- */
.nav-link {
   font-size: 0.9rem; /* ← 小さめに調整 */
   padding: 0 0.75rem;
   line-height: 52px; /* ブランドと高さ揃える */
   font-weight: 500;
   color: #333;
   transition: color 0.2s;
}

.nav-link i {
   font-size: 1rem; /* アイコンを少し小さく */
   vertical-align: middle;
}

.content-wrapper {
   display: flex;
   align-items: flex-start;
}

/* 検索パネル本体 */
#search-panel {
   width: 260px;
   transition: margin-left 0.35s ease, opacity 0.25s ease;
   opacity: 1;
}

/* 閉じるとき：左に完全に引っ込める（領域ごと消す） */
#search-panel.panel-hidden {
   margin-left: -260px;
   opacity: 0;
}

/* 開くとき */
#search-panel.panel-show {
   margin-left: 0;
   opacity: 1;
}

/* 中身のスクロール */
#search-panel .card-body {
   max-height: calc(100vh - 150px);
   overflow-y: auto;
}

/* PCスタイル：通常ボタン */
#search-toggle {
   position: static;
   border-radius: 4px;
   padding: 4px 12px;
   font-size: 14px;
   display: inline-flex;
   align-items: center;
   gap: 4px;
}

/* --- ログインユーザー表示 --- */
.nav-link.text-danger {
   font-size: 0.9rem;
   font-weight: 600;
   line-height: 52px;
}

/* --- カード（ログインなど） --- */
.card {
   border: 1px solid #e0e0e0;
   border-radius: 0.75rem;
}
.card-title {
   font-weight: 600;
}

/* モーダル風フェードインアニメーション */
/* モーダル本体 */
.modal-dialog-scrollable .modal-body {
   max-height: calc(100vh - 200px);
   overflow-y: auto !important;
   -webkit-overflow-scrolling: touch;
}

.modal.fade .modal-dialog {
   transition: transform 0.2s ease-out, opacity 0.2s ease-out;
   transform: translateY(-240px);
   opacity: 0;
}
.modal.show .modal-dialog {
   transform: translateY(0);
   opacity: 1;
}

/* 背景レイヤー（開閉両方対応） */
.modal-backdrop.fade {
   opacity: 0;
   transition: opacity 0.3s ease-in-out;
}
.modal-backdrop.show {
   opacity: 0.5;
}

/* 背景レイヤー（グレー部分） */
.modal-backdrop.fade {
   opacity: 0;
   transition: opacity 0.2s ease-in-out;
}
.modal-backdrop.show {
   opacity: 0.5; /* Bootstrap標準の半透明 */
}

/* --- フォーム --- */
.form-label {
   font-weight: 500;
   font-size: 0.95rem;
}
.form-control {
   border-radius: 0.4rem;
   box-shadow: none;
}
.form-control:focus {
   border-color: #0d6efd;
   box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.1);
}

/* --- ボタン --- */
.btn-primary {
   font-weight: 400;
   letter-spacing: 0.03em;
}

/* === CSVアップロード・ダウンロードボタン === */
.data-import {
   position: relative;
   overflow: hidden;
}

#filesend {
   display: none !important;
}

.btn-sm {
   padding: 0.25rem 0.5rem;
   font-size: 0.875rem;
}

.btn i {
   vertical-align: middle;
}

/* --- エラーメッセージ --- */
.text-danger {
   font-size: 0.9rem;
   margin-top: 0.5rem;
}

.card {
   border: none;
   border-radius: 0.75rem;
   box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); /* やわらかいシャドウ */
}

/* --- ページャー --- */
.pager {
   border-top: 1px solid #e0e0e0;
   padding-top: 8px;
}
.pager .pagination {
   margin-bottom: 0;
   text-align: center;
}
.pager .displayNum select {
   min-width: 90px;
}

/* === フォームレイアウト調整: CasFW4 Bootstrap5業務版 === */

/* === フォームラベル最適化 === */
.form-label {
   margin-bottom: 0.25rem;
   font-weight: 500; /* 少し軽め、700→500 */
   font-size: 0.9rem; /* 少し小さく */
   color: #444; /* 真っ黒(#000)じゃなく、柔らかいグレー */
   letter-spacing: 0.02em; /* 若干の視認性UP */
}

/* 必須マーク微調整（彩度を抑える） */
.form-label.required::after {
   content: "（必須）";
   color: #c62828; /* 以前の#d32f2fより落ち着いた赤 */
   font-size: 0.8em;
   margin-left: 0.3em;
   vertical-align: middle;
   opacity: 0.9;
}

/* 全体の行間微調整 */
.row.g-3 {
   --bs-gutter-y: 0.7rem;
}

/* ついでに入力欄の高さバランス調整 */
.form-control {
   padding: 0.4rem 0.6rem;
   font-size: 0.95rem;
}

/* セレクトも同様に */
.form-select {
   padding: 0.4rem 0.6rem;
   font-size: 0.95rem;
}

.rest-number {
   text-align: right;
}
/* === モーダル／カードフッターのボタン配置最適化 === */
.card-footer {
   background-color: #f9fafb; /* わずかにトーンを変えてエリア感を出す */
   border-top: 1px solid #dee2e6;
   padding: 1rem 1.25rem; /* 上下にゆとりを持たせる */
}

/* ボタン間の距離・並びの最適化 */
.card-footer .btn {
   min-width: 90px; /* ボタン幅を統一 */
   font-weight: 500;
   letter-spacing: 0.03em;
}

.card-footer .btn + .btn {
   margin-left: 0.5rem; /* 間隔を確保 */
}

/* ボタン配置全体の右寄せ（モダンUI風） */
.card-footer .ms-auto {
   display: flex;
   justify-content: flex-end;
   gap: 0.5rem;
}

/* --- レスポンシブ微調整 --- */
@media (max-width: 576px) {
   .card {
      margin: 0 1rem;
   }
   .card-footer .ms-auto {
      justify-content: center;
      flex-wrap: wrap;
      gap: 0.75rem;
   }
}

/* === スマホ対応: 検索パネルを全画面オーバーレイに === */
@media (max-width: 768px) {
   .content-wrapper {
      flex-direction: column;
   }

   #search-panel {
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw !important;
      height: 100vh;
      background: #fff;
      z-index: 1050;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
      transition: transform 0.35s ease, opacity 0.25s ease;
   }

   /* 💡横スライド指定を完全に無効化 */
   #search-panel.panel-hidden {
      transform: translateY(-100%);
      opacity: 0;
      margin-left: 0 !important; /* ← これ重要！PC用を無効化 */
   }

   #search-panel.panel-show {
      transform: translateY(0);
      opacity: 1;
      margin-left: 0 !important;
   }

   /* フローティングボタン */
   #search-toggle {
      position: fixed;
      bottom: 16px;
      right: 16px;
      z-index: 1030 !important;
      border-radius: 50%;
      width: 56px;
      height: 56px;
      display: flex;
      justify-content: center;
      align-items: center;
      background: #0d6efd;
      color: #fff;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
   }

   #search-toggle i {
      font-size: 22px;
   }

   /* スクロール防止用（パネル内のみスクロール） */
   #search-panel .card-body {
      height: calc(100vh - 70px);
      overflow-y: auto;
   }

   #search-toggle {
      position: fixed;
      bottom: 16px;
      right: 16px;
      border-radius: 50%;
      width: 56px;
      height: 56px;
      justify-content: center;
      font-size: 0; /* ← テキスト非表示 */
      background: #0d6efd;
      color: #fff;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
      z-index: 1100;
   }

   #search-toggle i {
      font-size: 24px;
   }

   /* テキストを隠してアイコンだけ */
   #search-toggle::after {
      content: "";
   }

   .card {
      margin-top: 20px;
   }

   .modal-dialog {
      margin: 0;
      height: 100vh;
      max-width: 100%;
   }

   .modal-content {
      height: 100%;
      border-radius: 0; /* スマホアプリ風に角をなくす */
   }

   .modal-dialog-scrollable .modal-body {
      height: calc(100vh - 140px); /* ヘッダー＋フッター分を除外 */
      max-height: none;
      overflow-y: auto;
   }

   .modal-backdrop.show {
      opacity: 0.6;
   }
}
