/* Denticle — 커뮤니티 CSS */

/* ── 카테고리 탭 ── */
.community-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 0;
}

.community-tab {
  padding: 8px 16px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  white-space: nowrap;
}
.community-tab:hover { color: var(--color-primary); }
.community-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ── 게시글 리스트 ── */
.post-list { display: flex; flex-direction: column; gap: 0; }

.post-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  text-decoration: none;
  color: var(--color-text);
  transition: background var(--transition);
}
.post-item:hover { background: var(--color-bg); margin: 0 -12px; padding: 16px 12px; border-radius: var(--radius-sm); }
.post-item.pinned { background: #FEF2F2; border-left: 3px solid #EF4444; margin: 0 -12px; padding: 16px 12px; border-radius: var(--radius-sm); }
[data-theme="dark"] .post-item.pinned { background: rgba(239,68,68,0.08); }

.post-item-main { flex: 1; min-width: 0; }

.post-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.category-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  white-space: nowrap;
}
.cat-general  { background: #F3F4F6; color: #6B7280; }
.cat-technique { background: #EFF6FF; color: #1D4ED8; }
.cat-case     { background: #F0FDF4; color: #15803D; }
.cat-qna      { background: #FFF7ED; color: #C2410C; }
.cat-news     { background: #FDF4FF; color: #7E22CE; }
.cat-tip      { background: #ECFDF5; color: #065F46; }

.post-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-item-title.pin-icon::before {
  content: '📌 ';
}

.post-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 6px;
  flex-wrap: wrap;
}

.post-meta-author {
  display: flex;
  align-items: center;
  gap: 5px;
}

.post-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 5px;
}
.tag-chip {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.tag-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }

.post-item-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--color-text-secondary);
}
.stat-row { display: flex; gap: 10px; }

/* ── 게시글 작성/수정 ── */
.community-write-layout { max-width: 760px; margin: 0 auto; }

.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  min-height: 44px;
  cursor: text;
  align-items: center;
}
.tag-input-wrap:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary-light); }
.tag-input-wrap input {
  border: none; outline: none; background: none;
  font-size: 14px; min-width: 80px; flex: 1;
}
.tag-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px;
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary);
  border-radius: 100px;
  font-size: 12px; color: var(--color-primary);
  white-space: nowrap;
}
.tag-badge-remove { cursor: pointer; opacity: 0.6; font-size: 14px; line-height: 1; }
.tag-badge-remove:hover { opacity: 1; }

.md-editor-wrap { position: relative; }
.md-toolbar {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--color-bg);
  flex-wrap: wrap;
}
.md-tool-btn {
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-surface);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all var(--transition);
}
.md-tool-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }

.md-textarea {
  border-radius: 0 !important;
  border-bottom: none !important;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 14px;
  resize: vertical;
  min-height: 300px;
}

/* 이미지 프리뷰 스트립 */
.image-preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-top: 1px dashed var(--color-border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--color-bg);
}
.img-preview-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
  cursor: default;
  transition: transform 0.15s;
}
.img-preview-thumb:hover { transform: scale(1.04); }
.img-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.img-preview-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  line-height: 1;
  padding: 0;
}
.img-preview-thumb:hover .img-preview-remove { opacity: 1; }
.img-preview-remove:hover { background: rgba(220,38,38,0.85); }

.md-preview {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  min-height: 300px;
  line-height: 1.8;
  font-size: 15px;
  background: var(--color-surface);
}
.md-preview h1 { font-size: 22px; font-weight: 800; margin: 16px 0 8px; }
.md-preview h2 { font-size: 18px; font-weight: 700; margin: 14px 0 6px; }
.md-preview h3 { font-size: 16px; font-weight: 600; margin: 12px 0 4px; }
.md-preview p  { margin: 0 0 12px; }
.md-preview ul { padding-left: 20px; margin-bottom: 12px; }
.md-preview li { margin-bottom: 4px; }
.md-preview blockquote {
  border-left: 3px solid var(--color-primary);
  padding: 6px 14px;
  background: var(--color-primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 10px 0;
  color: var(--color-text-secondary);
}
.md-preview code {
  background: #1E1E2E;
  color: #CDD6F4;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'Consolas', monospace;
}
.md-preview pre {
  background: #1E1E2E;
  color: #CDD6F4;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 10px 0;
}
.md-preview pre code { background: none; padding: 0; }
.md-preview a { color: var(--color-primary); text-decoration: underline; }
.md-preview img { max-width: 100%; border-radius: 6px; }
.md-preview hr { border: none; border-top: 1px solid var(--color-border); margin: 16px 0; }

.editor-tabs { display: flex; gap: 0; margin-bottom: 0; }
.editor-tab {
  padding: 6px 16px;
  border: 1px solid var(--color-border);
  border-bottom: none;
  background: var(--color-bg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all var(--transition);
}
.editor-tab:first-child { border-radius: var(--radius-sm) 0 0 0; }
.editor-tab:last-child { border-radius: 0 var(--radius-sm) 0 0; border-left: none; }
.editor-tab.active { background: var(--color-surface); color: var(--color-primary); }

/* ── 게시글 상세 ── */
.post-detail-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 1024px) { .post-detail-layout { grid-template-columns: 1fr; } }

.post-detail-header {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 20px;
  margin-bottom: 24px;
}
.post-detail-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.4;
  margin: 12px 0;
  color: var(--color-text);
}
.post-detail-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--color-text-secondary);
  flex-wrap: wrap;
}
.post-detail-author {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--color-text-secondary);
}
.post-detail-author:hover { color: var(--color-primary); }

