/* =========================================
  ▼ フォントサイズは編集画面の設定を継承
  ========================================= */

/* ボタンコンテナ */
.table-action-buttons {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

/* 横スクロール時にボタンが動かないようにする */
.table-action-buttons {
  /* スクロールコンテナの外側に配置されるため、特別な処理は不要 */
  background: transparent;
}

/* 絞り込み機能のスタイル */
.filter-button-trigger {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  /* 初期色をグレーに変更（メインカラーがJSで適用されるまで） */
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 3px;
  font-size: 0.85em;
  cursor: pointer;
  transition: background-color 0.2s;
}

/* 並び替えボタン（絞り込みボタンと同じスタイル） */
.sort-button-trigger {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  /* 初期色をグレーに変更（メインカラーがJSで適用されるまで） */
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 3px;
  font-size: 0.85em;
  cursor: pointer;
  transition: background-color 0.2s;
}

.filter-button-trigger:hover,
.sort-button-trigger:hover {
  /* ホバー時は少し暗くする（JSで動的に設定される） */
  filter: brightness(0.9);
}

.sort-button-trigger .sort-icon {
  display: inline-block;
  margin-right: 5px;
  width: 12px;
  height: 12px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="%23fff" d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160zm256-160l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L365.3 256 502.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: middle;
}

.filter-button-trigger .filter-icon {
  margin-right: 5px;
  width: 12px;
  height: 12px;
  display: inline-block;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="%23fff" d="M487.976 0H24.028C2.71 0-8.047 25.866 7.058 40.971L192 225.941V432c0 7.831 3.821 15.17 10.237 19.662l80 55.98C298.02 518.69 320 507.493 320 487.98V225.941l184.947-184.97C520.021 25.896 509.338 0 487.976 0z"/></svg>');
}

/* ポップアップオーバーレイ */
.filter-popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.filter-popup-overlay.active {
  display: flex;
}

.table-filter-container {
  position: relative;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  margin: 0 auto;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  z-index: 1001;
  /* SWELLの設定を継承するためfont-sizeは指定しない */
}

/* テーブルラッパー（続きを見る用） */
.table-show-more-wrapper {
  position: relative;
  width: 100%;
}

/* グラデーションオーバーレイ */
.table-gradient-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to bottom, 
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.7) 30%,
    rgba(255, 255, 255, 0.9) 60%,
    rgba(255, 255, 255, 0.95) 80%,
    rgba(255, 255, 255, 1) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

/* オーバーレイ上の続きを見るボタン */
.show-more-button-overlay {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  background: var(--wp--preset--color--primary, var(--theme-color-primary, var(--primary-color, #007cba)));
  color: white;
  border: none;
  border-radius: 30px;
  font-weight: 600;
  /* SWELLの設定を継承するためfont-sizeは指定しない */
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
}

.show-more-button-overlay:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  filter: brightness(1.1);
}

.show-more-button-overlay:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.show-more-button-overlay span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* 矢印アイコン */
.show-more-button-overlay .arrow-icon {
  display: inline-block;
  position: relative;
  width: 16px;
  height: 16px;
}

.show-more-button-overlay .arrow-icon::before,
.show-more-button-overlay .arrow-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateX(-50%) rotate(45deg);
  transition: transform 0.3s ease;
}

.show-more-button-overlay .arrow-icon::before {
  top: 0;
}

.show-more-button-overlay .arrow-icon::after {
  top: 5px;
  opacity: 0.6;
}

.show-more-button-overlay:hover .arrow-icon::before,
.show-more-button-overlay:hover .arrow-icon::after {
  transform: translateX(-50%) rotate(45deg) translateY(2px);
}

/* フェード行（11個目） */
.fade-row {
  opacity: 0.3;
  filter: blur(0.5px);
  pointer-events: none;
}

/* 非表示行 */
.hidden-row {
  display: none;
}

/* Hide rows that do not match the filter conditions */
.filtered-row {
  display: none;
}

/* ポップアップ閉じるボタン */
.filter-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  font-size: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}
.filter-popup-close:hover {
  color: #333;
}

