/* ── Shared UI components ── */

/* ── Draw cards (edit_log + log_detail) ── */
.draw-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.2s;
}
.draw-card:hover { border-color: var(--border-strong); }
/* M2: メモカード選択ハイライト(4 カード種共通)。 */
.draw-card.selected { border-color: var(--neve); }
.draw-card + .draw-card { margin-top: 8px; }
.draw-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.draw-card-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--crevasse);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.draw-card-num.route-badge {
  background: var(--clay);
  border-radius: var(--radius);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.draw-card-num.shape-badge {
  background: var(--lichen);
  border-radius: var(--radius);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.draw-card-title {
  flex: 1;
  font-size: 13px;
  font-weight: 400;
  color: var(--fg);
  line-height: 1.3;
}
.draw-card-del {
  background: transparent;
  border: none;
  font-size: 14px;
  color: var(--fn-danger);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  opacity: 0.55;
  flex-shrink: 0;
  line-height: 1;
  transition: opacity 0.15s, background 0.15s;
}
.draw-card-del:hover { opacity: 1; background: rgba(140,56,40,0.08); }
.draw-card-edit {
  background: transparent;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius);
  opacity: 0.55;
  flex-shrink: 0;
  line-height: 1;
  transition: opacity 0.15s, background 0.15s;
}
.draw-card-edit:hover { opacity: 1; background: rgba(44,58,66,0.07); }
.draw-card-memo {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-top: 4px;
}
.draw-card-empty {
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.draw-guide {
  display: flex;
  align-items: center;
  gap: 8px;
}
.draw-guide-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 10px 6px;
}
.draw-guide-icon {
  width: 24px;
  height: 24px;
  color: var(--neve);
  flex-shrink: 0;
}
.draw-guide-label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--fg);
  line-height: 1.3;
}
.draw-guide-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.3;
}
.draw-guide-arrow {
  font-size: 13px;
  color: var(--fg-muted);
  flex-shrink: 0;
  user-select: none;
}

/* ── Note card (log_detail) ── */
.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.note-card:hover { border-color: var(--neve); }
.note-map-marker {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--crevasse);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.28);
  cursor: pointer;
}
.note-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}
.note-card-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-card-idx {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 1px 5px;
  flex-shrink: 0;
}
.note-card-body {
  font-size: 12px;
  line-height: 1.65;
  color: var(--fg-muted);
}
.note-card-photos {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.note-card-photo {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s;
}
.note-card-photo:hover { opacity: 0.82; }

/* ── Photo modal ── */
.photo-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(44, 58, 66, 0.85);
  align-items: center;
  justify-content: center;
}
.photo-modal-overlay.open { display: flex; }
.photo-modal {
  position: relative;
  display: flex;
  max-width: min(90vw, 960px);
  max-height: 82vh;
  border-radius: var(--radius-modal);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.photo-modal-img-wrap {
  flex: 0 0 60%;
  background: #1a1a18;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.photo-modal-img-wrap img {
  width: 100%;
  height: 82vh;
  max-height: 82vh;
  object-fit: contain;
  display: block;
}
.photo-modal-info {
  flex: 1;
  background: var(--surface);
  padding: 28px 20px 20px;
  overflow-y: auto;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--fg);
  line-height: 1.65;
}
.photo-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(0,0,0,0.45);
  border: none;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.88);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 9px;
  z-index: 10;
}
.photo-modal-close:hover { background: rgba(0,0,0,0.65); color: #fff; }

@media (max-width: 768px) {
  .photo-modal {
    flex-direction: column;
    max-width: 95vw;
    max-height: 90vh;
  }
  .photo-modal-img-wrap {
    flex: 0 0 auto;
    height: 52vw;
    min-height: 200px;
  }
  .photo-modal-img-wrap img {
    height: 100%;
    max-height: none;
  }
  .photo-modal-info {
    flex: 1;
    max-height: 160px;
  }
}

/* ── Toggle switch ── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-strong);
  border-radius: var(--radius);
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--neve); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Toast notification ── */
.bc-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  padding: 10px 20px;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
}
.bc-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* legacy id-based toast in log_detail */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  font-family: var(--font-mono);
  padding: 10px 20px;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Photos grid (edit_log) ── */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(44,58,66,0.82);
  color: #fff;
  border: none;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* δ2-b: 写真サムネ右下の鉛筆アイコン (コメント編集起動)。
   .photo-thumb-del (右上 ×) と上下に振り分けて干渉を回避。
   妻ペルソナ Day 2: 視認性向上のため半透明白背景 + var(--fg) アイコン色 +
   hover で var(--clay) に変化させる構成に刷新。 */
.photo-thumb-edit {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--fg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: color 0.15s, background 0.15s;
}
.photo-thumb-edit:hover {
  color: var(--clay);
  background: #fff;
}
.photo-thumb-edit svg { width: 14px; height: 14px; display: block; }

/* 妻ペルソナ Day 2: コメント有りバッジ (左上、photo.comment が非空のとき表示)。
   NEW (左下) / × (右上) / 鉛筆 (右下) と 4 隅で衝突回避。tokens.css 準拠で
   border-radius 3px、半透明白背景 + var(--fg) アイコン色。 */
.photo-comment-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.photo-comment-badge svg { width: 14px; height: 14px; display: block; }
.photo-add-btn {
  aspect-ratio: 1;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-muted);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}
.photo-add-btn:hover { border-color: var(--neve); color: var(--neve); }

/* ── Section label (shared utility) ── */
.panel-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.panel-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── δ2-b: 写真コメント編集モーダル (既存 .photo-modal を流用、編集モード追記分) ── */
/* .photo-modal-overlay / .photo-modal / .photo-modal-info / .photo-modal-close は
   上部 (L204-) で既存定義済。is-edit-mode はパネル拡張、textarea/トグルを入れる。 */
.photo-modal.is-edit-mode { max-width: min(94vw, 980px); }
.photo-modal.is-edit-mode .photo-modal-info {
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.photo-modal-edit-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.6;
}
.photo-modal-edit-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0;
}
.photo-modal-edit-textarea {
  width: 100%;
  min-height: 120px;
  font-family: var(--font-body);
  font-size: 16px;          /* CLAUDE.md 規律: iOS Safari 自動ズーム回避 */
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  resize: vertical;
  box-sizing: border-box;
  background: var(--bg);
}
.photo-modal-edit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--fg);
}
.photo-modal-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.photo-modal-edit-actions button {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}
.photo-modal-edit-actions button.is-primary {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.photo-modal-edit-actions button:disabled { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 768px) {
  .photo-modal.is-edit-mode .photo-modal-info {
    max-height: none;
    padding: 16px;
  }
}

/* Y-C1: 新規写真サムネ左下の NEW バッジ。旧 edit_log.html L2223 のインライン
   スタイル (background: rgba(122,158,176,0.9) 等) を CSS クラス化した。
   rgba 値は元のまま保持 (色味の互換性を保つ)。 */
.photo-thumb-new-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(122, 158, 176, 0.9);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 2px;
  pointer-events: none;
}

/* K-7: HEIC クライアント変換中のサムネオーバーレイ。生 HEIC は非 Safari で
   黒表示されるため、JPEG 変換が完了するまで「変換中」を明示する。Atelier 規律
   に従いスピン/バウンスは使わず、静的なテキストオーバーレイで処理中を伝える
   (オーバーレイの出現/消滅自体が情報変化のフィードバックになる)。 */
.photo-thumb-converting {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  pointer-events: none;
}
.photo-thumb-converting span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}
