/*
============================================================
ファイル名      : style.css
役割           : SG25-PAP / CLASSIFY_WEB（分類作業UI）
バージョン     : v0.2.3
作成日         : 2025-12-13
更新日         : 2025-12-17
保存先         : /Users/yoichiamano/Projects/Album_Viewer/SG25_AlbumUnit/PDIS_SORT/CLASSIFY_WEB/
注意事項:
  - 右カラムは縦積み（重なり事故を防ぐ）。
  - サムネイルは 9列固定、1ページ 27枚（3行）でページング。
============================================================
*/

:root{
  --bg0:#0a1020;
  --bg1:#071023;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.08);
  --line: rgba(255,255,255,0.10);
  --text:#e5e7eb;
  --muted:#9ca3af;
  --accent:#38bdf8;
  --accent2:#60a5fa;
  --danger:#fb7185;

  --sideW: 320px;
  --sideWMin: 240px;
  --sideWMax: 560px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Segoe UI", sans-serif;
  color:var(--text);
  background: radial-gradient(1200px 800px at 20% 0%, rgba(56,189,248,0.10), transparent 60%),
              radial-gradient(900px 700px at 75% 40%, rgba(96,165,250,0.10), transparent 60%),
              linear-gradient(180deg, var(--bg0), var(--bg1));
}

.app{ height:100%; display:flex; flex-direction:column; min-height:0; }

.topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding:14px 18px;
  border-bottom:1px solid var(--line);
  background: rgba(0,0,0,0.12);
  backdrop-filter: blur(8px);
}
.brand{ font-weight:800; letter-spacing:0.2px; }
.brand-sub{ color:var(--muted); font-weight:700; }
.desc{ margin-top:6px; color:var(--muted); font-size:12px; max-width: 72ch; }
.topbar-right{ display:flex; align-items:center; gap:10px; padding-top:2px; flex-wrap:wrap; justify-content:flex-end; }
.pill{
  font-size:12px;
  padding:7px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color:var(--muted);
  white-space: nowrap;
}

.btn{
  appearance:none;
  border:1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color:var(--text);
  border-radius:12px;
  padding:9px 12px;
  font-size:12px;
  cursor:pointer;
}
.btn:hover{ background: rgba(255,255,255,0.08); }
.btn:disabled{ opacity:0.45; cursor:not-allowed; }
.btn.primary{
  border-color: rgba(56,189,248,0.35);
  background: rgba(56,189,248,0.14);
  color:#dff6ff;
  font-weight:800;
}
.btn.danger{
  border-color: rgba(251,113,133,0.45);
  background: rgba(251,113,133,0.12);
  color: #ffe4e6;
  font-weight:800;
}

.layout{
  flex:1;
  min-height:0;
  display:grid;
  grid-template-columns: 1fr 8px var(--sideW);
  gap:0;
}

.main{
  padding: 18px;
  min-height:0;
  overflow:auto;
}

