/* =============================================================
   components/search.css
   ヘッダー検索ボックス + 検索結果ページ
   ============================================================= */

/* ─────────────────────────────────────────────────────────────
   ヘッダー検索ボックス
   ───────────────────────────────────────────────────────────── */

/* サジェストの絶対配置基点・検索トグル時は translateY で表示/非表示 */
.header-search {
  position: fixed;
  top: var(--header-h);                   /* site-header (60px) のすぐ下 */
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  transition: transform 0.25s ease-out;
  pointer-events: none;
  width: 100%;
  max-width: var(--screen-max);
  z-index: calc(var(--z-header) - 1);     /* 99: site-header (100) より手前 */
  background: #ffffff;
  height: 60px;
  border-top: 1px solid #D9D9D9;
  border-bottom: 1px solid #D9D9D9;
  display: flex;
  align-items: center;
  padding: 0 var(--content-pad);
}

#headerSearch[data-state="open"] {
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* 検索エリア外タップで閉じるオーバーレイ */
.header-search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-header) - 2);    /* 98: search bar (99) より下 */
}

.header-search-overlay.is-visible {
  display: block;
}

/* 検索アイコンボタン＋ハンバーガーのラッパー */
.site-header__actions {
  display: flex;
  align-items: center;
}

/* 検索アイコンボタン（ハンバーガーと同寸44×44px） */
.site-header__search-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.site-header__search-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--color-black);
  stroke-width: 2;
  stroke-linecap: round;
}

.header-search__form {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.header-search__input {
  flex: 1;
  height: 36px;
  padding: 0 14px;
  border: none;
  border-radius: 18px;
  background: #fff;
  font-size: 14px;
  font-family: var(--font-ui);
  color: var(--color-text);
  outline: none;
  -webkit-appearance: none;
}

.header-search__input::placeholder {
  color: #aaa;
}

.header-search__btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: #000000;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s;
  padding: 0;
}

.header-search__btn:disabled {
  background: #ccc;
  cursor: default;
}

.header-search__btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ─────────────────────────────────────────────────────────────
   検索結果ページ
   ───────────────────────────────────────────────────────────── */

/* 件数 + 並び替えのラッパー */
.search-result-meta {
  text-align: center;
  padding: 0 var(--content-pad);
}

.search-count {
  font-size: 13px;
  color: #888;
  text-align: center;
  padding: 6px 0 25px;
  margin: 0;
}

/* ─────────────────────────────────────────────────────────────
   並び替え UI
   ───────────────────────────────────────────────────────────── */

.search-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.search-sort__label {
  color: var(--color-text);
  white-space: nowrap;
}

.search-sort__select {
  padding: 6px 28px 6px 10px;
  border: 1px solid #D9D9D9;
  border-radius: 4px;
  background: #ffffff;
  font-size: 14px;
  color: var(--color-text);
  font-family: var(--font-ui);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%23000'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  cursor: pointer;
  min-width: 160px;
}

.search-sort__select:focus {
  outline: 2px solid #000000;
  outline-offset: 1px;
}

.search-count--bottom {
  padding: 16px var(--content-pad) 0;
  margin-bottom: 20px;
}

.search-card__actress {
  font-size: 11px;
  color: #888;
  line-height: 1.4;
  margin-bottom: 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ─────────────────────────────────────────────────────────────
   結果なしページ
   ───────────────────────────────────────────────────────────── */

.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px var(--content-pad) 40px;
  gap: 20px;
}

.search-empty__msg {
  font-size: 18px;
  font-weight: var(--fw-medium);
  text-align: center;
  line-height: 1.6;
  color: var(--color-text);
}

.search-empty__divider,
.search-result__divider {
  width: 100px;
  height: 1px;
  background: var(--color-border);
  margin: 0 auto;
}

.search-result__back {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

/* ─────────────────────────────────────────────────────────────
   ページネーション
   ───────────────────────────────────────────────────────────── */

.search-pagination {
  display: flex;
  justify-content: center;
  padding: 24px var(--content-pad) 8px;
  margin-top: 30px;
}

.search-pagination__list {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
  justify-content: center;
}

.search-pagination__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 14px;
  color: #000000;
  text-decoration: none;
  background: #ffffff;
  border: 1px solid #000000;
  transition: background 0.1s, color 0.1s;
}

.search-pagination__btn.is-current {
  background: #000000;
  color: #fff;
  border-color: #000000;
  pointer-events: none;
}

.search-pagination__ellipsis {
  font-size: 14px;
  color: #aaa;
  padding: 0 2px;
}

/* ─────────────────────────────────────────────────────────────
   「トップに戻る」ボタン
   ───────────────────────────────────────────────────────────── */

.search-result__back .btn-back,
.search-empty .btn-back {
  display: inline-block;
  background: #000;
  color: #fff;
  padding: 12px 32px;
  border-radius: 24px;
  text-decoration: none;
  font-size: 14px;
  font-family: var(--font-ui);
  font-weight: var(--fw-regular);
  line-height: 1;
}

/* ─────────────────────────────────────────────────────────────
   女優名サジェストドロップダウン
   ───────────────────────────────────────────────────────────── */

.header-search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: #ffffff;
  border: 1px solid #D9D9D9;
  border-top: none;
  list-style: none;
  margin: 0;
  padding: 0;
  /* visualViewport 非対応端末向けのフォールバック既定値。
     対応端末では script.js が可視域基準で max-height を上書きする
     （vh はソフトキーボード高を反映しないため、これ単体では下端候補が
     キーボード裏に隠れる。詳細は script.js のサジェスト節）。 */
  max-height: 50vh;
  overflow-y: auto;
  z-index: calc(var(--z-header) - 1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  -webkit-overflow-scrolling: touch;
}

.header-search-suggestion-item {
  padding: 10px var(--content-pad);
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}

.header-search-suggestion-item:last-child {
  border-bottom: none;
}

.header-search-suggestion-item:active {
  background: #f9f9f9;
}

.suggestion-ruby {
  font-size: 11px;
  color: #888888;
  line-height: 1.2;
  font-family: var(--font-ui);
}

.suggestion-name {
  font-size: 16px;
  color: #000000;
  line-height: 1.4;
  font-family: var(--font-ui);
}

/* 検索結果カードのサンプル動画ボタンを「詳細を見る」と同寸に揃える
   （.btn 基底の 250px幅/16px を打ち消す。.search-list 配下のみ＝他ページの .btn-sample 不変）
   ※ a / button どちらでも効くよう class ベース。button 既定の文字色/フォントも明示上書き */
.search-list .btn-sample {
  display: inline-block;
  width: auto;
  font-size: 14px;
  padding: 8px 24px;
  border-radius: 24px;
  line-height: 1;
  align-self: flex-start;
  font-family: var(--font-ui);
}

/* 動画モーダル（detail.css 135-173 の複製。search.php は detail.css を読まないため移植）
   is-locked は base.css 300 に既存・共通 */
.video-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9000;
  align-items: center;
  justify-content: center;
}
.video-modal.is-active {
  display: flex;
}
.video-modal-inner {
  width: 92vw;
  max-width: 720px;
}
.video-modal-frame {
  width: 100%;
  height: 275px;
  border: none;
  display: block;
  background: #000;
}
.video-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 32px;
  color: white;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
}