.post-content {
  line-height: 1.8;
  font-size: 15px;
  color: var(--color-text);
  margin-bottom: 24px;
}
.post-content h1 { font-size: 22px; font-weight: 800; margin: 20px 0 10px; }
.post-content h2 { font-size: 18px; font-weight: 700; margin: 16px 0 8px; }
.post-content h3 { font-size: 16px; font-weight: 600; margin: 12px 0 6px; }
.post-content p  { margin: 0 0 14px; }
.post-content ul { padding-left: 22px; margin-bottom: 14px; }
.post-content li { margin-bottom: 5px; }
.post-content blockquote {
  border-left: 3px solid var(--color-primary);
  padding: 8px 16px;
  background: var(--color-primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 12px 0;
  color: var(--color-text-secondary);
}
.post-content code {
  background: #1E1E2E;
  color: #CDD6F4;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'Consolas', monospace;
}
.post-content pre {
  background: #1E1E2E;
  color: #CDD6F4;
  padding: 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 14px 0;
}
.post-content pre code { background: none; padding: 0; }
.post-content a { color: var(--color-primary); text-decoration: underline; }
.post-content img { max-width: 100%; border-radius: 6px; margin: 10px 0; }
.post-content hr { border: none; border-top: 1px solid var(--color-border); margin: 20px 0; }

.post-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 32px;
}

.star-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 100px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.star-btn:hover { border-color: #F59E0B; color: #F59E0B; }
.star-btn.starred { background: #FFFBEB; border-color: #F59E0B; color: #D97706; }

/* ── 댓글 ── */
.comments-section { margin-top: 24px; }
.comments-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }

.comment-form {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  align-items: flex-start;
}
.comment-form textarea {
  flex: 1;
  min-height: 80px;
  resize: vertical;
}

.comment-list { display: flex; flex-direction: column; gap: 0; }

.comment-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}
.comment-item.reply {
  padding-left: 40px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 12px 12px 12px 40px;
  margin-top: 6px;
  border-bottom: none;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.comment-author {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 600;
  font-size: 13px;
}
.comment-time { font-size: 12px; color: var(--color-text-secondary); }
.comment-content {
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text);
  margin-bottom: 8px;
  white-space: pre-wrap;
}
.comment-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.comment-action-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all var(--transition);
}
.comment-action-btn:hover { background: var(--color-bg); color: var(--color-primary); }
.comment-action-btn.starred { color: #D97706; }

.reply-form-wrap {
  margin-top: 10px;
  padding-left: 40px;
}
.reply-form {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.reply-form textarea { flex: 1; min-height: 60px; resize: none; font-size: 13px; }

/* ── 사이드바 ── */
.community-sidebar {
  position: sticky;
  top: 80px;
}
.author-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
}
.author-card-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
  overflow: hidden;
  margin: 0 auto 10px;
}
.author-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-card-name { font-weight: 700; margin-bottom: 4px; }
.author-card-bio { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 12px; }

.related-posts { margin-top: 20px; }
.related-post-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
}
.related-post-item:hover { color: var(--color-primary); }
.related-post-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

/* ── 멘션 자동완성 ── */
.mention-dropdown {
  position: absolute; bottom: 100%; left: 0; z-index: 20;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  max-height: 200px; overflow-y: auto; min-width: 180px;
}
.mention-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 12px; border: none; background: none;
  font-size: 13px; cursor: pointer; color: var(--color-text);
  transition: background var(--transition); text-align: left;
}
.mention-item:hover { background: var(--color-bg); }