.side{
  padding: 18px 14px 18px 14px;
  min-height:0;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.colResizer{
  background: rgba(255,255,255,0.06);
  cursor: col-resize;
}
.colResizer:hover{ background: rgba(56,189,248,0.18); }

.card{
  border:1px solid var(--line);
  border-radius:16px;
  background: var(--panel);
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  overflow:hidden;
}
.card-head{
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
}
.card-head-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.card-head h2{
  margin:0;
  font-size:13px;
  font-weight:800;
  color:#eaf2ff;
}
.card-body{
  padding: 12px 14px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.card-body-tight{
  padding: 12px 12px 14px;
}

.pager{
  display:flex;
  align-items:center;
  gap:10px;
}
.pagerText{
  min-width: 70px;
  text-align:center;
  font-size:12px;
  color: var(--muted);
}

.thumb-grid{
  display:grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 10px;
}
.thumb{
  border:1px solid rgba(255,255,255,0.10);
  border-radius:14px;
  overflow:hidden;
  background: rgba(0,0,0,0.10);
  cursor:pointer;
  display:flex;
  flex-direction:column;
  user-select:none;
}
.thumb:hover{ border-color: rgba(56,189,248,0.22); }
.thumb.selected{
  border-color: rgba(56,189,248,0.55);
  box-shadow: 0 0 0 2px rgba(56,189,248,0.18) inset;
}
.thumb .imgwrap{
  position: relative;
  aspect-ratio: 1 / 1;
  background: rgba(255,255,255,0.03);
}

.thumb .assignBadge{
  position:absolute;
  top:6px;
  right:6px;
  width:26px;
  height:26px;
  border-radius:13px;
  border:1px solid rgba(34,197,94,0.55);
  background: rgba(34,197,94,0.22);
  color:#eafff0;
  font-size:14px;
  line-height:24px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.thumb .assignBadge:hover{
  background: rgba(34,197,94,0.32);
}
.thumb img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}
.thumb .meta{
  padding: 8px 9px 9px;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.thumb .fname{
  font-size: 11px;
  color: #e5e7eb;
  line-height: 1.25;
  word-break: break-all;
}
.thumb .assign{
  font-size: 11px;
  color: var(--muted);
  line-height: 1.25;
  word-break: break-all;
}

.smallLine{ margin-top: 10px; font-size: 11px; }
.muted{ color: var(--muted); }

.dropdown{ display:flex; flex-direction:column; gap:10px; }
.dropdownBtn{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(0,0,0,0.10);
  color: var(--text);
  cursor:pointer;
}
.dropdownBtn:hover{ background: rgba(255,255,255,0.06); }
.caret{ color: var(--muted); }

.dropdownPanel{
  border:1px solid var(--line);
  border-radius:12px;
  background: rgba(0,0,0,0.12);
  padding: 10px;
}
.dropdownHint{
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}
.tree{
  max-height: 360px;
  overflow:auto;
  padding: 6px 2px;
}
.tree ul{
  list-style:none;
  margin:0;
  padding-left: 14px;
}
.treeRow{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 6px 6px;
  border-radius:10px;
}
.treeRow:hover{ background: rgba(255,255,255,0.06); }
.nodeToggle{
  width:20px;
  height:20px;
  border-radius:8px;
  border:1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  flex: 0 0 auto;
}
.nodeLabel{ color: #dbeafe; cursor:pointer; user-select:none; }
.leafLabel{ color: #e5e7eb; cursor:pointer; user-select:none; }
.leafDisabled{ color: rgba(229,231,235,0.38); cursor:not-allowed; }
.leafSelected{
  background: rgba(56,189,248,0.12);
  border: 1px solid rgba(56,189,248,0.25);
}

.statusLine{ margin-top: 8px; font-size: 11px; }

.selectedBox{
  margin-top: 10px;
  border-top: 1px dashed rgba(255,255,255,0.16);
  padding-top: 10px;
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
}
.selectedLabel{ font-size:11px; color: var(--muted); }
.selectedValue{ font-size: 12px; color: #e5e7eb; }

.btnStack{
  display:flex;
  flex-direction:column;
  gap:10px;
}

@media (max-width: 1100px){
  .layout{ grid-template-columns: 1fr; }
  .colResizer{ display:none; }
  .side{ padding-top: 0; }
  .thumb-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}


/* ============================================
   削除候補マーク（□X）
============================================ */
.thumb /* ===== delete mark (□X) : always show box; show X only when .on ===== */
.deleteMark{
  position:absolute;
  top:6px;
  left:6px;
  width:22px;
  height:22px;
  border-radius:6px;
  border:2px solid rgba(239,68,68,0.90);
  background: transparent;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:14px;
  line-height:1;
  user-select:none;
  cursor:pointer;
  color: transparent; /* hide X by default */
}
.deleteMark.on{
  color: rgba(239,68,68,0.95); /* show X when marked */
}
/* Ensure deleteCandidate class never changes thumbnail frame (if remains in DOM) */
.thumb.deleteCandidate{
  outline: none !important;
  box-shadow: none !important;
  border-color: inherit !important;
}

.thumb.deleteCandidate{
  outline: 2px solid rgba(239,68,68,0.45);
  outline-offset: -2px;
}

/* ============================================
   比較ビュー
============================================ */
.compareView{
  position: fixed;
  inset: 0;
  z-index: 999;
  background: linear-gradient(180deg, rgba(6,10,20,0.96), rgba(6,10,20,0.92));
  backdrop-filter: blur(8px);
  overflow: auto;
  padding: 16px;
}

.compareTop{
  position: sticky;
  top: 0;
  z-index: 2;
  display:flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.compareTopLeft{
  display:flex;
  align-items:center;
  gap: 12px;
}
.compareTitle{
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.6px;
}

.compareTopRight{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cmpZoom{
  display:flex;
  align-items:center;
  gap: 8px;
}
.cmpZoom input[type="range"]{
  width: 160px;
}

.cmpPager{
  display:flex;
  align-items:center;
  gap: 8px;
}

.compareBody{
  max-width: min(1500px, calc(100vw - 32px));
  margin: 12px auto 24px auto;
}

.cmpGrid{
  margin-top: 10px;
  display:grid;
  gap: 12px;
}

.cmpGrid.cols3{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cmpGrid.cols2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cmpGrid.cols1{ grid-template-columns: repeat(1, minmax(0, 1fr)); }

.cmpItem{
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0,0,0,0.22);
}

.cmpImgwrap{
  position: relative;
  background: rgba(255,255,255,0.03);
  overflow: auto; /* 拡大時のスクロール用 */
  max-height: 62vh;
}

.cmpImgwrap img{
  display:block;
  width:100%;
  height:auto;
  transform-origin: center center;
}

.cmpMeta{
  padding: 8px 10px 10px 10px;
  border-top: 1px solid rgba(255,255,255,0.10);
  display:flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.cmpName{
  font-size: 12px;
  color: rgba(226,232,240,0.92);
  overflow:hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cmpDelBtn{
  flex: 0 0 auto;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: rgba(226,232,240,0.92);
  cursor: pointer;
}
.cmpDelBtn.on{
  border-color: rgba(239,68,68,0.65);
  background: rgba(239,68,68,0.22);
  color:#ffd9d9;
}
.cmpDelBtn:hover{
  background: rgba(255,255,255,0.10);
}


/* Delete-candidate UI */
.btnDanger{
  border-color: rgba(239,68,68,0.55);
  background: rgba(239,68,68,0.12);
  color: rgba(255,220,220,0.98);
}
.btnDanger:disabled{
  opacity: 0.45;
}

.cmpItem.sel{
  outline: 2px solid rgba(96,165,250,0.55);
  outline-offset: -2px;
}

.cmpImgwrap .deleteMark{ pointer-events: auto; cursor: pointer; }


/* ============================================================
   DELETE_CANDIDATE_BOXED_X_PATCH (2025-12-16)
   - 「□X」ではなく「□に囲まれた X」を描画（テキストではなくCSSで描画）
   - 分類画面/比較画面の両方に適用
   ============================================================ */
.thumb, .cmpItem, .cmpCell, .cmpCard { position: relative; }

.deleteMark::before,

.deleteMark:hover{ transform: scale(1.05); }

/* ============================================================
  PATCH: 削除候補フラグ（deleteMark）の統一
  - 分類画面 / 比較画面で同一の見た目に固定
  - 背景: 透明
  - X: 赤色、枠の上下左右中央
  - サイズ: 分類画面の既定（20px）に固定
  更新日: 2025-12-17
============================================================ */

.deleteMark::before,

/* ============================================================
   DELETE MARK (□X) - Unified Control
   - □ は常時表示、X は .on のときだけ表示
   - 背景透明、サイズ固定、分類/比較で共通
============================================================ */
.deleteMark{
  position:absolute;
  top:8px;
  left:8px;
  width:22px;
  height:22px;
  border:2px solid rgba(255,0,0,0.92);
  border-radius:6px;
  background:transparent;
  box-sizing:border-box;
  cursor:pointer;
  user-select:none;
}
.deleteMark::before,
.deleteMark::after{
  content:"";
  position:absolute;
  top:50%;
  left:50%;
  width:14px;
  height:2px;
  background:rgba(255,0,0,0.95);
  transform-origin:center;
  opacity:0;           /* デフォルトは X を非表示 */
}
.deleteMark::before{
  transform:translate(-50%,-50%) rotate(45deg);
}
.deleteMark::after{
  transform:translate(-50%,-50%) rotate(-45deg);
}
.deleteMark.on::before,
.deleteMark.on::after{
  opacity:1;           /* 削除候補のときだけ X を表示 */
}

/* SG25-PAP DELETE MARK OVERRIDE:START */
.deleteMark {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 18px;
  height: 18px;
  border: 2px solid #ff3b30;
  border-radius: 4px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  pointer-events: auto;
}
.deleteMark .x {
  display: none;
  color: #ff3b30;
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
  transform: translateY(-1px);
}
.deleteMark.on .x {
  display: block;
}
/* 旧実装の「候補でサムネ枠が赤くなる」等の見た目は無効化 */
.thumb.selected.deleteCandidate,
.thumb-card.selected.deleteCandidate,
.photoCard.selected.deleteCandidate,
.compareItem.selected.deleteCandidate,
.compare-item.selected.deleteCandidate {
  outline: none !important;
  box-shadow: none !important;
  border-color: inherit !important;
}
/* SG25-PAP DELETE MARK OVERRIDE:END */


/* PATCH: DELETE_MARK_UI_OVERRIDE v1.0 */
/* 1) 「削除候補」ボタンは非表示（削除は左上の□で統一） */
#btnDeleteMark, #cmpBtnDeleteMark { display: none !important; }

/* 2) サムネイル枠の赤アウトライン（deleteCandidate）は無効化 */
.thumb.deleteCandidate { outline: none !important; }

/* 3) 左上の削除マーク：小さめ／背景透過／クリック可能 */
.deleteMarkBox, .deleteMark, .deleteMarkPlaceholder, .cmpDelBtn {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 80, 80, 0.95);
  border-radius: 8px;
  background: rgba(0,0,0,0);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  z-index: 5;
  box-sizing: border-box;
}
.deleteMarkBox:hover, .deleteMark:hover, .deleteMarkPlaceholder:hover, .cmpDelBtn:hover {
  background: rgba(255, 80, 80, 0.08);
}
.deleteMarkX {
  color: rgba(255, 80, 80, 0.98);
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
}

/* 4) compare 画面のラッパーが position:relative になっていない場合の保険 */
.cmpImgWrap, .cmpImgwrap { position: relative; }


/* === THUMB_VISIBILITY_FIX_BEGIN === */
/* ------------------------------------------------------------
   THUMB VISIBILITY FIX (2025-12-18)
   目的:
     - 画像はHTTP 200で取得できているのに、Safari/Chromeでサムネイルが見えない事象の保険。
     - delete_mark_* などの上書きCSS/JSの副作用で img が非表示になったケースを救済する。
   方針:
     - 既存のレイアウトは維持し、.imgwrap / .cmpImgwrap の img 表示だけを強制。
   ------------------------------------------------------------ */
.imgwrap img, .cmpImgwrap img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  visibility: visible !important;
  opacity: 1 !important;
}
/* === THUMB_VISIBILITY_FIX_END === */


/* [PATCH 2025-12-18] Prevent stray delete marks outside cards in compare overlay */
#compareView > .deleteMark,
#compareView > .deleteMarkBox,
#cmpGrid > .deleteMark,
#cmpGrid > .deleteMarkBox {
  display: none !important;
}
