/* ===== 画像検索専用の追記スタイル ===== */

/* 全体 */
body {
  padding-top: 65px;
}

.site-header {
  z-index: 100;
}

.site-header .hamburger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  flex-direction: column;
}

.site-header .global-nav {
  display: block;
  position: fixed;
  z-index: 1000;
  top: 65px;
  right: 0;
  width: 82vw;
  max-width: 320px;
  height: calc(100vh - 65px);
  line-height: 1.4;
  background: #fff;
  border-left: 1px solid #ddd;
  border-bottom: 0;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.08);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.site-header.is-open .global-nav {
  transform: translateX(0) !important;
}

.site-header .nav-list {
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px 0;
  margin: 0;
}

.site-header .nav-item {
  text-align: left;
}

.site-header .nav-item::before {
  display: none;
}

.site-header .nav-link {
  display: block;
  height: auto;
  padding: 14px 22px;
  line-height: 1.4;
}

.image-search-wrapper {
  width: 100%;
  max-width: none;
  margin: 0 0 80px;
  padding: 0;
  box-sizing: border-box;
}

.image-search-wrapper > .breadcrumb,
.image-search-wrapper > h1,
.image-search-wrapper > .frame {
  display: none;
}

.image-search-toggle {
  position: fixed;
  top: 78px;
  right: 14px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(20, 20, 20, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #222;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(10px);
}

.image-search-toggle__icon {
  position: relative;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-sizing: border-box;
}

.image-search-toggle__icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 6px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  transform: rotate(45deg);
  transform-origin: center;
}

.image-search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(0, 0, 0, 0.14);
}

/* 検索UI一式 */
.image-search-panel {
  position: fixed;
  top: 122px;
  right: 14px;
  z-index: 31;
  width: min(420px, calc(100vw - 28px));
  max-height: calc(100vh - 156px);
  margin: 0;
  padding: 12px 14px 10px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  backdrop-filter: blur(10px);
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.image-search-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.image-search-panel h3 {
  font-size: 0.78rem;
  margin: 0 34px 8px 0;
  font-weight: bold;
}

.image-search-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ddd;
  border-radius: 50%;
  background: #fff;
  color: #333;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.image-view-options {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 34px 8px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
  font-size: 0.78rem;
}

.image-view-options label {
  font-weight: 700;
  color: #333;
}

.image-view-options select {
  width: 82px;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  font-size: 0.8rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
  padding: 0;
  list-style: none;
}

.tab {
  min-width: 0;
  padding: 4px 9px;
  border: 1px solid #ccc;
  background: #fafafa;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.76rem;
  line-height: 1.4;
  white-space: nowrap;
}

.tab[aria-selected="true"] {
  background: #333;
  color: #fff;
  border-color: #333;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}

.filters label {
  font-size: 0.76rem;
  display: block;
}

.filters select,
.filters input[type="text"] {
  padding: 5px 8px;
  min-width: 160px;
  font-size: 0.8rem;
  border-radius: 4px;
  border: 1px solid #ddd;
  box-sizing: border-box;
}

.grand-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.grand-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f5f5f5;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
}

/* 条件チップ */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: #f5f5f5;
  border: 1px solid #ddd;
}

.chip__remove {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; /* ←広めに */
  height: 20px; /* ←広めに */
  border: none;
  background: transparent;
  font-size: 14px;
  margin-left: 6px;
}

/* 件数 + ページャ */
.image-count {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: #666;
}

.pager {
  display: none; /* 無限スクロールなので非表示 */
  gap: 6px;
  justify-content: center;
  margin: 16px 0 0;
  flex-wrap: wrap;
}

.pager a {
  padding: 5px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  text-decoration: none;
  color: #333;
  font-size: 0.8rem;
  background: #fff;
}

.pager a.cur {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
  pointer-events: none;
}

/* ===== ピンタレスト風 Masonry グリッド ===== */
#grid.actress-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 6px; /* Masonry 用の基準行高さ */
  gap: 4px;
  margin-top: 4px;
  padding-bottom: 40px;
  align-items: start;
}

.actress-box {
  padding: 0;
}

/* 画像カード */
.actress-box.image-card {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  background: none; /* movie.css の白背景を打ち消し */
  box-shadow: none;
  position: relative;

  /* ▼ 追加：ふわっと出てくるアニメーション用 ▼ */
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}