/* ── 잠금 게시글 ── */
.post-locked {
  opacity: 0.5; cursor: default;
}
.post-locked:hover { background: none; margin: 0; padding: 16px 0; }

/* ── 직군 필터 ── */
.role-filter-btn {
  padding: 6px 14px; border: 1.5px solid var(--color-border); border-radius: 100px;
  background: var(--color-surface); font-size: 13px; font-weight: 600;
  color: var(--color-text-secondary); cursor: pointer; transition: all var(--transition);
}
.role-filter-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.role-filter-btn.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ── 정렬/검색 바 ── */
.community-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── 댓글 속 커튼 임베드 ── */
.comment-curtain-embed {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  margin: 8px 0 4px;
  transition: all var(--transition);
}
.comment-curtain-embed:hover {
  box-shadow: 0 2px 8px rgba(27,111,168,0.12);
  transform: translateY(-1px);
}
.comment-curtain-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.comment-curtain-thumb-ph {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.comment-curtain-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.comment-curtain-title {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text);
}
.comment-curtain-stars {
  font-size: 11px;
  color: var(--color-text-secondary);
}
.comment-curtain-cta {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
  white-space: nowrap;
}
.comment-curtain-loading {
  font-size: 12px;
  color: var(--color-text-secondary);
  padding: 4px 0;
}
.comment-curtain-missing {
  font-size: 12px;
  color: var(--color-text-secondary);
  padding: 4px 0;
}

/* ── 커튼 첨부 피커 (글쓰기) ── */
.curtain-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: var(--color-bg);
}
.curtain-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.curtain-picker-item:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.curtain-picker-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.curtain-picker-thumb-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.curtain-picker-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.curtain-picker-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.curtain-picker-stars {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* 첨부된 커튼 미리보기 (글쓰기) */
.curtain-link-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  margin-top: 8px;
}
.curtain-link-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.curtain-link-thumb-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.curtain-link-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.curtain-link-title {
  font-size: 14px;
  font-weight: 700;
}
.curtain-link-stars {
  font-size: 12px;
  color: var(--color-text-secondary);
}
.curtain-link-remove {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  transition: all var(--transition);
  flex-shrink: 0;
}
.curtain-link-remove:hover {
  background: rgba(239,68,68,0.1);
  color: var(--color-error);
}

/* 링크된 커튼 카드 (게시글 상세) */
.linked-curtain-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  cursor: pointer;
  margin-bottom: 20px;
  transition: all var(--transition);
}
.linked-curtain-card:hover {
  box-shadow: 0 2px 12px rgba(27,111,168,0.15);
  transform: translateY(-1px);
}
.linked-curtain-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.linked-curtain-thumb-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}
.linked-curtain-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.linked-curtain-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.linked-curtain-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.linked-curtain-stars {
  font-size: 12px;
  color: var(--color-text-secondary);
}
.linked-curtain-cta {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
  white-space: nowrap;
}

/* 목록에서 커튼 첨부 뱃지 */
.post-linked-curtain-badge {
  font-size: 11px;
  color: var(--color-primary);
  font-weight: 600;
  margin-top: 4px;
}

/* ── 반응형 ── */
@media (max-width: 768px) {
  .community-tabs { gap: 2px; }
  .community-tab { padding: 6px 10px; font-size: 12px; }
  .post-item { gap: 10px; }
  .post-detail-title { font-size: 18px; }
  .reply-form-wrap { padding-left: 16px; }
  .comment-item.reply { padding-left: 20px; }
  .linked-curtain-card { padding: 10px 12px; gap: 10px; }
  .linked-curtain-thumb, .linked-curtain-thumb-placeholder { width: 56px; height: 56px; }
  .linked-curtain-title { font-size: 14px; }
}

/* ── 팔로우 모달 ── */
.follow-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.follow-modal {
  background: var(--color-surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 400px; max-height: 70vh; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.follow-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--color-border);
}
.follow-modal-header h3 { font-size: 16px; font-weight: 700; }
.follow-modal-body { overflow-y: auto; max-height: 50vh; }
.follow-modal-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; text-decoration: none; color: var(--color-text);
  transition: background var(--transition);
}
.follow-modal-item:hover { background: var(--color-bg); }

