/* 修正済み style.css - 最終更新: 2025-07-20 改修: 先頭行＋左2列完全固定対応 */

:root {
  --sidebar-width: 250px;
  --sidebar-bg: rgba(245, 245, 245, 0.8);
  --menu-top: 10px;
  --menu-left: 10px;
  --menu-font-size: 24px;
  --clock-font-size: 18px;
  --main-padding: 1px;
  --col1width: 80px;
  --col2width: 80px;
}

/* [001] tr */
tr.odd {
  background-color: #eef6ff;
  padding: 1px;
}
tr.even {
  background-color: #ffffff;
  padding: 1px;
}

/* [003] アコーディオン開閉用 */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--sidebar-bg);
  transition: transform 0.3s ease;
  transform: translateX(-100%);
  z-index: 998;
}

/* [004] sidebar */
#sidebar.open {
  transform: translateX(0);
}

/* [005] ≡ボタンの位置と表示 */
#menu-button {
  position: fixed;
  top: var(--menu-top);
  left: var(--menu-left);
  z-index: 999;
  font-size: var(--menu-font-size);
}

/* [006] 時計表示：アコーディオンに被らないよう左余白を追加 */
#clock {
  font-size: 14px;
  height: 18px;
  line-height: 18px;
  padding-left: 8px;
  margin-bottom: 4px;
  color: black;
}

/* [007] メインコンテンツ領域 */
#main {
  margin-left: var(--sidebar-width);
  padding: var(--main-padding);
}

/* [008] 上部固定エリア */
#fixed-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  background-color: white;
  z-index: 10;
  padding: 10px;
  border-bottom: 1px solid #ccc;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

/* [009] テーブルスクロール用ラッパー（未使用なら削除可） */
#scroll-container {
  margin-left: var(--sidebar-width);
  margin-top: 100px;
  height: calc(100vh - 140px);
  overflow-y: auto;
  padding: 0 20px;
}

/* [010] テーブル背景の交互表示（非 `.fixed-header-table`） */
tr.odd {
  background-color: #eef6ff;
}
tr.even {
  background-color: #ffffff;
}

/* [011] 最初に戻るボタン */
#back-to-top {
  margin-top: 6px;
  padding: 4px 12px;
  font-size: 14px;
}

/* [012] テーブル全体ラッパー */
.scroll-table-wrapper {
  position: relative;
  height: 600px;
  width: 80%;
  overflow: auto;
  border: 1px solid #ccc;
  margin-top: 30px;
}

/* [013] ヘッダー固定テーブル */
.fixed-header-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

/* [014] テーブルヘッダー */
.fixed-header-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background-color: #f0f0f0;
}

/* [015] セルの共通スタイル（padding修正） */
.fixed-header-table td {
  padding: 2px !important;
  height: 40px;
  box-sizing: border-box;
  border-bottom: 1px solid #ddd;
  word-break: break-word;
  white-space: nowrap;
  background-color: white;
  z-index: 1;
}

/* [016] 背景交互色：fixed-header-table（td単位に変更） */
.fixed-header-table tr.odd td {
  background-color: #eef6ff;
}
.fixed-header-table tr.even td {
  background-color: #ffffff;
}

/* [017] 1列目を左固定 */
.fixed-header-table td:nth-child(1),
.fixed-header-table th:nth-child(1) {
  position: sticky;
  left: 0;
  width: var(--col1width) !important;
  z-index: 2;
  background-color: #f9f9f9;
}

/* [018] 2列目を左固定 */
.fixed-header-table td:nth-child(2),
.fixed-header-table th:nth-child(2) {
  position: sticky;
  left: var(--col1width);
  width: var(--col2width) !important;
  z-index: 2;
  background-color: #f9f9f9;
}

/* [018+] 交差セルの最前面化 */
.fixed-header-table th:nth-child(1) {
  z-index: 5;
}
.fixed-header-table th:nth-child(2) {
  z-index: 4;
}

/* [019] テーブルスクロール制御ボタンエリア */
.table-scroll-buttons {
  display: flex;
  gap: 12px;
  margin: 10px 0;
}

/* [020] 各ボタンスタイル */
.table-scroll-buttons button {
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}

/* [021] 時計を表示するヘッダー領域 */
header {
  background-color: white;
  padding-left: 10px;
  height: 32px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ccc;
  z-index: 5;
  position: relative;
}

/* [022] ページタイトル */
#page-title {
  color: blue;
  font-size: 25px;
}

/* メイン領域に相対指定 */
#main {
  position: relative;  /* ←これで上のabsoluteが有効に */
  margin-left: var(--sidebar-width);
  padding: var(--main-padding);
}

/* closespace切り替え表示用（修正済み） */
#closespace {
  position: absolute;  /* ←テーブルにかぶせる */
  top: 60px;            /* ←ヘッダーやメニュー分を調整（要微調整） */
  left: 60px;; /* サイドバー考慮 */
  right: 20px;
  height: 40px;
  overflow: hidden;
  background-color: rgba(173, 216, 230, 0.6);
  border-radius: 10px;
  transition: all 0.3s ease;
  padding: 4px 10px; 
  box-sizing: border-box;
  z-index: 10;
}

#status-message {
  display: block;
  color: black;
  font-size: 14px;
}

button.disabled-copy {
  opacity: 0.5;
  cursor: not-allowed;
}

#insideButton {
  margin-top: 6px;
}

.tdcenter {
  text-align: center;
  vertical-align: middle;
}

