/* ===============================
   common.css - 親ページ & iframe 共通
=============================== */

/* ------------------------------
   全体共通
------------------------------- */
:root {
  --bg-light: #f9f9f9;
  --header-bg: #2196f3;
  --header-color: #fff;
  --nav-active-bg: #1565c0;
  --button-bg: #2c7be5;
  --button-hover-bg: #1a5bbf;
  --danger-bg: #CC0000;
  --danger-hover-bg: #FF0000;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", sans-serif;
  background: var(--bg-light);
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ------------------------------
   ヘッダー
------------------------------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--header-bg);
  color: var(--header-color);
  padding: 10px 20px;
  white-space: nowrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 30px;
}

.system-title {
  font-size: 24px;
  font-weight: bold;
  position: relative;
  top: -3px;
}

.nav {
  display: flex;
  gap: 10px;
}

.nav-link {
  display: inline-block;
  color: var(--header-color);
  text-decoration: none;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  transition: background 0.2s;
}

.nav-link:hover {
  background: rgba(255,255,255,0.25);
}

.nav-link.active {
  background: var(--nav-active-bg);
  box-shadow: 0 0 4px rgba(0,0,0,0.2);
}

.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

#logout-btn {
  background: var(--danger-bg);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
}

#logout-btn:hover {
  background: var(--danger-hover-bg);
}


h1 {
    display: block;
    font-size: 1.3em;             
    margin-block-start: 0.35em;   /* 上の余白 */
    margin-block-end: 0.35em;     /* 下の余白 */
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    font-weight: bold;
    unicode-bidi: isolate;
}

/* ------------------------------
   メインエリア & iframe ページ
------------------------------- */
main {
  margin-top: 60px; /* ヘッダー高さ分 */
  height: calc(100vh - 60px);
  overflow: hidden;
}

.page {
  width: 100%;
  height: 100%;
  background: var(--bg-light);
  box-sizing: border-box;
  padding: 0;
}

.page iframe {
  width: calc(100% - 20px); /* 左右の余白分を差し引く */
  margin-left: 10px;        /* 左に20px余白 */
  margin-right: 10px;       /* 右にも同じ余白を入れる場合 */
  height: 100%;
  border: none;
  display: block;
}
/* ------------------------------
   toolbar & filters
------------------------------- */
.toolbar {
  background: #fff;
  padding: 6px 12px;
  border-bottom: 1px solid #ccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.toolbar .button-group {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filters label {
  font-size: 14px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
}

select,
input[type="text"],
.filters input,
.filters select {
  font-size: 13px;
  padding: 3px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: #fff;
}

/* ------------------------------
   ボタン
------------------------------- */
button {
  padding: 6px 14px;
  border: none;
  background-color: var(--button-bg);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  background-color: var(--button-hover-bg);
}

/* ------------------------------
   テーブル
------------------------------- */
.table-container {
  flex: 1;
  overflow-y: auto;
  background: #fff;
}

table {
  border-collapse: collapse;
  width: auto;
  min-width: 350px;
  font-size: 13px;
}

th, td {
/*  border-bottom: 1px solid #ddd;*/
  border: 1px solid #ddd;   /* これで縦線・横線両方 */
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f3f3f3;
  z-index: 1;
}

tr:hover {
  background: #f5faff;
}

/* ------------------------------
   モーダル共通
------------------------------- */
.modal-bg {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: #fff;
  padding: 20px 30px;
  border-radius: 8px;
  width: auto;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  min-width: 500px;   /* ← 最低限の幅を強制 */
}

.modal h2 {
  margin-top: 0;
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal label {
  display: flex;
  flex-wrap: nowrap;
  flex-direction: row;
  align-items: left;
  gap: 8px;
  width: 100%;
}

.modal label span {
  flex-shrink: 0;
  width: 120px;
  font-size: 0.9rem;
}

.modal input[type="text"],
.modal input[type="email"],
.modal select {
  flex: 1;
  width: 100%;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.triple-select {
  display: flex;
  gap: 8px;
}

.triple-select label {
  flex: 1;
  flex-direction: column;
}

.triple-select select {
  width: 100%;
  box-sizing: border-box;
}


/* 2 カラム用レイアウト */
.modal-row {
  display: flex;
  justify-content: space-between; /* 左右に配置 */
  align-items: flex-start; /* 上揃え */
  gap: 1%; /* 左右の間隔 */
}

.status-wrapper,
.lost-reason-wrapper {
  width: 49%;
}

.lost-reason-wrapper {
  display: flex;
  flex-direction: column; /* 縦並び */
  align-items: flex-end;   /* 右端に寄せる */
}

.status-wrapper label,
.lost-reason-wrapper label {
  display: block;
  width: 100%;
}

.status-wrapper select,
.lost-reason-wrapper select {
  width: 100%;
  box-sizing: border-box;
}

/* hidden の処理 */
.lost-reason-wrapper.hidden {
  visibility: hidden;
  pointer-events: none;
}



.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  margin-left: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
}

.modal-actions .left-actions {
  display: flex;
  margin-right: 60px;
}

.hidden {
  display: none !important;
}

/* ------------------------------
   入力補助（suffix など）
------------------------------- */
.input-with-suffix {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
}

.input-with-suffix input[type="text"] {
  flex: 1;
  padding: 6px 8px;
  font-size: 14px;
}

.input-with-suffix .suffix {
  white-space: nowrap;
  color: #333;
  font-weight: 500;
  font-size: 14px;
}


/* ===============================
   従業員　備考
=============================== */
.note-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  white-space: nowrap;
}

