/* テーブルブロック拡張機能のスタイル（Figma 657-3495 準拠） */

.wp-block-table table {
  border-collapse: collapse;
  width: 100%;
  font-size: 16px;
  line-height: 1.75;
  border: 1px solid var(--border-color, #2b3c5c);
  margin-top: 2rem;
}

.wp-block-table thead th {
  padding: 20px;
  vertical-align: middle;
  font-weight: 700;
  line-height: 1.7;
  letter-spacing: 0.07em;
  color: var(--header-text-color, #fff);
  background-color: var(--header-bg-color, #003a76) !important;
}

.wp-block-table tbody th,
.wp-block-table tbody td,
.wp-block-table tfoot th,
.wp-block-table tfoot td {
  padding: 20px;
  border: 1px solid var(--border-color, #2b3c5c);
  vertical-align: middle;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: 0.07em;
  color: #252529;
  background-color: #fff;
}

.wp-block-table tbody th {
  font-weight: 400;
  color: var(--header-text-color, #fff) !important;
  background-color: var(--header-bg-color, #003a76) !important;
}

/* ヘッダー行が tbody 先頭にある場合 */
.wp-block-table table:not(:has(thead)) > tbody > tr:first-child > th {
  font-weight: 700;
  line-height: 1.7;
  color: var(--header-text-color, #fff) !important;
  background-color: var(--header-bg-color, #003a76) !important;
}

/* ストライプ行スタイル */
.wp-block-table table[data-striped] tbody tr:nth-child(odd) {
  background-color: var(--striped-row-color, #f8f9fa);
}

.wp-block-table table[data-striped="true"] tbody tr:nth-child(even) {
  background-color: #ffffff;
}

/* ヘッダー背景色・文字色（ブロックエディタ設定） */
.wp-block-table table[data-header-bg] thead th,
.wp-block-table table[data-header-bg] tbody > tr:first-child > th {
  background-color: var(--header-bg-color, #003a76) !important;
  color: var(--header-text-color, #fff) !important;
}

/* エディタ内での TH スタイル */
.editor-styles-wrapper .wp-block-table table[data-header-bg] thead th,
.editor-styles-wrapper .wp-block-table table[data-header-bg] tbody > tr:first-child > th {
  background-color: var(--header-bg-color, #003a76) !important;
  color: var(--header-text-color, #fff) !important;
}

/* 罫線色（ブロックエディタ設定） */
.wp-block-table table[data-border-color],
.wp-block-table table[data-border-color] th,
.wp-block-table table[data-border-color] td {
  border-color: var(--border-color, #2b3c5c);
}

/* 行単位罫線モード（明示設定時のみ data-th-border-color） */
.wp-block-table table[data-th-border-color="true"] tbody tr {
  border-bottom: 1px solid var(--tr-border-bottom-color, #2b3c5c);
}

/* スクロール可能テーブル */
.wp-block-table table[data-scrollable="true"] {
  min-width: 600px;
}

.table-scroll-wrapper {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--border-color, #2b3c5c);
  border-radius: 0;
}

/* エディター用 */
.editor-styles-wrapper .wp-block-table td,
.editor-styles-wrapper .wp-block-table th {
  cursor: pointer;
  user-select: none;
}

@media (max-width: 480px) {
  .wp-block-table thead th,
  .wp-block-table tbody th,
  .wp-block-table tbody td {
    padding: 16px;
    font-size: 14px;
  }
}

/* 結合セル */
.wp-block-table td[colspan],
.wp-block-table th[colspan],
.wp-block-table td[rowspan],
.wp-block-table th[rowspan] {
  background-color: inherit;
}

/* テーブルキャプション */
.wp-block-table figcaption {
  font-style: normal;
  color: var(--Text, #46393c);
  margin-top: 8px;
  font-size: 14px;
  text-align: left;
}

.block-editor-block-inspector .ai-table-custom .components-base-control,
.block-editor-block-inspector .ai-table-custom .components-base-control div {
  margin-bottom: 0 !important;
}
