@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

/* ── 기본 리셋 ── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
  color: #111827;
  background: #f3f4f6;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* ── 반경 ── */
.r35 { border-radius: 35px !important; }
.r24 { border-radius: 24px !important; }
.r20 { border-radius: 20px !important; }
.r16 { border-radius: 16px !important; }
.r12 { border-radius: 12px !important; }
.r10 { border-radius: 10px !important; }
.r8  { border-radius: 8px  !important; }
.r5  { border-radius: 5px  !important; }

/* ── 카드 ── */
.card-shadow {
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}
.card-hover { transition: transform .15s ease, box-shadow .15s ease; }
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
}

/* ── 모달 ── */
.modal-overlay {
  background: rgba(15,15,15,.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.modal-overlay .modal-content {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  width: 100%;
  margin: auto;
}

/* ── 애니메이션 ── */
.fade-in { animation: fadeIn .25s cubic-bezier(.2,.8,.3,1); }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast-show { opacity: 1 !important; transform: translate(-50%,0) !important; }

/* ── 프로그레스 바 ── */
.progress-bar {
  height: 6px;
  border-radius: 99px;
  background: #e5e7eb;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* ── 스크롤바 숨김 ── */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ── 스켈레톤 ── */
.skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── 사이드바 ── */
.sidebar-item {
  cursor: pointer;
  transition: all .12s ease;
}
.sidebar-item:hover { background: rgba(0,0,0,.04); }
.sidebar-item.active {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  box-shadow: inset 3px 0 0 #3b82f6;
}

/* ── 배지 ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.badge-approved  { background: #dcfce7; color: #15803d; }
.badge-rejected  { background: #fee2e2; color: #dc2626; }
.badge-withdrawn { background: #f3f4f6; color: #6b7280; }
.badge-pending   { background: #dbeafe; color: #1d4ed8; }

/* ── 업로드 존 ── */
.upload-zone { border: 2px dashed #d1d5db; cursor: pointer; transition: border-color .2s; }
.upload-zone:hover { border-color: #3b82f6; background: #eff6ff; }

/* ── 텍스트 줄임 ── */
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── 멘션 태그 ── */
.mention-tag {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 12px;
  cursor: default;
}

/* ════════════════════════════════════════
   마크다운 프로즈 (개발 프로젝트용)
   ════════════════════════════════════════ */
.prose {
  font-size: 0.875rem;
  line-height: 1.75;
  color: #374151;
}

/* 제목 — 작게 유지 */
.prose h1 {
  font-size: 0.95rem;
  font-weight: 800;
  margin: 1rem 0 0.4rem;
  color: #111827;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.25rem;
}
.prose h2 {
  font-size: 0.875rem;
  font-weight: 700;
  margin: 0.9rem 0 0.35rem;
  color: #1f2937;
}
.prose h3 {
  font-size: 0.825rem;
  font-weight: 700;
  margin: 0.75rem 0 0.3rem;
  color: #374151;
}

/* 단락 */
.prose p { margin-bottom: 0.7rem; }

/* 목록 */
.prose ul { list-style: disc; padding-left: 1.4rem; margin-bottom: 0.7rem; }
.prose ol { list-style: decimal; padding-left: 1.4rem; margin-bottom: 0.7rem; }
.prose li { margin-bottom: 0.2rem; }

/* 강조 */
.prose strong { font-weight: 800; color: #111827; }
.prose em { font-style: italic; color: #6b7280; }

/* 인라인 코드 */
.prose code {
  background: #1e293b;
  color: #7dd3fc;
  padding: 0.1rem 0.45rem;
  border-radius: 5px;
  font-size: 0.8rem;
  font-family: 'Fira Code', 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  font-weight: 500;
}

/* 코드 블록 — 핵심 ★ */
.prose pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1.1rem 1.25rem;
  border-radius: 12px;
  overflow-x: auto;
  margin: 0.75rem 0;
  border: 1px solid #1e293b;
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  position: relative;
}
.prose pre::before {
  content: '';
  display: block;
  width: 52px;
  height: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 10'%3E%3Ccircle cx='5' cy='5' r='4' fill='%23ef4444'/%3E%3Ccircle cx='22' cy='5' r='4' fill='%23f59e0b'/%3E%3Ccircle cx='39' cy='5' r='4' fill='%2322c55e'/%3E%3C/svg%3E") no-repeat;
  margin-bottom: 10px;
  opacity: .7;
}
.prose pre code {
  background: transparent;
  color: #e2e8f0;
  padding: 0;
  font-size: 0.8rem;
  border-radius: 0;
  line-height: 1.65;
}

/* 코드 하이라이팅 색상 */
.prose pre .hljs-comment,
.prose pre .hljs-meta  { color: #64748b; font-style: italic; }
.prose pre .hljs-keyword,
.prose pre .hljs-selector-tag { color: #c084fc; }
.prose pre .hljs-string,
.prose pre .hljs-attr { color: #86efac; }
.prose pre .hljs-number,
.prose pre .hljs-literal { color: #f9a8d4; }
.prose pre .hljs-title,
.prose pre .hljs-name { color: #60a5fa; }
.prose pre .hljs-variable,
.prose pre .hljs-template-variable { color: #fcd34d; }
.prose pre .hljs-built_in { color: #34d399; }

/* 인용구 */
.prose blockquote {
  border-left: 3px solid #3b82f6;
  padding: 0.6rem 1rem;
  color: #6b7280;
  font-style: italic;
  background: #eff6ff;
  border-radius: 0 8px 8px 0;
  margin: 0.6rem 0;
}

/* 표 */
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 0.75rem; font-size: 0.8rem; }
.prose th { background: #f8fafc; font-weight: 800; padding: 0.5rem 0.75rem; border: 1px solid #e2e8f0; text-align: left; color: #374151; }
.prose td { padding: 0.45rem 0.75rem; border: 1px solid #e2e8f0; color: #4b5563; }
.prose tr:nth-child(even) { background: #f8fafc; }

/* 링크 */
.prose a { color: #3b82f6; text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { color: #1d4ed8; }

/* 구분선 */
.prose hr { border: none; border-top: 1px solid #e5e7eb; margin: 1rem 0; }

/* 이미지 */
.prose img { max-width: 100%; border-radius: 8px; margin: 0.5rem 0; }


/* ════════════════════════════════════════
   EasyMDE 에디터 커스텀
   ════════════════════════════════════════ */
.EasyMDEContainer { border-radius: 16px; overflow: hidden; border: 1px solid #e5e7eb; }
.EasyMDEContainer .CodeMirror {
  font-family: 'Fira Code', 'JetBrains Mono', Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  min-height: 180px;
  background: #fafafa;
  color: #1e293b;
  border: none;
  padding: 12px;
}
.EasyMDEContainer .editor-toolbar {
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  border-top: none;
  border-left: none;
  border-right: none;
  padding: 6px 10px;
}
.EasyMDEContainer .editor-toolbar button {
  color: #6b7280;
  border-radius: 6px;
  width: 28px;
  height: 28px;
}
.EasyMDEContainer .editor-toolbar button:hover,
.EasyMDEContainer .editor-toolbar button.active {
  background: #e0e7ff;
  color: #4338ca;
  border: none;
}
.EasyMDEContainer .editor-toolbar i.separator { border-color: #e5e7eb; }

/* 미리보기 영역 */
.EasyMDEContainer .editor-preview {
  background: #fff;
  padding: 16px;
  font-family: 'Pretendard', sans-serif;
}
.EasyMDEContainer .editor-preview pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.8rem;
}
.EasyMDEContainer .editor-preview code {
  background: #1e293b;
  color: #7dd3fc;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* ════════════════════════════════════════
   모바일 반응형
   ════════════════════════════════════════ */
@media (max-width: 1024px) {
  #sidebar {
    position: fixed; left: 0; top: 0; z-index: 80;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    height: 100vh;
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.35); z-index: 79;
  }
  #sidebar-overlay.show { display: block; }
  #mobile-header { display: flex !important; }
}
@media (min-width: 1025px) {
  #mobile-header { display: none !important; }
  #sidebar-overlay { display: none !important; }
}
@media (max-width: 640px) {
  .modal-overlay .modal-content {
    border-radius: 20px !important;
    padding: 20px !important;
    max-width: 100% !important;
  }
  .modal-overlay .modal-content h2 { font-size: 1.15rem !important; }
  #content { padding: 12px !important; }
  .grid.grid-cols-4 { grid-template-columns: repeat(2, 1fr) !important; }
  .grid.grid-cols-3 { grid-template-columns: 1fr !important; }
}

/* ════════════ 블록 에디터 ════════════ */
.dev-block { position: relative; display: flex; align-items: flex-start; gap: 6px; margin-bottom: 2px; }
.block-handle {
  position: absolute; left: -22px; top: 4px;
  cursor: grab; font-size: 14px; color: #d1d5db;
  opacity: 0; transition: opacity .15s;
  user-select: none;
}
.dev-block:hover .block-handle { opacity: 1; }

/* contenteditable placeholder */
.block-content:empty:before {
  content: attr(data-placeholder);
  color: #d1d5db; pointer-events: none;
  font-style: italic; font-size: 0.875rem;
}
.block-content:focus:empty:before { color: #e5e7eb; }

/* 코드 블록 */
.code-block-wrap {
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #1e293b;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  width: 100%;
  margin: 4px 0;
}
.code-block-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px 4px;
  background: #0f172a;
}
.mac-dots { display: flex; gap: 6px; }
.mac-dots span { width: 10px; height: 10px; border-radius: 50%; }
.mac-dots span:nth-child(1) { background: #ef4444; }
.mac-dots span:nth-child(2) { background: #f59e0b; }
.mac-dots span:nth-child(3) { background: #22c55e; }
.code-block-textarea {
  width: 100%; background: transparent; border: none; outline: none;
  color: #e2e8f0; font-family: 'Fira Code', 'JetBrains Mono', Consolas, monospace;
  font-size: 0.8rem; line-height: 1.7; padding: 8px 14px 14px;
  resize: none; min-height: 80px; tab-size: 2;
}
.code-block-textarea::placeholder { color: #475569; }

/* 블록 타입별 스타일 */
.block-h1   { font-size: 1.4rem; font-weight: 900; color: #111827; line-height: 1.3; }
.block-h2   { font-size: 1.15rem; font-weight: 800; color: #1f2937; line-height: 1.4; border-bottom: 1px solid #f3f4f6; padding-bottom: 4px; }
.block-h3   { font-size: 1rem; font-weight: 700; color: #374151; }
.block-text { font-size: 0.875rem; color: #374151; line-height: 1.75; }
.block-bullet { font-size: 0.875rem; color: #374151; padding-left: 1.2rem; position: relative; }
.block-bullet:before { content: '•'; position: absolute; left: 0; color: #6b7280; }
.block-quote {
  font-size: 0.875rem; color: #6b7280; font-style: italic;
  border-left: 3px solid #a5b4fc; padding-left: 14px;
  background: #eef2ff; border-radius: 0 8px 8px 0; padding: 6px 14px; margin: 2px 0;
}
.block-divider { width: 100%; border: none; border-top: 2px solid #e5e7eb; margin: 8px 0; }

/* 저장 인디케이터 */
.block-save-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #10b981;
  transition: opacity .3s;
}

/* 슬래시 메뉴 */
#slash-menu { max-height: 320px; overflow-y: auto; }
.slash-menu-item.active { background: #eef2ff; }