.note-label textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}

.note-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px; /* 調整可能 */
}

.hide-cost {
  display: none;
}


/* ===============================
   ログイン画面専用
=============================== */
#login-form-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50vh; /* 画面全体 */
  background: var(--bg-light);
}

/* ===============================
   ログイン画面専用
=============================== */
#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 480px;       /* PC向けの幅 */
  max-width: 90%;     /* 画面狭い場合は縮小 */
  margin: 100px auto; /* 上下中央寄せ */
  padding: 30px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}


#login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 35vh;
  gap: 12px;
  background: #f7f9fc;
  font-family: "Segoe UI", "Meiryo", sans-serif;
}


#login-form h2 {
  font-size: 1.5em;
  margin-bottom: 20px;
  color: #333;
  text-align: center;
}

#login-form input[type="text"],
#login-form input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

#login-form button#login-btn {
  width: 60%;
  padding: 10px 0;
  font-size: 16px;
  font-weight: 600;
  background-color: var(--button-bg);
  color: #fff;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

#login-form button#login-btn:hover {
  background-color: var(--button-hover-bg);
}


#login-form label {
  display: inline-flex;
  align-items: center;
  gap: 8px;        /* ラベルと入力欄の間隔 */
  width: 100%;     /* フォーム内で綺麗に並ぶ */
}

#login-form input {
  flex: 1;         /* 入力欄が残りの幅を使う */
  box-sizing: border-box;
  height: 36px; 
}


/* ログイン画面用トーストメッセージ */
#login-toast {
  position: fixed;
  top: 50%;           /* 画面中央 */
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 240px;
  padding: 12px 24px;
  background-color: #dc3545; /* エラーは赤 */
  color: #fff;
  border-radius: 6px;
  text-align: center;
  z-index: 2000;
  display: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  font-size: 14px;
}

/* トースト表示アニメーション */
#login-toast.show {
  display: block;
  animation: fadein 0.3s, fadeout 0.3s 3s forwards;
}

@keyframes fadein {
  from { opacity: 0; transform: translate(-50%, -55%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

@keyframes fadeout {
  from { opacity: 1; transform: translate(-50%, -50%); }
  to { opacity: 0; transform: translate(-50%, -55%); }
}


/* 共通確認モーダル */
#confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 2000;
}

#confirm-modal .modal-content {
  background: #fff;
  border-radius: 10px;
  padding: 20px 30px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  animation: fadeIn 0.2s ease;
}

#confirm-modal p {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.6;
  color: #333;
}

#confirm-modal .modal-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
}

#confirm-modal button {
  min-width: 90px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

#confirm-ok-btn {
  background-color: #007bff;
  color: #fff;
}

#confirm-ok-btn:hover {
  background-color: #0069d9;
}

#confirm-cancel-btn {
  background-color: #ccc;
  color: #333;
}

#confirm-cancel-btn:hover {
  background-color: #b5b5b5;
}

#confirm-modal .modal-box {
  background: #fff;
  border-radius: 10px;
  padding: 20px 30px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

#confirm-modal.show {
  display: flex; /* 中央に表示する */
  align-items: center;
  justify-content: center;
}



/* =====================================================
   main トースト通知（中央表示・白背景・黒文字・フェードなし）
===================================================== */
#toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.toast-message {
  /* all: unset; ← 削除する */
  min-width: 240px;
  max-width: 80vw;
  background-color: #ffffff; /* ← 背景色 */
  color: #000000;             /* ← 文字色 */
  padding: 14px 28px;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
  text-align: center;
  font-size: 15px;
  font-weight: 500;

  opacity: 1;
  transform: none;
  transition: none;
}


/* 状態別（任意） */
.toast-message.success {
  border-color: #28a745;
}
.toast-message.error {
  border-color: #dc3545;
}
.toast-message.info {
  border-color: #007bff;
}



/* =====================================================
   ローディング
===================================================== */
.spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #3498db;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  margin: 0 auto 10px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}




/* =====================================================
    ▼ ソート（▲）＋ 折り畳み（◀）共通CSS
===================================================== */

