/* ============================================================
   作品エディタ(admin.html)専用スタイル
   ※ style.css の CSS変数・カード/フレーム系を共有して使う
   ============================================================ */

body.admin {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== ツールバー ===== */
.admin-bar {
  flex-shrink: 0;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.admin-bar-left { display: flex; align-items: center; gap: 14px; }
.admin-logo { font-weight: 800; font-size: 16px; letter-spacing: -.01em; }

.admin-dirty {
  font-size: 12px;
  font-weight: 600;
  color: #b45309;
  background: color-mix(in srgb, #f59e0b 15%, transparent);
  padding: 4px 10px;
  border-radius: 999px;
}

.admin-bar-right { display: flex; align-items: center; gap: 8px; }

.abtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: opacity .15s, background .15s, border-color .15s, transform .1s;
}
.abtn:active { transform: scale(.97); }
.abtn-primary { background: var(--accent); color: var(--accent-text); }
.abtn-primary:hover { opacity: .85; }
.abtn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.abtn-ghost:hover { background: var(--surface-2); }
.abtn-add { background: var(--accent); color: var(--accent-text); padding: 7px 14px; font-size: 12.5px; }
.abtn-add:hover { opacity: .85; }
.abtn-danger { background: color-mix(in srgb, #ef4444 12%, transparent); color: #dc2626; }
.abtn-danger:hover { background: color-mix(in srgb, #ef4444 20%, transparent); }

/* ===== ヒントバー ===== */
.admin-hint {
  position: relative;
  flex-shrink: 0;
  padding: 10px 44px 10px 20px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border-bottom: 1px solid var(--border);
  line-height: 1.6;
}
.admin-hint b { color: var(--text); }
.admin-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  padding: 1px 6px;
  background: var(--surface-2);
  border-radius: 5px;
}
.hint-close {
  position: absolute;
  top: 8px; right: 12px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  font-size: 16px;
  color: var(--text-faint);
  background: transparent;
  border: none;
  border-radius: 6px;
}
.hint-close:hover { background: var(--surface-2); color: var(--text); }

/* ===== 本体レイアウト ===== */
.admin-main {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 0;
}

/* ===== 左: リスト ===== */
.admin-list {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
  min-height: 0;
}

.admin-list-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.admin-list-head b { color: var(--text); }

.admin-list-items { flex: 1; overflow-y: auto; padding: 10px; }

.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.list-item:hover { background: var(--surface-2); }
.list-item.active { background: var(--surface-2); border-color: var(--border-strong); }

.list-thumb {
  flex-shrink: 0;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-size: 19px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
}
.list-thumb img { width: 100%; height: 100%; object-fit: cover; }

.list-info { flex: 1; min-width: 0; }
.list-name {
  font-size: 13.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-cat { font-size: 11px; color: var(--text-faint); }

.list-move { display: flex; flex-direction: column; gap: 2px; }
.list-move button {
  width: 22px; height: 17px;
  display: grid; place-items: center;
  font-size: 9px;
  color: var(--text-faint);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
}
.list-move button:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.list-move button:disabled { opacity: .3; cursor: default; }

/* ===== 右: エディタ ===== */
.admin-editor { overflow-y: auto; min-height: 0; }

.admin-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-faint);
  text-align: center;
}
.admin-empty-icon { font-size: 48px; opacity: .7; }

.admin-form { max-width: 720px; margin: 0 auto; padding: 26px 28px 60px; }

/* プレビュー */
.preview-wrap { margin-bottom: 26px; }
.preview-label {
  display: block;
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.preview-card {
  max-width: 360px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* フォーム */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }

.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.field > span i { font-style: normal; font-weight: 500; color: var(--text-faint); margin-left: 5px; font-size: 11px; }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.field-note { grid-column: 1 / -1; font-size: 11.5px; color: var(--text-faint); margin-top: -6px; }

/* 画像ドロップ */
.img-drop {
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  padding: 6px;
  background: var(--surface);
}
.img-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 16px;
  cursor: pointer;
  border-radius: 8px;
  text-align: center;
  transition: background .15s;
}
.img-drop-inner:hover { background: var(--surface-2); }
.img-drop-icon { font-size: 30px; }
.img-drop-text { font-size: 13px; color: var(--text-muted); }
.img-drop.dragover { border-color: var(--accent); background: var(--surface-2); }

.img-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px; }
.img-preview img {
  max-width: 100%;
  max-height: 220px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.img-remove {
  padding: 6px 14px;
  font-size: 12.5px; font-weight: 600; font-family: inherit;
  color: #dc2626;
  background: color-mix(in srgb, #ef4444 12%, transparent);
  border: none;
  border-radius: 999px;
}
.img-remove:hover { background: color-mix(in srgb, #ef4444 20%, transparent); }

.form-actions {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ===== トースト ===== */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  padding: 12px 22px;
  font-size: 13.5px; font-weight: 600;
  color: #fff;
  background: #16a34a;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  z-index: 200;
  animation: toastIn .25s cubic-bezier(.2,.7,.3,1);
}
.toast.err { background: #dc2626; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ===== レスポンシブ ===== */
@media (max-width: 820px) {
  body.admin { height: auto; overflow: auto; }
  .admin-main { grid-template-columns: 1fr; }
  .admin-list { border-right: none; border-bottom: 1px solid var(--border); max-height: 240px; }
  .field-grid { grid-template-columns: 1fr; }
  .admin-editor { overflow: visible; }
}
