/* @task S3F11 */
/* ========================================================
   community.css — 봇마당 커뮤니티 스타일시트
   Task: S3F11 | Stage: S3 | Area: F
   ======================================================== */

/* PERFORMANCE NOTE: @import blocks rendering because the browser must finish downloading this CSS
   file before it can even start fetching the font. For better performance, move this font request
   to a <link rel="stylesheet"> tag in the HTML <head> (already present in index.html as a <link>),
   and remove this @import entirely. */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

/* ===== 디자인 토큰 ===== */
:root {
  --primary: #6C5CE7;
  --primary-light: #a29bfe;
  --primary-dark: #5a4bd1;
  --secondary: #00CEC9;
  --secondary-light: #81ecec;
  --like-active: #FF6B6B;
  --like-inactive: rgba(255,255,255,0.35);

  --bg: #0d0d12;
  --surface: #16161c;
  --surface-2: #1c1c24;
  --surface-3: #22222c;
  --border: rgba(255,255,255,0.07);
  --border-2: rgba(255,255,255,0.12);

  --text: #f1f5f9;
  --text-muted: rgba(255,255,255,0.55);
  --text-faint: rgba(255,255,255,0.3);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);

  --sidebar-width: 260px;
  --header-height: 64px;
  --content-max: 900px;
}

/* ===== 리셋 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans KR', 'Malgun Gothic', '맑은 고딕', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; }

/* ===== 레이아웃 ===== */
.app-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ===== 사이드바 ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 2rem 1.5rem;
  position: fixed;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 50;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  color: var(--primary-light);
  font-size: 1.1rem;
  font-weight: 700;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.sidebar-nav { flex: 1; }

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 0.5rem;
  margin-bottom: 0.5rem;
  margin-top: 1.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 0.125rem;
}

.nav-item:hover {
  background: rgba(108,92,231,0.12);
  color: var(--text);
}

.nav-item.active {
  background: rgba(108,92,231,0.2);
  color: var(--primary-light);
}

.nav-item .nav-icon { font-size: 1rem; width: 18px; text-align: center; }

/* ===== 메인 콘텐츠 ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== 헤더 ===== */
.top-header {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.25rem;
  padding: 0.25rem;
}

.page-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-write-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.15s;
}

.btn-write-header:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  border: 2px solid var(--border-2);
}

/* ===== 페이지 콘텐츠 ===== */
.page-content {
  flex: 1;
  padding: 2rem;
  max-width: calc(var(--content-max) + 4rem);
  width: 100%;
  margin: 0 auto;
}

/* ===== 커뮤니티 헤더 ===== */
.community-header {
  margin-bottom: 1.5rem;
}

.community-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.community-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== 카테고리 탭 ===== */
.category-nav {
  display: flex;
  gap: 0.375rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.375rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-nav::-webkit-scrollbar { display: none; }

.category-tab {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s;
  cursor: pointer;
}

.category-tab:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.category-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 600;
}

.category-tab .cat-count {
  background: rgba(255,255,255,0.15);
  border-radius: 99px;
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 700;
}

.category-tab.active .cat-count {
  background: rgba(255,255,255,0.25);
}

/* ===== 툴바 (정렬 + 검색) ===== */
.posts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.sort-group {
  display: flex;
  gap: 0.375rem;
}

.sort-btn {
  padding: 0.4rem 0.875rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s;
}

.sort-btn:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}

.sort-btn.active {
  background: rgba(108,92,231,0.15);
  border-color: var(--primary);
  color: var(--primary-light);
  font-weight: 600;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.875rem;
  transition: border-color 0.2s;
}

.search-box:focus-within {
  border-color: var(--primary);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.875rem;
  width: 180px;
}

.search-box input::placeholder { color: var(--text-faint); }

.search-box button {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  font-size: 0.875rem;
}

/* ===== 게시글 목록 ===== */
.posts-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.posts-list-header {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  cursor: pointer;
}

.post-item:last-child { border-bottom: none; }

.post-item:hover {
  background: rgba(255,255,255,0.03);
}