.table-filter-title {
  font-weight: bold;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-filter-title .filter-toggle {
  cursor: pointer;
  color: #666;
  padding: 3px 8px;
  border-radius: 3px;
  background: #eee;
  transition: all 0.2s;
}
.table-filter-title .filter-toggle:hover {
  background: #ddd;
}

.table-filter-controls {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.filter-control {
  width: 100%;
  max-width: 400px;
  margin-bottom: 15px;
}

/* フィルターラベル */
.filter-control label {
  display: block;
  margin-bottom: 3px;
  color: #333;
  font-weight: bold;
}

.filter-control input,
.filter-control select {
  width: 100%;
  max-width: 300px;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* スライダー関連 */
.filter-control .range-slider-container {
  position: relative;
  width: 100%;
  max-width: 300px;
}
.value-box-container {
  position: relative;
  height: 24px;
  margin-bottom: 5px;
  width: 100%;
}
.value-box {
  position: absolute;
  top: 0;
  background: #333;
  color: white;
  padding: 0 6px;
  border-radius: 3px;
  white-space: nowrap;
  transform: translateX(-50%);
  height: 20px;
  line-height: 20px;
  text-align: center;
  z-index: 10;
  display: none; /* 初期は非表示、スライダー更新時に表示 */
}

.noUi-target {
  height: 8px;
  border: none;
  border-radius: 4px;
  background: #ddd;
  margin: 5px 0;
  width: 100%;
  padding: 0 8px 0 10px;
  box-sizing: border-box;
}
.noUi-connect {
  background: var(--wp--preset--color--primary, var(--theme-color-primary, var(--primary-color, #007cba)));
}
.noUi-horizontal .noUi-handle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--wp--preset--color--primary, var(--theme-color-primary, var(--primary-color, #007cba)));
  border: none;
  cursor: pointer;
  right: -9px;
  top: -5px;
}
.noUi-handle::before,
.noUi-handle::after {
  display: none;
}
.noUi-handle:hover {
  filter: brightness(0.9);
}
.noUi-tooltip {
  padding: 2px 5px;
  border-radius: 3px;
  background: #333;
  color: white;
  border: none;
  top: -30px;
}

/* 絞り込み＆リセットボタン */
.filter-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.filter-button {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.apply-filter {
  background: var(--wp--preset--color--primary, var(--theme-color-primary, var(--primary-color, #007cba)));
  color: white;
}
.apply-filter:hover {
  filter: brightness(0.9);
}
.reset-filter {
  background: #f0f0f0;
  color: #333;
}
.reset-filter:hover {
  background: #e0e0e0;
}

/* フィルタリング結果のカウンター */
.filter-result-count {
  margin-top: 10px;
  color: #666;
}

/* 検索結果がない場合のメッセージ */
.no-results-message {
  display: none !important; /* 初期状態では必ず非表示 */
  margin: 20px 0;
  padding: 15px;
  background-color: #fff6f6;
  border: 1px solid #ffcccc;
  border-radius: 4px;
  color: #cc0000;
  text-align: center;
}
.no-results-message.show {
  display: block !important; /* showクラスが付いた時のみ表示 */
}

/* タグボタンコンテナ */
.tag-buttons-container {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0;
}

/* 横スクロール時にタグボタンが動かないようにする */
.tag-buttons-container {
  /* スクロールコンテナの外側に配置されるため、特別な処理は不要 */
  background: transparent;
}

/* タグボタン */
.tag-button {
  padding: 3px 10px;
  background-color: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 12px;
  font-size: 0.8em;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tag-button:hover {
  background-color: #e0e0e0;
  border-color: #ccc;
}

/* アクティブなタグボタン */
.tag-button.active {
  /* 初期状態はグレー（JSで薄い色が適用される） */
  background-color: #9ca3af;
  color: white;
  border-color: #9ca3af;
}

/* タグフィルターで非表示になった行 */
.tag-filtered {
  display: none !important;
}

/* 列選択で非表示になった列 */
.column-hidden {
  display: none !important;
}

/* レスポンシブ */
@media (max-width: 768px) {
  .table-filter-controls {
    flex-direction: column;
  }
  .filter-control {
    width: 100%;
  }
  
  /* タグボタンのレスポンシブ */
  .tag-buttons-container {
    margin: 6px 0;
  }
  
  .tag-button {
    padding: 2px 8px;
    font-size: 0.75em;
  }
  
  /* 続きを見るボタンのレスポンシブ */
  .show-more-button-overlay {
    padding: 10px 24px;
    /* SWELLの設定を継承するためfont-sizeは指定しない */
  }
  
  /* グラデーションオーバーレイの高さ調整 */
  .table-gradient-overlay {
    height: 100px;
  }
}

/* チェックボックスリスト */
.filter-checkbox-list {
  max-height: 200px;
  overflow-y: auto;
  padding-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.checkbox-wrapper {
  position: relative;
}
.filter-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.checkbox-wrapper label {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 20px;
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-weight: normal;
}
.filter-checkbox:checked + label {
  background-color: var(--wp--preset--color--primary, var(--theme-color-primary, var(--primary-color, #007cba)));
  color: white;
  border-color: var(--wp--preset--color--primary, var(--theme-color-primary, var(--primary-color, #007cba)));
}
.filter-checkbox:hover + label {
  background-color: #e0e0e0;
}
.filter-checkbox:checked:hover + label {
  filter: brightness(0.9);
}

/* フィルターカテゴリ */
.filter-category {
  margin-bottom: 20px;
}
.filter-category-title {
  font-weight: bold;
  margin-bottom: 5px;
  color: #333;
}

/* =========================================
  ▼ 並び替えボタンのスタイル
  ========================================= */
.u-choice-sort-button {
  display: inline-block;
  margin-left: 5px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s;
}

.u-choice-sort-button .sort-icon {
  display: inline-block;
  font-size: 1.1em;
  color: #999;
  transition: color 0.2s;
}

.u-choice-sort-button:hover .sort-icon {
  color: #666;
}

.u-choice-sort-button.sort-active .sort-icon {
  color: var(--wp--preset--color--primary, var(--theme-color-primary, var(--primary-color, #007cba)));
  font-weight: bold;
}

/* ヘッダーセルのホバー効果 */
thead th:has(.u-choice-sort-button) {
  position: relative;
}

thead th:has(.u-choice-sort-button):hover {
  background-color: rgba(0, 0, 0, 0.02);
}

/* 並び替え中のアニメーション */
tbody.sorting {
  opacity: 0.7;
  transition: opacity 0.2s;
}

/* 折りたたみアニメーション */
.table-filter-content {
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.table-filter-content.collapsed {
  max-height: 0;
}
.filter-icon {
  display: inline-block;
  margin-right: 5px;
  width: 16px;
  height: 16px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="%23666" d="M487.976 0H24.028C2.71 0-8.047 25.866 7.058 40.971L192 225.941V432c0 7.831 3.821 15.17 10.237 19.662l80 55.98C298.02 518.69 320 507.493 320 487.98V225.941l184.947-184.97C520.021 25.896 509.338 0 487.976 0z"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: middle;
}