/* サイト詳細のビジュアル編集(作業領域・変更リスト・サイト全体へのAIの指示・
   全画面表示)のスタイル(layout.tsのlayout()がapp.cssの後に読み込む) */

.card.visual-edit-item {
  cursor:pointer;
  margin:8px 0;
}

.visual-edit-item.is-hovered {
  outline:2px solid var(--primary);
}

.visual-edit-item-body {
  min-width:0;
  font-size:13px;
  margin-bottom:6px;
}

/* カードの上の行(「AIによる変更」の印と、編集の対象) */
.visual-edit-item-heading {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
}

/* 「AIによる変更」の印は対象の名前が長くても縮めない */
.visual-edit-item-heading .badge {
  flex-shrink:0;
}

.visual-edit-item-summary {
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* AIへの指示は全文を確かめられるよう、切り詰めずに改行も含めて折り返す */
.visual-edit-item-summary.is-instruction {
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}

.visual-edit-item-actions {
  display:flex;
  gap:6px;
  justify-content:flex-end;
}

/* ビジュアル編集の作業領域の上の行(編集するページ・全画面表示のボタン) */
.visual-edit-toolbar {
  display:flex;
  align-items:flex-end;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom:10px;
}

.visual-edit-page-field {
  flex:1 1 240px;
}

/* 全画面表示のボタンは、使えるブラウザでだけ出す(クラスはfullscreen.js) */
.visual-edit-fullscreen-enter,
.visual-edit-fullscreen-exit {
  display:none;
}

.visual-edit-workspace.is-fullscreen-available .visual-edit-fullscreen-enter {
  display:inline-flex;
}

.visual-edit-workspace:fullscreen .visual-edit-fullscreen-enter {
  display:none;
}

.visual-edit-workspace:fullscreen .visual-edit-fullscreen-exit {
  display:inline-flex;
}

/* 全画面表示では、プレビューと変更リストを画面の高さいっぱいに広げる */
.visual-edit-workspace:fullscreen {
  display:flex;
  flex-direction:column;
  box-sizing:border-box;
  padding:16px;
  background:var(--background);
}

.visual-edit-workspace:fullscreen .visual-edit-layout {
  flex:1;
  min-height:0;
  flex-wrap:nowrap;
  align-items:stretch;
}

.visual-edit-workspace:fullscreen .visual-edit-frame,
.visual-edit-workspace:fullscreen .visual-edit-panel {
  height:auto;
}

@media (max-width:720px) {
  .visual-edit-workspace:fullscreen .visual-edit-layout {
    flex-direction:column;
  }

  .visual-edit-workspace:fullscreen .visual-edit-panel {
    flex:0 0 40%;
  }
}

.visual-edit-layout {
  display:flex;
  gap:16px;
  align-items:flex-start;
  flex-wrap:wrap;
}

.visual-edit-frame {
  flex:1;
  min-width:320px;
}

.visual-edit-panel {
  flex:0 0 300px;
  max-width:100%;
  background:var(--surface-tint);
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px;
  height:70vh;
  overflow:hidden;
  align-self:stretch;
  display:flex;
  flex-direction:column;
}

/*
 * 開くと長くなるので、右側の欄の高さに収まらないときは縮めて中をスクロール
 * させる(下の「まとめて反映」とエラーの欄を押し出して隠さないため)
 */
.visual-edit-global {
  flex:0 1 auto;
  min-height:0;
  overflow:auto;
  margin-bottom:10px;
  border-bottom:1px solid var(--border);
  /* 左右は、入力欄の選択中の枠(2px)がスクロールの端で切れない分を空ける */
  padding:0 3px 10px;
}

/* 「サイト全体をAIに指示」の見出し。押すと欄を開け閉めできる */
.visual-edit-global-label {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  font-weight:700;
  cursor:pointer;
  list-style:none;
}

.visual-edit-global-label::-webkit-details-marker {
  display:none;
}

.visual-edit-global-label .icon {
  flex:0 0 auto;
  color:var(--text-muted);
  transition:transform .15s;
}

.visual-edit-global[open] .visual-edit-global-label {
  margin:0 0 4px;
}

.visual-edit-global[open] .visual-edit-global-label .icon {
  transform:rotate(180deg);
}

.visual-edit-global-guide {
  margin:0 0 6px;
}

.visual-edit-global-input {
  min-height:50px;
}

.visual-edit-global-add {
  width:100%;
  margin-top:6px;
}

.visual-edit-list-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  font-weight:700;
  margin-bottom:8px;
  flex:0 0 auto;
}

/* 変更リストを元に戻す・やり直すボタン(見出しの右端に並べる) */
.visual-edit-history {
  display:flex;
  gap:4px;
}

.button.icon-button.visual-edit-history-button {
  width:30px;
  height:30px;
}

.visual-edit-count {
  font-weight:400;
}

/* 「サイト全体をAIに指示」を開いても、変更リストが少しは見えるようにする */
.visual-edit-list {
  flex:1;
  overflow:auto;
  min-height:120px;
  /* カードの影と、強調表示の枠(2px)がスクロールの端で切れない分を空ける */
  padding:0 4px;
}

.visual-edit-apply {
  width:100%;
  margin-top:12px;
  flex:0 0 auto;
}

/* 「まとめて反映」できなかった理由(ボタンの下に出す) */
.visual-edit-apply-error {
  flex:0 0 auto;
  margin:8px 0 0;
}