/* 追加：表示済みカード */
.actress-box.image-card.is-visible {
  opacity: 1;
  transform: none;
}

/* Masonry 用：JS から grid-row-end を触るので初期化だけしておく */
.actress-box.image-card {
  grid-row-end: span 1;
}

/* カード本体の上下余白をゼロに */
.image-card {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* 画像ラッパ */
.image-wrap {
  position: relative;
  display: block;
  border-radius: 0;
  overflow: hidden;
}

/* 画像そのもの：比率は元のまま */
.image-wrap img,
.actress-box.image-card .actress-left img {
  width: 100%;
  height: auto;
  display: block;
}

/* 左ブロック */
.actress-box.image-card .actress-left {
  margin: 0;
  padding: 0;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
}

/* 右側ブロック（本文側）の余白をなくす */
.actress-box.image-card .actress-right {
  margin: 0;
  padding: 0;
}

/* タイトル（アコーディオン内） */
.actress-right h3 {
  margin: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #222;
  padding-bottom: 6px;
  border-bottom: 2px solid #da3;
  padding-right: 0;
}

.actress-right h3 a {
  position: relative;
  background: none;
  color: inherit;
  text-decoration: none;
  font-weight: bold;
}

/* プロフィール部分 */
.profile-basic {
  margin: 6px;
  padding: 6px;
}

.actress-box.image-card .profile-basic {
  font-size: 0.75rem;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  background: #fff;
  border: 1px dashed #ccc;
  border-radius: 10px;
  margin-top: 20px;
  font-size: 0.9rem;
}

/* ＋ボタン */
.image-card-toggle {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #ccc;
  background: rgba(255, 255, 255, 0.95);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  opacity: 0.5;
}

.image-card-toggle:focus {
  outline: 2px solid #999;
  outline-offset: 2px;
}

/* アコーディオン本体（タイトル＋テーブル） */
.image-card-body {
  margin-top: 6px;
  display: none;
}

.image-card-body.is-open {
  display: block;
}

.image-card-body h3 {
  margin: 0 0 4px;
  font-size: 0.9rem;
}

/* 作品メタ情報テーブル */
.work-meta {
  width: calc(100% - 12px);
  border-collapse: collapse;
  margin-top: 4px;
  font-size: 0.75rem;
  margin: 6px auto;
}

.work-meta th,
.work-meta td {
  padding: 2px 4px;
  border: 1px solid #ddd;
}

.work-meta th {
  width: 5em;
  white-space: nowrap;
  text-align: left;
  color: #666;
  vertical-align: top;
}

.work-meta td {
  color: #222;
}

.work-meta td a {
  color: #0066cc;
  text-decoration: none;
}

/* 無限スクロール用の監視ターゲット */
#infiniteSentinel {
  width: 100%;
  height: 1px;
}

/* レスポンシブ */
@media (max-width: 768px) {
  .image-search-wrapper {
    width: 100%;
  }

  .image-search-panel {
    top: 122px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100vh - 132px);
    padding: 10px;
  }

  .image-search-toggle {
    top: 78px;
    right: 8px;
    height: 34px;
    padding: 0 11px;
    font-size: 12px;
  }

  #grid.actress-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  .filters select,
  .filters input[type="text"] {
    min-width: 145px;
  }
}

@media (min-width: 769px) and (max-width: 1040px) {
  #grid.actress-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1041px) and (max-width: 1280px) {
  #grid.actress-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1281px) and (max-width: 1520px) {
  #grid.actress-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 460px) {
  .tab {
    min-width: 0;
  }
}

/* =========================
   モーダルビュー（統合版）
========================= */

/* =========================
   モーダル（画像ビュー 画像のみ）
========================= */
#imageModal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.85);
  box-sizing: border-box;
}

#imageModal.is-open {
  display: flex;
}

/* 中身は画像だけなので header / meta は完全削除 */
#imageModal .modal-inner {
  background: transparent;
  border-radius: 0;
  width: auto;
  max-width: 95vw;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column; /* ←縦並びに変更 */
  align-items: center;
  justify-content: center;
}