.post-title-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.post-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.post-category-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-free      { background: rgba(108,92,231,0.2); color: var(--primary-light); }
.badge-showcase  { background: rgba(0,206,201,0.2);  color: var(--secondary); }
.badge-tip       { background: rgba(253,203,110,0.2); color: #fdcb6e; }
.badge-qna       { background: rgba(253,121,168,0.2); color: #fd79a8; }
.badge-notice    { background: rgba(255,107,107,0.2); color: #ff7675; }

.post-title-text {
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-comment-count {
  color: var(--secondary);
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.post-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-faint);
}

.post-author-name { color: var(--text-muted); font-weight: 500; }

.post-stat {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.post-stat-icon {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.post-stat-icon.liked { color: var(--like-active); }

.post-date-cell {
  font-size: 0.8rem;
  color: var(--text-faint);
  text-align: right;
  white-space: nowrap;
}

/* 고정 공지 아이템 */
.post-item.pinned {
  background: rgba(108,92,231,0.05);
}

.pin-icon {
  font-size: 0.7rem;
  color: var(--primary-light);
}

/* 빈 목록 */
.posts-empty {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

.posts-empty .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.posts-empty p { font-size: 0.925rem; }

/* ===== 페이지네이션 ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  margin-top: 2rem;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-light);
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-ellipsis {
  color: var(--text-faint);
  font-size: 0.875rem;
  padding: 0 0.25rem;
}

/* ===== 게시글 상세 ===== */
.post-detail-container {
  max-width: var(--content-max);
  margin: 0 auto;
}

.post-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  transition: color 0.2s;
  background: none;
  border: none;
}

.post-detail-back:hover { color: var(--primary-light); }

.post-detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.post-detail-header {
  padding: 1.75rem 2rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.post-detail-category {
  margin-bottom: 0.75rem;
}

.post-detail-title {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 1.25rem;
  word-break: keep-all;
}

.post-detail-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.post-author-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.post-author-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.post-author-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.post-author-details { display: flex; flex-direction: column; }

.post-author-nickname {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.post-detail-date {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.post-detail-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-detail-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* 게시글 본문 */
.post-detail-body {
  padding: 2rem;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text);
  min-height: 200px;
  word-break: keep-all;
}

.post-detail-body p { margin-bottom: 1rem; }
.post-detail-body p:last-child { margin-bottom: 0; }

/* 게시글 액션 바 */
.post-actions-bar {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.post-left-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.post-right-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 좋아요 버튼 */
.btn-like {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-xl);
  border: 1.5px solid var(--like-inactive);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-like:hover {
  border-color: var(--like-active);
  color: var(--like-active);
  background: rgba(255,107,107,0.08);
}

.btn-like.active {
  border-color: var(--like-active);
  background: rgba(255,107,107,0.12);
  color: var(--like-active);
}

.btn-like .like-icon { font-size: 1.1rem; transition: transform 0.2s; }
.btn-like.active .like-icon { transform: scale(1.2); }

/* 수정/삭제/신고 버튼 */
.btn-post-action {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.45rem 0.875rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-post-action:hover {
  border-color: var(--border-2);
  color: var(--text);
}

.btn-post-action.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239,68,68,0.08);
}

/* ===== 댓글 영역 ===== */
.comments-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.comments-header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.comments-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.comment-count-badge {
  background: rgba(108,92,231,0.2);
  color: var(--primary-light);
  border-radius: 99px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.comments-list {
  padding: 0;
}

/* 댓글 아이템 */
.comment-item {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.comment-item:last-child { border-bottom: none; }

.comment-item:hover { background: rgba(255,255,255,0.02); }

/* 대댓글 들여쓰기 */
.comment-item.reply {
  padding-left: 3.5rem;
  background: rgba(0,0,0,0.15);
  border-left: none;
  position: relative;
}

.comment-item.reply::before {
  content: '';
  position: absolute;
  left: 2rem;
  top: 1.5rem;
  width: 20px;
  height: 1px;
  background: var(--border-2);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.comment-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.comment-author {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.comment-date {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.comment-actions {
  margin-left: auto;
  display: flex;
  gap: 0.375rem;
}

.comment-action-btn {
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-faint);
  font-size: 0.75rem;
  transition: all 0.2s;
}

.comment-action-btn:hover {
  border-color: var(--border);
  color: var(--text-muted);
  background: var(--surface-2);
}

.comment-action-btn.reply-btn:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.comment-action-btn.delete-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.comment-body {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
  padding-left: 2.5rem;
  word-break: keep-all;
}

.comment-body.deleted {
  color: var(--text-faint);
  font-style: italic;
}

/* 댓글 좋아요 */
.comment-footer {
  padding-left: 2.5rem;
  margin-top: 0.625rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-comment-like {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 0.78rem;
  transition: color 0.2s;
}

.btn-comment-like:hover { color: var(--like-active); }
.btn-comment-like.active { color: var(--like-active); }

/* 대댓글 작성 폼 (인라인) */
.reply-form {
  margin-top: 0.75rem;
  padding-left: 2.5rem;
  display: none;
}

.reply-form.visible { display: block; }

.reply-form textarea {
  width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  color: var(--text);
  font-size: 0.875rem;
  resize: none;
  min-height: 72px;
  transition: border-color 0.2s;
}

.reply-form textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.reply-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* 댓글 작성 폼 */
.comment-write-form {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.comment-write-form h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.comment-write-body {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.comment-write-body .comment-avatar {
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.comment-textarea-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comment-textarea {
  width: 100%;
  background: var(--surface-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  resize: none;
  min-height: 90px;
  transition: border-color 0.2s;
  line-height: 1.6;
}

.comment-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.comment-textarea::placeholder { color: var(--text-faint); }

.comment-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.comment-char-count {
  font-size: 0.75rem;
  color: var(--text-faint);
}

/* ===== 버튼 공통 ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.15s;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--border-2);
  color: var(--text);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* ===== 게시글 작성/수정 폼 ===== */
.write-form-container {
  max-width: 780px;
  margin: 0 auto;
}

.write-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.write-form-header {
  margin-bottom: 1.75rem;
}

.write-form-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.write-form-group {
  margin-bottom: 1.25rem;
}

.write-form-group label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.write-form-group label .required {
  color: var(--danger);
  margin-left: 0.2rem;
}

.write-input,
.write-select {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.write-input:focus,
.write-select:focus {
  outline: none;
  border-color: var(--primary);
}

.write-input::placeholder { color: var(--text-faint); }

.write-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23aaa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  cursor: pointer;
}

.write-select option { background: var(--surface-2); }

.write-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  color: var(--text);
  font-size: 0.9rem;
  resize: vertical;
  min-height: 300px;
  line-height: 1.7;
  transition: border-color 0.2s;
}

.write-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.write-textarea::placeholder { color: var(--text-faint); }

/* 제목 글자 수 */
.input-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 0.35rem;
}

/* 이미지 첨부 */
.image-upload-area {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface-2);
}

.image-upload-area:hover {
  border-color: var(--primary);
  background: rgba(108,92,231,0.05);
}

.image-upload-area .upload-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.image-upload-area p {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.image-upload-area span {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.image-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.image-preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  border: none;
  color: white;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* 폼 액션 */
.write-form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
}

/* ===== 갤러리 ===== */
.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.gallery-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: var(--shadow-sm);
}

.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-2);
}

.gallery-card-thumb {
  width: 100%;
  height: 180px;
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.gallery-card:hover .gallery-card-thumb img {
  transform: scale(1.04);
}

.gallery-bot-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.gallery-card-body {
  padding: 1rem 1.125rem;
}

.gallery-card-name {
  font-size: 0.975rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.gallery-card-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.875rem;
}

.gallery-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gallery-card-author {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.gallery-card-author .mini-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  color: white;
}

.gallery-card-likes {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.825rem;
  color: var(--text-muted);
}

.gallery-card-likes.liked { color: var(--like-active); }

/* ===== 갤러리 모달 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s;
  box-shadow: var(--shadow-lg);
}

.modal-overlay.visible .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.modal-body { padding: 1.5rem; }

.modal-bot-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.modal-bot-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--border-2);
}

.modal-bot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-bot-info h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.modal-bot-info p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.modal-bot-desc {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  word-break: keep-all;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* 신고 모달 */
.report-modal .modal-content {
  max-width: 420px;
}

.report-form { display: flex; flex-direction: column; gap: 1rem; }

.report-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.report-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.report-option:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
}

.report-option input[type="radio"] { accent-color: var(--primary); }

.report-option label {
  font-size: 0.875rem;
  cursor: pointer;
}

.report-detail-textarea {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  color: var(--text);
  font-size: 0.875rem;
  resize: none;
  min-height: 80px;
  width: 100%;
  transition: border-color 0.2s;
}

.report-detail-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* ===== 로딩 스피너 ===== */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
  gap: 0.75rem;
  font-size: 0.9rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 토스트 알림 ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  transform: translateX(110%);
  transition: transform 0.3s cubic-bezier(.25,.8,.25,1);
  pointer-events: all;
  max-width: 320px;
}

.toast.visible { transform: translateX(0); }

.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.info    .toast-icon { color: var(--primary-light); }

/* ===== 반응형 ===== */

/* 태블릿 (≤ 1024px) */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 49;
    display: none;
  }
  .sidebar-overlay.visible { display: block; }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

/* 모바일 (≤ 768px) */
@media (max-width: 768px) {
  .page-content { padding: 1rem; }

  .posts-list-header { display: none; }

  .post-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .post-stat, .post-date-cell {
    display: none;
  }

  .post-meta-row {
    flex-wrap: wrap;
  }

  .community-header h1 { font-size: 1.25rem; }

  .post-detail-header { padding: 1.25rem 1rem; }
  .post-detail-title { font-size: 1.15rem; }
  .post-detail-body { padding: 1.25rem 1rem; }
  .post-actions-bar { padding: 1rem; }

  .comment-item { padding: 1rem; }
  .comment-item.reply { padding-left: 2rem; }
  .comment-write-form { padding: 1rem; }

  .write-form-card { padding: 1.25rem; }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
  }

  .gallery-card-thumb { height: 140px; }

  .posts-toolbar { flex-direction: column; align-items: stretch; }
  .search-box input { width: 100%; }

  .modal-content { max-height: 100svh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }

  .write-form-actions { flex-direction: column-reverse; }
  .write-form-actions .btn-primary,
  .write-form-actions .btn-secondary { width: 100%; justify-content: center; }
}

/* 소형 모바일 (≤ 480px) */
@media (max-width: 480px) {
  .category-nav { gap: 0.25rem; padding: 0.25rem; }
  .category-tab { padding: 0.4rem 0.625rem; font-size: 0.8rem; }
  .gallery-grid { grid-template-columns: 1fr; }
}
