/* =====================================================
   Image Crop Studio — editor.css
   編集画面レイアウト / キャンバスビューポート / ツールバー / ドロップゾーン
   ===================================================== */

/* ---- 2カラムレイアウト(左: 編集 / 右: 設定) ---- */
.app-layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 8px;
}
.editor-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 12px;
}
.settings-col {
  width: 336px;
  flex: none;
}

/* ---- ツールバー ---- */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
}
.editor-toolbar .toolbar-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 150px;
}
.editor-toolbar .toolbar-zoom input[type="range"] { flex: 1; }
.toolbar-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex: none;
}

/* ---- ビューポート ---- */
.viewport-card {
  padding: 10px;
  overflow: hidden;
}
.viewport {
  position: relative;
  width: 100%;
  height: clamp(340px, calc(100vh - 300px), 640px);
  border-radius: 12px;
  overflow: hidden;
  background:
    conic-gradient(#ECE8F8 0 25%, #F8F6FE 0 50%, #ECE8F8 0 75%, #F8F6FE 0) 0 0 / 20px 20px;
}
.viewport canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
.viewport canvas.is-dragging { cursor: grabbing; }

/* 出力サイズのラベル */
.viewport-meta {
  position: absolute;
  left: 12px;
  bottom: 10px;
  background: rgba(63, 58, 86, 0.66);
  color: #fff;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 7px;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* ---- ドロップゾーン(画像未読み込み時) ---- */
.dropzone {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
  background: var(--surface);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: background 0.15s, outline 0.15s;
  outline: 2px dashed var(--border-strong);
  outline-offset: -14px;
  border-radius: 12px;
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-over {
  background: rgba(243, 240, 253, 0.85);
  outline-color: var(--accent);
}
.dropzone[hidden] { display: none; }
.dropzone-icon { color: var(--accent-soft); }
.dropzone-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}
.dropzone-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.7;
}
.dropzone .btn { pointer-events: none; }

/* ---- 設定パネル ---- */
.settings-col .card-block + .card-block { margin-top: 14px; }

.canvas-size-body[hidden] { display: none; }

.hint {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.6;
  margin: 8px 0 0;
}

.out-size-label {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---- 保存プレビュー(モーダル内) ---- */
.preview-stage {
  background:
    conic-gradient(#ECE8F8 0 25%, #F8F6FE 0 50%, #ECE8F8 0 75%, #F8F6FE 0) 0 0 / 16px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  min-height: 180px;
}
.preview-stage img {
  max-width: 100%;
  max-height: 320px;
  display: block;
  box-shadow: 0 4px 16px rgba(63, 58, 86, 0.18);
}
.preview-meta {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  margin: 10px 0 12px;
  font-variant-numeric: tabular-nums;
}

/* ---- レスポンシブ ---- */
@media (max-width: 960px) {
  .app-layout { flex-direction: column; }
  .editor-col { position: static; width: 100%; }
  .settings-col { width: 100%; }
  .viewport { height: clamp(300px, 52vh, 520px); }
}
@media (max-width: 640px) {
  .editor-toolbar { padding: 8px 10px; }
  .editor-toolbar .btn { padding: 7px 10px; font-size: 12px; }
  .viewport { height: clamp(260px, 46vh, 420px); }
}