/* 画像をとにかく大きく表示。元サイズより拡大も可能にする */
#imageModal .modal-body img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  background: #000;
}

/* ×ボタンのみ残す */
#imageModal .modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 28px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
}

#imageModal .modal-body {
  position: relative; /* ボタンの基準にする */
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 画像右上に重ねる × ボタン */
#imageModal .modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
}

.actress-profile-btn {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  font-size: 11px;
  border: 1px solid #888;
  border-radius: 3px;
  text-decoration: none;
  color: #333;
  background: #f7f7f7;
}

.actress-profile-btn:hover {
  background: #e0e0e0;
}

.actress-input-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 260px;
}

.actress-input-wrap input {
  padding-right: 28px; /* ×ボタン用の余白 */
  box-sizing: border-box;
}

.actress-clear-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: #ccc;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.6;
}

.actress-clear-btn:hover {
  opacity: 1;
}

#recentActressWrap .chip {
  cursor: pointer;
}

/* 検索履歴チップ用 */
.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-right: 4px;
}

.recent-chip__label {
  cursor: pointer;
}

.recent-chip__remove {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; /* ←広めに */
  height: 20px; /* ←広めに */
  border: none;
  background: transparent;
  font-size: 14px;
  margin-left: 6px;
}

.recent-chip__remove:hover {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 50%;
}
/* =========================
   ① 孫カテゴリ UX改善（toggle化）
   ========================= */
/* もともとのスタイル（必要ならそのまま流用） */
.grand-label {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  margin: 3px;
  user-select: none;
  font-size: 0.85rem;
  background: #f8f8f8;
  transition: 0.15s;
}

.grand-label:hover {
  background: #eee;
}

/* checkbox は見せない（クリックは label 全体） */
.grand-label input[type="checkbox"] {
  display: none;
}

/* ✅ チェックされている label の見た目 */
.grand-label:has(input[type="checkbox"]:checked) {
  background: #ff6666;
  color: #fff;
  border-color: #ff6666;
}

/* 孫カテゴリの並び */
.grand-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

/* ヘッダー（全選択／全解除）だけ */
.grand-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.grand-header__btn {
  min-width: 70px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  transition: background-color 0.15s;
}

.grand-header__btn--all {
  border-color: #ff6666;
  color: #ff6666;
}

/* 個別の孫カテゴリボタン（元のデザインに合わせて） */
.grand-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.grand-label input {
  margin-right: 4px;
}

/* =========================
   モーダル左右ナビ（PCのみ）
   ========================= */
.modal-nav {
  position: fixed;
  top: 50%; /* JS から上書きする前提 */
  transform: translateY(-50%);
  display: none; /* 初期状態は非表示 */
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  z-index: 10001;
  user-select: none;
}

/* ===== モーダル画像下の情報 ===== */
/* ===== モーダル画像下の情報（整列し直し） ===== */
#imageModal .modal-meta {
  margin-top: 0px;
  padding: 4px 12px;
  display: inline-flex; /* 画像下でコンパクトに並べる */
  align-items: center;
  justify-content: center;
  gap: 10px; /* 要素同士のすき間 */
  color: #fff;
  text-align: center;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px; /* ふんわりした帯にする */
}

#imageModal .modal-meta__actress {
  font-weight: 700;
  font-size: 14px;
}

#imageModal .modal-meta__age {
  font-size: 13px;
  opacity: 0.9;
}

#imageModal .modal-meta__detail {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid #fff;
  font-size: 13px;
  text-decoration: none;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
}

#imageModal .modal-meta__detail:hover {
  background: rgba(255, 255, 255, 0.15);
}

.image-loading-status {
  display: none;
  text-align: center;
  font-size: 0.85rem;
  color: #666;
  padding: 12px 0 24px;
}

/* スマホでは帯をフル幅にして読みやすく */
@media (max-width: 767px) {
  #imageModal .modal-meta {
    flex-wrap: wrap;
    max-width: 90vw;
  }
}

/* スマホでは非表示 */
@media (max-width: 767px) {
  .modal-nav {
    display: none !important;
  }
}

/* スマホ調整 */
@media (max-width: 600px) {
  #imageModal {
    padding: 8px;
  }
  #imageModal .modal-body img {
    max-width: 100vw;
    max-height: 100vh;
  }
}
