/* static/css/common.css */
/* 共通スタイル: 全体のフォントや余白設定 */
body {
  font-family: sans-serif;
  padding: 10px;
}

/* 右上固定 - バージョン番号横の星印 */
.version-mark {
  color: #4169e1;  /* ロイヤルブルー（アクティブ） */
  font-weight: bold;
  margin-left: 5px;
}

/* 有効なバージョンの青い星印 */
.effective-mark {
  color: #4169e1;  /* ロイヤルブルー（有効） */
  font-weight: bold;
  margin-left: 5px;
}
.top-nav {
  position: fixed;
  top: 0;
  right: 0;
  background: #f0f0f0;
  padding: 8px 12px;
  border-bottom-left-radius: 4px;
  font-size: 0.9em;
  z-index: 1000;
}

/* テーブルの共通スタイル */
table {
  border-collapse: collapse;
  width: 100%;
}
th, td {
  border: 1px solid #ccc;
  padding: 4px 8px;
}
th {
  background-color: #f9f9f9;
}

/* ポップアップ通知用のコンテナとスタイル */
#popupContainer {
  position: fixed;
  bottom: 10px;
  left: 10px;
  z-index: 9999;
}
.popup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 300px; /* 横幅を十分長く設定 */
  max-width: 80vw;  /* 画面幅の80%まで */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 10px;
  padding: 10px;
  background-color: rgba(0, 0, 0, 0.7);
  color: #fff;
  border-radius: 5px;
  position: absolute;
  left: 0;
  transition: opacity 0.3s ease;
}
.popup.success { background-color: rgba(0, 128, 0, 0.7); }
.popup.error   { background-color: rgba(128, 0, 0, 0.7); }
.popup span { flex: 1; padding-right: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popup button { background: none; border: none; color: #fff; font-size: 16px; cursor: pointer; margin-left: 10px; flex-shrink: 0; }

/* --- ナビゲーション共通スタイル --- */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #333;
  padding: 0.5em 1em;
}
.top-nav a {
  color: #fff;
  text-decoration: none;
  padding: 0.5em;
}
.top-nav .logo { font-weight: bold; }

/* --- ドロップダウン --- */
.dropdown {
  position: relative;
}
.dropdown .dropbtn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font: inherit;
  padding: 0.5em;
}
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: #fff;
  border: 1px solid #ccc;
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 160px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 1000;
}
.dropdown-menu li a {
  display: block;
  padding: 0.5em 1em;
  color: #333;
}
.dropdown-menu li a:hover {
  background: #f2f2f2;
}
.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  display: block;
}

/* バージョン番号横の星印 */
.version-mark {
  color: #4169e1 !important;  /* ロイヤルブルー（アクティブ） */
  font-weight: bold;
  margin-left: 5px;
}

/* 有効なバージョンの青い星印 */
.effective-mark {
  color: #4169e1 !important;  /* ロイヤルブルー（有効） */
  font-weight: bold;
  margin-left: 5px;
}

/* アクティブなバージョンの行背景色（薄い灰色） */
.displayed-version {
  background-color: #f5f5f5 !important;
}

/* 有効なバージョンの行背景色（薄青色） */
.effective-version {
  background-color: #e7f3ff !important;
}

/* managed_indexでアクティブなバージョンの個別セル背景色（薄い灰色） */
.active-version-cell {
  background-color: #f5f5f5 !important;
}

/* managed_indexで有効なバージョンの個別セル背景色（薄青色） */
.effective-version-cell {
  background-color: #e7f3ff !important;
}

/* 履歴テーブル関連のスタイル */
.history-table { 
  border-collapse: collapse; 
  width: 100%; 
  margin-bottom: 1em; 
}

.history-table th, .history-table td { 
  border: 1px solid #ccc; 
  padding: 4px 8px; 
  vertical-align: top; 
}

.history-table th { 
  background-color: #f9f9f9; 
  text-align: left; 
}

.radio-cell { 
  white-space: nowrap; 
}

/* 日付選択エリア */
.date-selector {
  margin-bottom: 20px;
  padding: 10px;
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* 初期状態の行 */
.initial-state-row {
  background-color: #f8f9fa;
  font-style: italic;
}

/* ========================================
   無効化フィールドでもエラー・編集状態を表示
   ======================================== */

/* 無効化されていてもエラー状態を表示（エラーが優先） */
input:disabled.cell-error,
select:disabled.cell-error,
textarea:disabled.cell-error,
input:disabled.has-error,
select:disabled.has-error,
textarea:disabled.has-error,
div:disabled.cell-error,
div:disabled.has-error {
  background-color: #ffcccc !important;
  border-color: #f66 !important;
}

/* 無効化されていても編集+エラー状態を表示 */
input:disabled.cell-edited-error,
select:disabled.cell-edited-error,
textarea:disabled.cell-edited-error {
  background: linear-gradient(135deg, #fffacd 50%, #ffcccc 50%) !important;
  border-color: #f66 !important;
}

/* 無効化されていても編集状態を表示 */
input:disabled.cell-edited,
select:disabled.cell-edited,
textarea:disabled.cell-edited {
  background-color: #fffacd !important;
}