/* blog-editor.css — 블로그 에디터 전용 스타일 (v2.0) */

/* 3-column layout */
.editor-layout {
  display: grid;
  grid-template-columns: 220px minmax(480px, 820px) 300px;
  gap: 20px;
  max-width: 100%;
  margin: 0 auto;
  padding: 20px 24px;
}
.editor-left {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.editor-main { min-width: 0; }
.editor-right {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
}

/* Title & editor area */
.title-input {
  width: 100%; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-bright); font-size: 18px; font-weight: 600; outline: none; margin-bottom: 16px;
}
.title-input:focus { border-color: var(--accent); }
.editor-wrap { margin-bottom: 0; }
#editor { min-height: 400px; }

/* Toast UI overrides */
.toastui-editor-defaultUI { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.toastui-editor-defaultUI .toastui-editor-ww-container { background: var(--surface); }
.ProseMirror { color: var(--text); }

/* Pinned checkbox */
.pinned-row { display: flex; align-items: center; gap: 8px; }
.pinned-row input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.pinned-row label { margin-bottom: 0; cursor: pointer; font-size: 12px; }

/* Sidebar tabs */
.sidebar-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  background: var(--surface);
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}
.sidebar-tabs .tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: var(--surface2);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.sidebar-tabs .tab:hover { color: var(--text); background: var(--surface); }
.sidebar-tabs .tab.active {
  color: var(--accent);
  background: var(--surface);
  border-bottom-color: var(--accent);
}
.tab-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 14px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Seed catalog */
.seed-search-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.seed-search-bar input {
  flex: 1;
  padding: 6px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.seed-search-bar input:focus { border-color: var(--accent); }
.seed-search-bar select {
  padding: 6px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.seed-list {
  /* 스크롤은 .tab-content에서 처리 */
}
.seed-item {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.seed-item:hover { border-color: var(--accent); background: rgba(109,40,217,0.03); }
.seed-item.used { opacity: 0.5; }
.seed-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.seed-score { font-size: 11px; font-weight: 700; color: #f59e0b; white-space: nowrap; }
.seed-id { font-size: 11px; color: var(--text-dim); font-weight: 500; }
.seed-cat {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  color: #fff;
}
.seed-cat.ARCH { background: #3b82f6; }
.seed-cat.DEBUG { background: #ef4444; }
.seed-cat.GOV { background: #8b5cf6; }
.seed-cat.PRODUCT { background: #10b981; }
.seed-cat.TEAM { background: #f97316; }
.seed-cat.BIZ { background: #06b6d4; }
.seed-title {
  font-size: 12px; font-weight: 600; color: var(--text-bright);
  line-height: 1.3; margin-bottom: 3px;
}
.seed-insight {
  font-size: 11px; color: var(--text-dim); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.seed-popup-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
}
.seed-popup {
  background: var(--surface);
  border-radius: 12px; padding: 24px;
  max-width: 480px; width: 90%;
  max-height: 80vh; overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}
.seed-popup h3 { font-size: 16px; color: var(--text-bright); margin-bottom: 12px; line-height: 1.4; }
.seed-popup-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.seed-popup-meta span { font-size: 12px; color: var(--text-dim); }
.seed-popup-field { margin-bottom: 12px; }
.seed-popup-field label { font-size: 11px; color: var(--text-dim); font-weight: 600; display: block; margin-bottom: 3px; }
.seed-popup-field p { font-size: 13px; color: var(--text); line-height: 1.5; margin: 0; }
.seed-popup-actions { display: flex; gap: 8px; margin-top: 16px; }
.seed-popup-actions button { flex: 1; }

/* Image library */
#imageLibrary {
  max-height: 360px;
  overflow-y: auto;
}
.img-lib-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 4px;
}
.img-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
.img-thumb:hover { border-color: var(--accent); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.toastui-editor-ww-container .ProseMirror img {
  cursor: pointer;
}
.img-delete {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: #fff;
  border: none; font-size: 14px; line-height: 1;
  cursor: pointer; display: none;
  align-items: center; justify-content: center;
}
.img-thumb:hover .img-delete { display: flex; }

/* Image library date header & status */
.img-lib-date {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  margin-top: 8px;
}
.img-lib-status {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 20px;
}
.img-lib-status--error {
  color: var(--danger);
}

/* Image preview modal (lightbox) */
.img-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.img-preview-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  cursor: default;
}
.img-preview-modal img {
  max-width: 80vw;
  max-height: 70vh;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  object-fit: contain;
}
.img-preview-actions {
  display: flex;
  gap: 8px;
}
.img-preview-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
}
.img-preview-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}
.img-preview-btn--danger {
  color: #fca5a5;
}
.img-preview-btn--danger:hover {
  background: rgba(220, 38, 38, 0.3);
}
.img-preview-btn--dim {
  color: rgba(255, 255, 255, 0.6);
}

/* Floating image toolbar */
.img-float-toolbar {
  position: fixed;
  display: flex;
  gap: 2px;
  background: rgba(0,0,0,0.75);
  border-radius: 6px;
  padding: 4px 6px;
  z-index: 200;
  white-space: nowrap;
}
.img-float-toolbar button {
  background: none;
  border: none;
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
  white-space: nowrap;
}
.img-float-toolbar button:hover {
  background: rgba(255,255,255,0.2);
}

/* Research tab */
.research-search-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.research-search-bar input {
  flex: 1;
  padding: 6px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.research-search-bar input:focus { border-color: var(--accent); }
.research-search-bar button {
  padding: 6px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.research-search-bar button:hover { opacity: 0.85; }
.research-source-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.research-source-toggle button {
  flex: 1;
  padding: 6px 4px;
  border: none;
  background: var(--surface2);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.research-source-toggle button:not(:last-child) { border-right: 1px solid var(--border); }
.research-source-toggle button.active { background: var(--accent); color: #fff; }
.research-results {
  /* 스크롤은 .tab-content에서 처리 */
}
.research-item {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  transition: border-color 0.2s;
}
.research-item:hover { border-color: var(--accent); }
.research-item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1.4;
  margin-bottom: 3px;
}
.research-item-meta {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.research-item-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.research-item-actions {
  display: flex;
  gap: 6px;
}
.research-item-actions button {
  padding: 3px 8px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface2);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}
.research-item-actions button:hover { border-color: var(--accent); color: var(--accent); }
.research-img-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.research-img-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
.research-img-item:hover { border-color: var(--accent); }
.research-img-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.research-copyright {
  font-size: 10px;
  color: var(--danger);
  background: rgba(220,38,38,0.05);
  padding: 6px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  line-height: 1.4;
}
.research-history {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.research-history-item {
  padding: 2px 8px;
  font-size: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}
.research-history-item:hover { border-color: var(--accent); color: var(--accent); }
.research-more {
  display: block;
  width: 100%;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: 1px dashed var(--border);
  border-radius: 6px;
  cursor: pointer;
  margin-top: 6px;
}
.research-more:hover { background: rgba(109,40,217,0.03); }
.research-loading {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 20px;
}
.research-suggest-toast {
  position: fixed;
  bottom: 70px;
  right: 24px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: 0 4px 12px rgba(109,40,217,0.3);
}
.research-suggest-toast.show { opacity: 1; }
.research-img-popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.research-img-popup img {
  max-width: 90%;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.research-img-popup-src {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 11px;
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Admin share buttons */
.admin-share {
  display: flex; align-items: center; gap: 10px; margin-top: 16px;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.admin-share.disabled { opacity: 0.4; pointer-events: none; }
.admin-share-label { font-size: 12px; color: var(--text-dim); font-weight: 500; white-space: nowrap; }
.admin-share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text-dim); font-size: 13px;
  text-decoration: none; cursor: pointer; transition: all 0.2s;
}
.admin-share-btn:hover { border-color: var(--accent); color: var(--accent); }
.admin-share-copy-full {
  padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text-dim); font-size: 12px;
  cursor: pointer; transition: all 0.2s; white-space: nowrap; font-family: inherit;
}
.admin-share-copy-full:hover { border-color: var(--accent); color: var(--accent); }

/* Responsive */
@media (max-width: 1200px) {
  .editor-layout { grid-template-columns: 200px minmax(400px, 820px); }
  .editor-right { display: none; }
}
@media (max-width: 700px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-left { position: static; max-height: none; }
}