/* ヘッダ全体のレイアウト：テキスト左、アイコン右 */
th.sortable,
th.collapsible {
  position: sticky;
  padding-right: 25px; /* アイコン分の余白を確保 */
  white-space: nowrap;
  top: 0; 
  background: #f3f3f3;
  z-index: 2;
}

/* アイコン置き場：右端に横並び */
.header-icons {
  position: absolute;
  top: 50%;
  right: 8px;   /* 右端に寄せる */
  transform: translateY(-50%);
  display: flex;
  gap: 6px;     /* アイコン同士に余白をつける */
  align-items: center;
}

/* アイコン */
.icon-sort,
.icon-collapse {
  cursor: pointer;
  font-size: 14px;
  user-select: none;
  line-height: 1;
}

.icon-sort:hover,
.icon-collapse:hover {
  opacity: 0.7;
}

/* =====================================================
    ▼ ソート ▲
===================================================== */
.sort-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #aaa;
    cursor: pointer;
    user-select: none;
    z-index: 5;
}

/* ソート中の強調 */
th.sorted .sort-indicator {
    color: #666;
}

/* ソートだけのとき（開閉ボタンなし） */
th.sortable:not(.collapsible) .sort-indicator {
    right: 5px;       /* 右端に寄せる */
}

/* 開閉ボタンあり（collapsibleがあるth） */
th.sortable.collapsible .sort-indicator {
    right: 25px;      /* 開閉ボタン分だけずらす */
}

th.sortable.collapsible {
    padding-right: 45px; /* アイコン2つ分のスペースを確保 */
}

/* =====================================================
    CSS最終修正: TDセルの縮小とコンテンツ非表示の強化
===================================================== */
.col-toggle-btn {
    position: absolute;
    right: 5px !important;    /* ← 完全に右端 */
    left: auto;
    padding: 0;
    margin: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    cursor: pointer;
    background: none;
    border: none;
    color: #999;
    z-index: 6;
}
/* ボタンのフォーカス＆アクティブ時の青枠・青背景を無効化 */
.col-toggle-btn:focus,
.col-toggle-btn:active,
.col-toggle-btn:hover {
    outline: none !important;
    box-shadow: none !important;
    background: none !important;
    color: #999 !important;
}

/* 1. TDの縮小を絶対的に強制する */
td[data-toggle-state="collapsed"] {
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    padding: 0 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

/* 2. THの縮小は collapsible クラスで有効化 */
th.collapsible[data-toggle-state="collapsed"] {
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    padding: 0 !important;
    overflow: hidden !important;
    font-size: 0 !important;
}

/* 3. collapsed時のトグルボタン（▶）のみを再表示 */
th.collapsible[data-toggle-state="collapsed"] .col-toggle-btn {
    position: static !important; 
    display: block !important; 
    margin: 0 auto;
    width: 100%;
    height: 100% !important; 
    line-height: 0px !important; 
    margin-top: 0px;
}


/* 案件管理の月次モーダル */
/* モーダル全体 */
#project-monthly-search-modal {
  display: flex;
  justify-content: center;
  align-items: flex-start;  /* 上寄せ */
  width: 1600px;           /* 固定幅 */
  max-width: 95vw;         /* ビューポート幅の95%までに制限 */
  height: 90vh;            /* 高さも画面に合わせる */
  padding: 20px;
  overflow: auto;          /* モーダル全体でスクロール */
  box-sizing: border-box;
  width: 90vw;        /* ビューポート幅の90%に広げる */
  max-width: 1600px;  /* 必要なら上限を設定 */
  height: 90vh;       /* 高さも画面に比例させる */

}


/* テーブル全体 */
#project-monthly-search-modal table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto; /* fixed をやめて auto にする */
}

#project-monthly-search-modal th,
#project-monthly-search-modal td {
  border: 1px solid #ccc;
  padding: 4px;
  text-align: center;
  vertical-align: middle;
}

#project-monthly-search-modal th.dept,
#project-monthly-search-modal td.dept { width: 10%; }
#project-monthly-search-modal th.emp,
#project-monthly-search-modal td.emp { width: 20%; }
#project-monthly-search-modal th.role,
#project-monthly-search-modal td.role { width: 15%; }
#project-monthly-search-modal th.month,
#project-monthly-search-modal td.month { width: 60px; } /* 月列は残り幅を自動 */

.cell-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.left {
  width: 30%;
  text-align: left;
  padding-right: 5px;
}

.right {
  width: 65%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  padding-left: 5px;
}

/* 行高さを揃える */
#project-monthly-search-modal tbody tr {
  height: 50px; 
}

.disabled-loading {
  opacity: 0.5;
  pointer-events: none;
}

#bulk-certainty-select {
  width: 50px;  /* 好きな幅に調整 */
  max-width: 150px;  /* 必要に応じて上限も設定 */
}

