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

/* 絞り込み機能のスタイル */
.filter-button-trigger {
  display: inline-flex;
  align-items: center;
  margin-bottom: 15px;
  padding: 8px 15px;
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: inherit;
  cursor: pointer;
  transition: background-color 0.2s;
}
.filter-button-trigger:hover {
  background: #45a049;
}
.filter-button-trigger .filter-icon {
  margin-right: 8px;
  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;
  /* ポップアップ内の文字サイズを2px小さく */
  font-size: calc(1em - 2px);
}

/* 「続きを見る」ボタン */
.show-more-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 15px 0;
  padding: 10px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  color: #333;
  cursor: pointer;
  transition: background-color 0.2s;
}
.show-more-button:hover {
  background: #e9e9e9;
}
.show-more-button span {
  position: relative;
  padding-right: 20px;
}
.show-more-button span::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid #666;
  border-bottom: 2px solid #666;
  transform: translateY(-75%) rotate(45deg);
}

/* 非表示行 */
.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;
  margin: 20px 0;
  padding: 15px;
  background-color: #fff6f6;
  border: 1px solid #ffcccc;
  border-radius: 4px;
  color: #cc0000;
  text-align: center;
}
.no-results-message.active {
  display: block;
}

/* レスポンシブ */
@media (max-width: 768px) {
  .table-filter-controls {
    flex-direction: column;
  }
  .filter-control {
    width: 100%;
  }
}

/* チェックボックスリスト */
.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;
}

/* 折りたたみアニメーション */
.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;
}