/* =============================================================
   tt-search-modal.css  v1.1 (2026-08-27)
   PC (>=640px) の検索 UI を「ヘッダー内の検索ピル + モーダル」に統一する。
   - トップ / 検索結果ページ共通。ヘッダー行 = ロゴ / 検索ピル /
     (検索結果: 並べ替え・絞り込み) / お気に入り・閲覧履歴
   - .filter-area (ブランド/性別/カテゴリ/キーワードのフォーム) は
     常時フローから外し、ピル押下でモーダルとして表示 (SP と同じ機構)
   - 検索結果の絞り込みパネルは スライダー / セレクト / スイッチ で構成し、
     「適用」で確定する
   ★ 読み込み順: style.css → truetagg-ui.css → (home-v6.css) → 本ファイル。
     既存の sticky / 収納ロジック (contents.css v4/v5, home-v6.css ⑤) を
     打ち消すため、レイアウト系は !important を使う。
   ============================================================= */

/* ── ヘッダー: 常設固定・1行 ─────────────────────────────── */
@media (min-width: 640px) {
  body#top header,
  body#search header {
    display: flex !important;
    position: fixed !important;
    top: 0; left: 0; right: 0;
    height: 64px;
    padding: 0 24px 0 28px;
    background: #fff;
    border-bottom: 1px solid #eee;
    z-index: 1100;
    align-items: center;
    gap: 18px;
  }
  body#top { padding-top: 64px; }
  body#search { padding-top: 80px; }
  /* ロゴ | 検索ピル (ロゴ右端〜アイコン左端を埋める) | アイコン。
     ZOZO と同じ「行を埋める」配置。モーダルは JS がピルの左右端に合わせる。 */
  body#top header, body#search header { gap: 24px; }
  header .inner-header { flex: 0 0 auto; }
  header .tt-hdr-icons { margin-left: 0; flex: 0 0 auto; }
  header .tt-search-center { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; }
  header .tt-search-center #tt-sortfilter-wrap { flex: 0 0 auto; }

  /* ── 検索ピル ── */
  .tt-search-pill {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 6px 0 14px;
    border: 1px solid #d9dce1;
    border-radius: 999px;
    background: #f1f3f4;
    color: #111;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    overflow: hidden;
    transition: border-color .15s, background .15s;
  }
  .tt-search-pill:hover { border-color: #111; background: #fff; }
  .tt-search-pill__icon { flex: 0 0 auto; width: 16px; height: 16px; opacity: .7; }
  .tt-search-pill__ph { color: #8a8f98; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tt-search-pill__chips { display: flex; gap: 6px; min-width: 0; overflow: hidden; }
  .tt-search-pill__chip {
    flex: 0 0 auto;
    font-size: 11.5px;
    line-height: 1;
    padding: 6px 10px;
    border-radius: 999px;
    background: #111;
    color: #fff;
    white-space: nowrap;
  }
  .tt-search-pill__chip--kw { background: #fff; color: #111; border: 1px solid #d9dce1; }
  .tt-search-pill__chip--sale { background: #8B1A1A; }
  .tt-search-pill__go {
    flex: 0 0 auto;
    margin-left: auto;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #1a73e8;
    display: flex; align-items: center; justify-content: center;
  }
  .tt-search-pill__go svg { width: 14px; height: 14px; }

  /* 検索結果ページ: 並べ替え・絞り込みはピルの右隣 (common.js relocateSortWrap がヘッダーへ移動) */
  header #tt-sortfilter-wrap { position: relative; flex: 0 0 auto; width: auto !important; margin: 0 !important; }
  header .sort-filter-bar { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0; border: none; background: transparent; }
  header .sort-filter-bar .tt-share-mount { display: none; }

  /* 旧: 固定バー内に注入されるロゴ/アイコン (truetagg-ui.js) は使わない */
  .tt-fixedbar-logo, .tt-fixedbar-icons,
  body#search .filter-area .tt-fixedbar-logo, body#search .filter-area.is-fixed .tt-fixedbar-logo,
  body#search .filter-area .tt-fixedbar-icons, body#search .filter-area.is-fixed .tt-fixedbar-icons { display: none !important; }

  /* ── .filter-area = モーダルカード (SP と同じ is-modal-open で開閉) ── */
  html.is-modal-lock { overflow: hidden; }
  .filter-area,
  .filter-area.is-fixed,
  body#search .filter-area.is-fixed,
  body#top .filter-area,
  body#top .filter-area.is-fixed {
    position: fixed !important;
    top: 64px !important;   /* ヘッダー (64px) に密着 = ヘッダーから引き出されたパネルに見せる */
    /* カードはビューポート全幅の白い帯。フォーム (.search-bar) だけをピルの位置に揃える */
    left: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    width: auto !important;
    display: block !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 14px 0 18px !important;
    box-sizing: border-box !important;
    height: auto !important;          /* contents.css (#search 固定バー 60px) の高さ指定を解除 = 帯がフォームを包む */
    min-height: 0 !important;
    max-height: none !important;
    transform: translateY(-4px) scale(.995);
    transform-origin: top center;
    background: #fff !important;
    border: none !important;
    border-radius: 0;                        /* 全幅の帯なので角丸なし */
    box-shadow: 0 24px 64px rgba(0, 0, 0, .22);
    opacity: 0;
    pointer-events: none !important;
    transition: opacity .18s ease-out, transform .18s ease-out;
    z-index: 1300 !important;
    overflow: visible !important;
  }
  .filter-area.is-modal-open,
  body#search .filter-area.is-modal-open,
  body#top .filter-area.is-modal-open {
    opacity: 1;
    transform: none;
    pointer-events: auto !important;
  }
  /* フォーム本体はカードの内側にきっちり収める (contents.css の content-box + 固定幅を打ち消す) */
  .filter-area .search-bar,
  body#top .filter-area .search-bar, body#search .filter-area .search-bar,
  body#top .filter-area.is-fixed .search-bar, body#search .filter-area.is-fixed .search-bar {
    /* ピルの実測位置に合わせる (common.js が --tt-modal-left / --tt-modal-w を設定) */
    width: var(--tt-modal-w, calc(100vw - 48px)) !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 0 0 var(--tt-modal-left, 24px) !important;
    box-sizing: border-box !important;
    padding: 12px !important;
    pointer-events: auto;
    position: relative;
  }
  .filter-area .search-bar > * { min-width: 0; }

  /* ── ドロップダウンは各フィールドの真下に (contents.css の中央寄せ・950px 幅を打ち消す) ── */
  .filter-area .filter-block, body#top .filter-area .filter-block, body#search .filter-area .filter-block { position: relative !important; }
  .filter-area .dropdown, .filter-area .dropdown.is-open,
  body#top .filter-area .dropdown, body#top .filter-area .dropdown.is-open,
  body#search .filter-area .dropdown, body#search .filter-area .dropdown.is-open {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    left: 0 !important;
    right: auto !important;
    transform: none !important;
    margin: 0 !important;
    max-width: none !important;
    width: 380px !important;
    padding: 20px 22px !important;
    border-radius: 12px !important;
    box-shadow: 0 18px 48px rgba(15, 28, 58, .18) !important;
    z-index: 30 !important;
  }
  .filter-area #genderDropdown, body#top .filter-area #genderDropdown, body#search .filter-area #genderDropdown { width: 280px !important; padding: 8px 0 !important; }
  /* カテゴリは幅が広いので、フィールドの左端基準ではなく「フィールドの中央」を軸に
     左右へ広げて開く (右端が画面外に切れない)。画面が狭いときは JS が --tt-cat-shift で
     はみ出し分だけ左へ寄せる。 */
  .filter-area #categoryDropdown, body#top .filter-area #categoryDropdown, body#search .filter-area #categoryDropdown {
    width: 1040px !important;
    padding: 24px 32px 28px !important;
    left: 50% !important;
    transform: translateX(calc(-50% + var(--tt-cat-shift, 0px))) !important;
  }
  /* 右寄りのフィールド (カテゴリ) は幅が広いので、フィールド左端基準のまま最大幅を画面内に収める */
  .filter-area #categoryDropdown, body#top .filter-area #categoryDropdown, body#search .filter-area #categoryDropdown { max-width: calc(100vw - 48px) !important; }
  /* ドロップダウン内の余白 (窮屈さの解消) */
  .filter-area .check-row { padding: 11px 8px; }
  .filter-area .category-group { padding: 10px 0 !important; }
  .filter-area .category-header { padding: 10px 6px !important; }
  .filter-area .category-header__label { font-size: 14.5px !important; }
  .filter-area .category-layout { gap: 10px 48px !important; }
  .filter-area .category-sub, .filter-area .category-group .check-row { padding-left: 34px; }
  .filter-area .gender-list .check-row { padding: 12px 18px; }
  .filter-area .brand-list .check-row { padding: 11px 12px; }
  /* 選択肢は 1 行に (折り返し禁止) */
  .filter-area .check-row__label, .filter-area .category-header__label, .filter-area .category-header label,
  .filter-area .tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .filter-area .category-layout { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 12px 28px !important; padding: 0 !important; }
  .filter-area .tag-list { justify-content: flex-start !important; margin-bottom: 12px !important; }
  .filter-area .brand-list { max-height: 360px; overflow-y: auto; }
  /* オーバーレイ: contents.css の display:none (#search は !important) に勝つ */
  /* ★ z-index は truetagg-ui.css (.filter-area.is-modal-open 9995 / overlay 9994 !important) より
     詳細度の高いセレクタで両方を上書きし、「モーダル 1300 > オーバーレイ 1250 > ヘッダー 1100」を保証する。
     片方だけ上書きすると逆転してモーダルがグレーに沈む (260826 実地)。 */
  .filter-modal-overlay, body#top .filter-modal-overlay, body#search .filter-modal-overlay, #search .filter-modal-overlay,
  .filter-modal-overlay.is-visible, body#top .filter-modal-overlay.is-visible, body#search .filter-modal-overlay.is-visible, #search .filter-modal-overlay.is-visible {
    display: block !important;
    position: fixed; inset: 0;
    background: rgba(20, 19, 17, .45);
    transition: opacity .18s;
    z-index: 1250 !important;
  }
  .filter-modal-overlay, body#top .filter-modal-overlay, body#search .filter-modal-overlay {
    opacity: 0; pointer-events: none;
  }
  .filter-modal-overlay.is-visible, body#top .filter-modal-overlay.is-visible, body#search .filter-modal-overlay.is-visible, #search .filter-modal-overlay.is-visible {
    opacity: 1; pointer-events: auto;
  }
  /* モーダル上部: × のみ (ロゴタイトルは不要) */
  /* × はカード右上に浮かせ、フォームの上に空白行を作らない */
  .filter-area .filter-modal-header { display: block !important; position: absolute; top: 12px; right: 12px; margin: 0; z-index: 2; }
  .filter-area .filter-modal-title { display: none; }
  .filter-area .filter-modal-close { width: 28px; height: 28px; border: none; border-radius: 50%; background: #f1f3f4; font-size: 16px; line-height: 1; color: #555; cursor: pointer; }
  .filter-area .filter-modal-close:hover { background: #e3e6ea; color: #111; }
  /* × はフォームの右外 (帯の中) に置く */
  .filter-area .filter-modal-header { right: calc(100vw - var(--tt-modal-left, 24px) - var(--tt-modal-w, calc(100vw - 48px)) - 40px); top: 14px; }
  .filter-area .filter-modal-close:hover { color: #111; }
  /* 旧 sticky 用センチネル/スペーサーは無効 */
  .tt-sticky-sentinel, .tt-sticky-spacer { display: none !important; height: 0 !important; }

}
/* ── 640〜999px: モーダル内の入力を縦積み (4 つの入力が 1 行に収まらないため) ── */
@media (min-width: 640px) and (max-width: 999px) {
  .filter-area .search-bar { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; }
  .filter-area .search-bar .filter-block,
  .filter-area .search-bar .search-bar__field,
  .filter-area .search-bar .search-bar__field--keyword { width: 100% !important; max-width: none !important; }
  .filter-area .search-bar .search-bar__field--select { min-height: 44px; }
  .filter-area .search-bar .tt-sale-toggle { align-self: flex-start; }
  .filter-area .search-bar .search-bar__button { width: 100%; justify-content: center; }
  .filter-area .dropdown { position: static !important; width: 100% !important; box-shadow: none !important; }
}
/* 1000px 以上でもフィールドが潰れないよう最小幅を保証 */
@media (min-width: 1000px) {
  .filter-area .search-bar .filter-block { min-width: 170px; }
  .filter-area .search-bar .search-bar__label { white-space: nowrap; }
}

@media (max-width: 639px) {
  .tt-search-pill { display: none; }
  .tt-sale-toggle { margin: 8px 16px 0; }

  /* ── v1.1 (2026-08-27) SP: 「検索」ボタンが浮いてカテゴリを塞ぐ問題の修正 ──
     【原因】contents.css の .search-bar__button は position:fixed; bottom:10px。
     ところが親の .filter-area が transform:scale() を持つため、fixed の基準が
     ビューポートではなく .filter-area 自身 (= スクロールする箱) になる。
     結果、ボタンは箱の初期表示位置の下端に貼り付いたまま中身と一緒に
     スクロールし、途中のカテゴリ行の上に被さってタップを塞いでいた。
     【修正】position:sticky; bottom:0 に変更。スクロール中は常に画面下端に
     留まり、末尾 (Sale の下) まで来ると本来の位置に収まるので、どの行も
     隠れない。90px の逃げ余白も不要になる。 */
  .filter-area .search-bar .search-bar__button {
    position: -webkit-sticky !important;
    position: sticky !important;
    bottom: 0 !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    margin: 16px 0 0 !important;
    justify-content: center;
    z-index: 5;
    box-shadow: 0 -12px 16px -8px rgba(255, 255, 255, .95), 0 4px 12px rgba(0, 0, 0, .12);
  }
  .filter-area.is-modal-open {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ── モーダル内: 「Sale」チェックチップ (common.js が注入) ──
   チェックボックスであることが一目で分かる形: 角丸ピル + チェックマーク。
   ON でセールの赤 (#8B1A1A / 価格表示と同色) に反転する。 */
.tt-sale-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px 0 12px;
  border: 1.5px solid #d9dce1; border-radius: 999px; background: #fff;
  font-size: 13px; font-weight: 600; color: #333; letter-spacing: .02em;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.tt-sale-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.tt-sale-toggle__box {
  width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid #b9bec7; background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.tt-sale-toggle__box svg { width: 12px; height: 12px; opacity: 0; }
.tt-sale-toggle:hover { border-color: #8B1A1A; color: #8B1A1A; }
.tt-sale-toggle.is-on { background: #8B1A1A; border-color: #8B1A1A; color: #fff; }
.tt-sale-toggle.is-on .tt-sale-toggle__box { background: #fff; border-color: #fff; }
.tt-sale-toggle.is-on .tt-sale-toggle__box svg { opacity: 1; }
.tt-sale-toggle__label { line-height: 1; }

/* ── スイッチ (モーダルの Sale / 絞り込みパネル共通) ── */
.tt-switch { position: relative; width: 40px; height: 22px; flex: 0 0 auto; }
.tt-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.tt-switch__track { position: absolute; inset: 0; border-radius: 11px; background: #d9d4ca; transition: background .15s; }
.tt-switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.tt-switch input:checked + .tt-switch__track { background: #111; }
.tt-switch input:checked + .tt-switch__track::after { left: 20px; }

/* ── 絞り込みパネル (新) ───────────────────────────────── */
#client-filter-panel.client-filter-panel {
  padding: 14px 18px 12px;
  background: #fff;
  border: 1px solid #e5e1d9;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .10);
}
.cfp2-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0ede6;
}
.cfp2-row:last-of-type { border-bottom: none; }
.cfp2-label { font-size: 12.5px; color: #4a4742; }
.cfp2-range-label { font-size: 12px; color: #4a4742; margin-bottom: 4px; }
.cfp2-range-inputs { display: flex; flex-direction: column; gap: 4px; }
.cfp2-range-inputs input[type="range"] { width: 100%; }
.cfp2-select {
  width: 100%; height: 36px;
  border: 1px solid #d9d4ca; border-radius: 8px; background: #fff;
  font-size: 13px; color: #141311; padding: 0 12px;
}
.cfp2-switch { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: #141311; cursor: pointer; }
.cfp2-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.cfp2-reset { font-size: 12px; color: #8a857c; background: none; border: none; cursor: pointer; padding: 6px 0; }
.cfp2-reset:hover { color: #141311; }
.cfp2-apply { font-size: 13px; background: #141311; color: #fff; border: none; border-radius: 999px; padding: 9px 22px; cursor: pointer; }
.cfp2-apply:hover { background: #333; }
/* 絞り込み中は数字を出さず、ボタン自体を黒のリングで示す (アイコンボタン/テキストボタン共通) */
#client-filter-toggle.is-active { border-color: #111 !important; box-shadow: inset 0 0 0 1.5px #111; }