.width300 {
  width: 300px;
}
input.numeric-only {
  width: 30px;
  text-align: right;
  transition: width 0.2s ease;
}

/* [024] フォーカス中の行背景（強制上書き） */
.fixed-header-table tr.row-focus td {
  background-color: lightblue !important;
}

/* [025] inputフォーカス時 背景色（input単体） */
input:focus {
  background-color: #ffffcc;
}

/* コピー・消去ボタンを中央寄せ */
.fixed-header-table td.sticky-col,
.fixed-header-table td.sticky-col2 {
  text-align: center;        /* 横方向中央 */
  vertical-align: middle;    /* 縦方向中央 */
  padding: 4px;
}

/* ボタン自体も必要ならサイズ統一 */
.fixed-header-table button {
  display: inline-block;
  padding: 4px 8px;
  font-size: 14px;
  vertical-align: middle;
}

.common-button {
  display: inline-block;
  padding: 4px 8px;
  font-size: 10px;
  vertical-align: middle;
  background-color: #ccffcc; /* 元のうす黄緑 */
  border: 1px solid #aaa;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s ease-in-out;
}

/* ▼, コピー, 消去ボタン共通スタイル */
.common-button:focus,
.common-button:hover {
  transform: scale(1.05); /* フォーカス時の膨張 */
}

/* バルーン対応 */
.common-button[data-tooltip] {
  position: relative;
  z-index: 20;  /* 明示的に低すぎないz-index */
}

.common-button[data-tooltip]::after {
  display: none !important;
}

.common-button[data-tooltip]:focus::after,
.common-button[data-tooltip]:hover::after {
  display: block;
}

.floating-button {
  display: inline-block;
  padding: 4px 8px;
  font-size: 20px;
  vertical-align: middle;
  background-color: #ccffcc; /* 元のうす黄緑 */
  border: 1px solid #aaa;
  border-radius: 4px;
  cursor: pointer;
  width: 100px;
  transition: transform 0.1s ease-in-out;
}

.floating-button:focus,
.floating-button:hover {
  transform: scale(1.05); /* フォーカス時の膨張 */
}

.floating-button[data-tooltip]::after {
  display: none !important;
}

.floating-button[data-tooltip]:focus::after,
.floating-button[data-tooltip]:hover::after {
  display: block;
}

.switch {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 16px;
  margin-left: 8px;
  vertical-align: middle;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  background-color: #ccc;
  border-radius: 16px;
  top: 0; left: 0; right: 0; bottom: 0;
  transition: 0.4s;
}
.slider::before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.4s;
}
/* ツールチップの見た目 */
.tooltip {
  display: none;
  position: absolute;
  top: -45px;
  left: 0;
  background-color: rgba(60, 60, 60, 0.95);
  color: #fff;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  z-index: 100;
  white-space: nowrap;
  box-shadow: 0 0 5px rgba(0,0,0,0.3);
  line-height: 1.4;
}
input:checked + .slider {
  background-color: #66bb6a;
}
input:checked + .slider::before {
  transform: translateX(14px);
}
#global-tooltip {
  display: none;
  position: absolute; /* ← fixed から absolute に修正 */
  z-index: 9999;       /* ← 十分な前面だが、99999 ではない */
  background-color: black; /* ← 黒に戻す */
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.2);
}

#global-tooltip::after {
  content: "";
  position: absolute;
  top: -6px;
  left: 12px;
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent black transparent;
}

#global-tooltip.error {
  background-color: #ff4444; /* 赤背景 */
  color: white;
  border: 1px solid darkred;
  font-weight: bold;
  z-index: 9999;
}
/* control-rowで絶対改行しない */
.control-row {
  display: inline-block;
  vertical-align: middle;
}


/* フローティングウィンドウ */
#floating-window {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 9999 !important;
  display: flex;
  width: 90%;
  height: 70%;
  background-color: transparent;
  border: 2px solid #333;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  flex-direction: column;
}

#floating-message {
   font-size: 30pt;
}

.floating-hidden {
  display: none !important;
}

/* --- ヘッダー --- */
.floating-header {
  height: 5%;
  background-color: rgba(180, 180, 180, 1);
  padding: 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.floating-title {
  font-weight: bold;
}

.floating-close-button {
  border: none;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
}

/* --- 本文（レベル別背景色） --- */
.floating-body {
  height: 85%;
  font-size: 12pt;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 15px;
}

/* 上書き防止のために、クラス付きに限定して色を変える */
#floating-window.floating-info {
  background-color: rgba(135, 195, 251, 0.8);
}
#floating-window.floating-warning {
  background-color: rgba(255, 230, 0, 0.871);
}
#floating-window.floating-danger {
  background-color: rgba(255, 128, 128, 0.8);
}
#floating-window.floating-confirm {
  background-color: rgba(147, 202, 20, 0.8);
}

/* --- フッター --- */
.floating-footer {
  height: 10%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
}

#floating-confirm-buttons {
  display: flex;
  gap: 20px;
}

/* --- (任意) 工程Ⅲタブの微調整 --- */
/* 工程Ⅲタブの微調整（任意） */
.pill { border-radius: 999px; }
.btn { cursor: pointer; }
.section { border: 1px solid #e6f4ff; border-radius: 12px; background: #fff; padding: 12px; box-shadow: 0 4px 16px rgba(2,132,199,.08); margin: 8px 0; }
.alert { padding: .7rem 1rem; border-left: 4px solid #94d9ff; background: #f2fbff; border-radius: 6px; }
.alert.ok { border-left-color: #2e7d32; background: #f3fff4; }
