/**
 * Utility classes
 */

.table .table-col-shrink {
  width: 1px;
  white-space: nowrap;
}

/* テーブルを縦スクロール可能にする */
.table-responsive-sticky {
  position: relative;
  overflow: auto;
  max-height: var(--table-responsive-max-height, 25rem);
  margin-bottom: 1rem;
}

/* 「さらに表示」で展開したファイル欄: ヘッダ + ファイル行（約46px = 2.875rem）30行分 */
.table-responsive-sticky.is-expanded {
  --table-responsive-max-height: calc(2.5rem + 2.875rem * 30);
}

.table-responsive-sticky table {
  padding-bottom: 0;
  margin-bottom: 0;
}

/* ヘッダー行を固定する */
.table-responsive-sticky table thead th {
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: inset 0 -1px 0 #dee2e6;
}

/* フッター行はテーブルの下部に固定する */
.table-responsive-sticky table tfoot th,
.table-responsive-sticky table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  border-top: 2px solid #dee2e6;
  border-bottom: none;
}

/* 複製して登録ボタン列のヒントテキスト */
.copy-registration-hint {
  display: inline-block;
  text-align: left;
  font-weight: normal;
  max-width: 8em;
  white-space: normal;
  color: #6c757d;
}

/* number input のスピンボタン（上下矢印）を非表示にする */
input[type="number"].no-spinner::-webkit-inner-spin-button,
input[type="number"].no-spinner::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

input[type="number"].no-spinner {
  appearance: textfield;
}

/* 管理画面で確認を促す箇所を目立たせるハイライト（例: 支払額と金額合計欄の整合性確認）。
   table セル内では Bootstrap の table striping (box-shadow inset) が背景色を覆い隠すため、!important で明示的に上書きする */
.highlight-pink {
  background-color: #f472b6 !important;
  box-shadow: none !important;
  padding: 0 0.25rem;
  border-radius: 0.2rem;
}

/* 映像二次の実績報告で、申請時と異なる内容のセルを赤枠で示す（#733）。
   table セルは border-collapse で枠線が隣と共有されるため、inset の box-shadow で枠を描く。
   Bootstrap の table は box-shadow inset を背景色に使うので !important で上書きする */
.report-diff {
  box-shadow: inset 0 0 0 2px var(--bs-danger) !important;
}

/* 長くなりがちなテキスト列の折り返し制御（案件名・会社名・番組名など） */
.cell-wrap {
  min-width: 250px;
  max-width: 250px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

/* .cell-wrap の幅だけを変える修飾クラス（.cell-wrap と併用する）
   sm: 担当者など短い氏名の列。md: 列数が多い一覧の長い列。lg: 案件名など特に長い列 */
.cell-wrap.cell-wrap-sm {
  min-width: 7rem;
  max-width: 7rem;
}

.cell-wrap.cell-wrap-md {
  min-width: 300px;
  max-width: 300px;
}

.cell-wrap.cell-wrap-lg {
  min-width: 400px;
  max-width: 400px;
}

/* 既定幅から全角5文字分（5em）だけ狭める/広げる。隣り合う列で幅を融通し合うときに対で使う
   （例: 映像二次一覧の申請会社列を狭め、その分を番組名列に回す） */
.cell-wrap.cell-wrap-narrow {
  min-width: calc(250px - 5em);
  max-width: calc(250px - 5em);
}

.cell-wrap.cell-wrap-wide {
  min-width: calc(250px + 5em);
  max-width: calc(250px + 5em);
}

.width-xs {
  min-width: 1rem;
}

.width-sm {
  min-width: 4rem;
}

.width-md {
  min-width: 7rem;
}

.width-lg {
  min-width: 14rem;
}

.width-xl {
  min-width: 20rem;
}

/* 横スクロールしても右端に固定表示したい列（例: 選手明細テーブルの削除ボタン列）に使う */
.table-responsive-sticky .table-col-sticky-end {
  position: sticky;
  right: 0;
  background-color: #fff;
}

.table-responsive-sticky thead .table-col-sticky-end,
.table-responsive-sticky tfoot .table-col-sticky-end {
  z-index: 3;
}

.table-responsive-sticky tbody .table-col-sticky-end {
  z-index: 1;
  box-shadow: inset 1px 0 0 #dee2e6;
}