/* ── 메시지 레이아웃 ── */
.messages-layout {
  display: grid; grid-template-columns: 300px 1fr;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  overflow: hidden; height: 75vh; max-height: 75vh; background: var(--color-surface);
}
.msg-sidebar {
  border-right: 1px solid var(--color-border); overflow-y: auto;
}
.msg-sidebar-header {
  padding: 12px 16px; border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
}
.msg-sidebar-header h3 { font-size: 16px; font-weight: 700; }
.msg-open-chat-entry {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; cursor: pointer;
  border-bottom: 2px solid var(--color-primary);
  background: var(--color-primary-light);
  transition: background var(--transition);
}
.msg-open-chat-entry:hover { background: var(--color-bg); }
.msg-open-chat-entry.active { background: var(--color-primary-light); border-bottom-color: var(--color-primary); }
.msg-privacy-toggle {
  padding: 10px 16px; border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}
.msg-conv-list { display: flex; flex-direction: column; }
.msg-conv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; cursor: pointer; transition: background var(--transition);
  border-bottom: 1px solid var(--color-border);
}
.msg-conv-item:hover { background: var(--color-bg); }
.msg-conv-item.active { background: var(--color-primary-light); }
.msg-conv-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.msg-conv-info { flex: 1; min-width: 0; }
.msg-conv-name { font-size: 14px; font-weight: 600; }
.msg-conv-preview {
  font-size: 12px; color: var(--color-text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.msg-unread-badge {
  background: var(--color-primary); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 100px; flex-shrink: 0;
}
.msg-read-status {
  font-size: 10px; color: var(--color-text); font-weight: 600; margin-left: 4px;
}
.msg-read-status.read {
  color: var(--color-primary); font-weight: 400;
}

/* 토글 스위치 */
.toggle-switch {
  position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: #ccc; border-radius: 24px; cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 20px; height: 20px; background: #fff; border-radius: 50%;
  transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
/* 오픈채팅 라이브 점 */
.oc-live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; flex-shrink: 0;
  animation: oc-blink 2s ease-in-out infinite;
}
@keyframes oc-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.toggle-switch input:checked + .toggle-slider { background: var(--color-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

.msg-menu-dropdown {
  position: absolute; right: 0; top: 100%; z-index: 10;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  min-width: 140px; overflow: hidden;
}
.msg-menu-dropdown button {
  display: block; width: 100%; text-align: left; padding: 10px 14px;
  border: none; background: none; font-size: 13px; cursor: pointer;
  color: var(--color-text); transition: background var(--transition);
}
.msg-menu-dropdown button:hover { background: var(--color-bg); }
.msg-chat { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.msg-chat-open { background: #F0F9FF; }
[data-theme="dark"] .msg-chat-open { background: rgba(59,130,246,0.06); }
.msg-chat-open .msg-chat-messages { background: transparent; }
.msg-chat-header {
  padding: 16px 20px; border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 10px;
}
.msg-chat-partner {
  font-size: 15px; font-weight: 700; text-decoration: none; color: var(--color-text); cursor: pointer;
}
.msg-chat-partner:hover { color: var(--color-primary); text-decoration: underline; }
.msg-chat-messages {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.msg-bubble { max-width: 70%; padding: 10px 14px; border-radius: 16px; }
.msg-mine {
  align-self: flex-end;
  background: var(--color-primary); color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-theirs {
  align-self: flex-start;
  background: var(--color-bg); color: var(--color-text);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 4px;
}
.msg-bubble-content {
  font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.msg-bubble-time {
  font-size: 10px; margin-top: 4px; opacity: 0.7;
}
.msg-mine .msg-bubble-time { text-align: right; }
.msg-chat-input {
  padding: 12px 20px; border-top: 1px solid var(--color-border);
  display: flex; gap: 8px; align-items: flex-end;
}
.msg-chat-input textarea {
  flex: 1; resize: none; min-height: 40px; max-height: 100px;
  font-size: 14px;
}
.msg-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--color-text-secondary); font-size: 14px;
}

/* 메시지 새 대화 피커 */
.msg-picker-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.msg-picker-modal {
  background: var(--color-surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 400px; max-height: 70vh; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.msg-picker-body { overflow-y: auto; max-height: 50vh; }
.msg-picker-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; width: 100%; border: none; background: none;
  cursor: pointer; transition: background var(--transition);
  text-align: left; color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}
.msg-picker-item:hover { background: var(--color-bg); }

/* 멘션 하이라이트 */
.mention-link {
  color: #E08A00; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
[data-theme="dark"] .mention-link { color: #F5B731; }
.mention-link:hover { text-decoration: underline; }
/* 내 메시지(파란 배경) 안의 멘션은 밝은 노란색 */
.msg-mine .mention-link { color: #FFD66B; }
[data-theme="dark"] .msg-mine .mention-link { color: #FFD66B; }

@media (max-width: 768px) {
  /* 메시지 페이지: 패딩 제거 */
  .page-layout:has(.messages-layout) { padding: 0; }
  /* 메시지: 사이드바↔채팅 전환 방식 */
  .messages-layout {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 60px);
    height: calc(100vh - 60px);
    border: none; border-radius: 0;
  }
  .msg-sidebar {
    border-right: none;
    overflow-y: auto;
    height: 100%;
  }
  /* 채팅 열리면 사이드바 숨기고 채팅만 표시 */
  .messages-layout.chat-active .msg-sidebar { display: none; }
  .messages-layout:not(.chat-active) .msg-chat { display: none; }
  .msg-chat {
    height: 100%;
    min-height: 0;
  }
  .msg-chat-messages { padding: 12px; flex: 1; min-height: 0; }
  .msg-bubble { max-width: 85%; }
  .msg-bubble-content { font-size: 14px; }
  .msg-chat-input {
    padding: 8px 12px;
    position: sticky; bottom: 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
  }
  .msg-chat-input textarea { min-height: 36px; font-size: 15px; }
  .msg-chat-header {
    padding: 10px 12px; font-size: 13px;
    position: sticky; top: 0; z-index: 5;
    background: var(--color-surface);
  }
  .msg-sidebar-header { padding: 10px 12px; }
  .msg-sidebar-header h3 { font-size: 15px; }
  .msg-conv-item { padding: 12px 14px; }
  .msg-conv-avatar { width: 36px; height: 36px; font-size: 14px; }
  .msg-conv-name { font-size: 14px; }
  .msg-open-chat-entry { padding: 8px 12px; border-bottom-width: 1px; }
  .msg-privacy-toggle { padding: 8px 14px; }
  .follow-modal, .dash-follow-modal, .msg-picker-modal, .bc-popup { max-width: calc(100vw - 32px); max-height: 85vh; }
  .follow-modal-body, .dash-follow-body, .msg-picker-body { max-height: 60vh; }
}
@media (max-width: 480px) {
  .msg-bubble { max-width: 90%; }
  .msg-bubble-content { font-size: 13px; }
  .msg-chat-header { padding: 8px 10px; font-size: 12px; }
  .msg-chat-input textarea { font-size: 14px; }
  .post-item { padding: 12px 0; }
  .post-item-title { font-size: 14px; }
  .post-item-meta { font-size: 11px; gap: 8px; }
  /* 카테고리 탭 모바일 */
  #cat-tabs .btn-sm { font-size: 11px; padding: 3px 8px; }
  /* 커뮤니티 툴바 모바일 */
  .community-toolbar { flex-direction: column; gap: 8px; }
  .community-toolbar .sort-group { width: 100%; }
  .community-toolbar .market-search-wrap { max-width: 100% !important; }
}

@media (max-width: 400px) {
  .msg-chat-header { gap: 4px; }
  #oc-block-list-btn { font-size: 10px; padding: 2px 6px; }
  .toggle-switch { width: 38px; height: 20px; }
  .toggle-slider::before { width: 16px; height: 16px; }
  .toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
}

/* ── 공지 팝업 ── */
.bc-popup-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.bc-popup {
  background: var(--color-surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 520px; max-height: 80vh; overflow-y: auto;
  padding: 24px; box-shadow: var(--shadow-lg);
}
.bc-popup-post {
  display: block; padding: 14px; border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-md); background: var(--color-primary-light);
  text-decoration: none; color: var(--color-text);
  transition: all var(--transition);
}
.bc-popup-post:hover { box-shadow: 0 2px 8px rgba(27,111,168,0.15); }

/* ── 다크 모드 오버라이드 ── */
[data-theme="dark"] .cat-general  { background: #374151; color: #9CA3AF; }
[data-theme="dark"] .cat-technique { background: #1E3A5F; color: #60A5FA; }
[data-theme="dark"] .cat-case     { background: #14532D; color: #4ADE80; }
[data-theme="dark"] .cat-qna      { background: #431407; color: #FB923C; }
[data-theme="dark"] .cat-news     { background: #3B0764; color: #C084FC; }
[data-theme="dark"] .cat-tip      { background: #064E3B; color: #34D399; }
[data-theme="dark"] .star-btn.starred { background: rgba(245,158,11,0.15); }
[data-theme="dark"] .community-tab.active,
[data-theme="dark"] .community-tab:hover { background: var(--color-primary-light); color: var(--color-primary); }
[data-theme="dark"] .sort-btn.active,
[data-theme="dark"] .sort-btn:hover { background: var(--color-primary-light); color: var(--color-primary); }
