/* ══════════════════════════════════════════
   community.css - 바로자금 커뮤니티 스타일
   ══════════════════════════════════════════ */

/* ── 레이아웃 ── */
.community-page { padding-top: 80px; min-height: 100vh; background: var(--gray-50); }

.community-layout {
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 20px;
}

@media (max-width: 1024px) {
  .community-layout { grid-template-columns: 1fr; }
  .community-sidebar-left { display: none; }
}

@media (max-width: 768px) {
  .community-layout { padding: 16px 12px; gap: 16px; }
}

/* ── 탭 네비게이션 (상단) ── */
.community-tabs {
  display: flex;
  gap: 0;
  background: white;
  border-bottom: 2px solid var(--gray-200);
  padding: 0 20px;
  max-width: 1280px;
  margin: 0 auto;
  overflow-x: auto;
}

.community-tab {
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.community-tab:hover { color: var(--primary); }
.community-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── 사이드바 왼쪽 (카테고리) ── */
.community-sidebar-left {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.sidebar-card {
  background: white;
  border-radius: 16px;
  border: 1px solid var(--gray-200);
  padding: 20px;
  margin-bottom: 16px;
}

.sidebar-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.category-list { list-style: none; padding: 0; margin: 0; }

.category-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
  transition: all 0.15s;
}

.category-item:hover { background: var(--gray-100); color: var(--gray-900); }
.category-item.active { background: rgba(26,86,219,0.08); color: var(--primary); font-weight: 700; }
.category-item .cat-icon { font-size: 18px; width: 24px; text-align: center; }
.category-item .cat-count {
  margin-left: auto;
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
}

/* ── 메인 콘텐츠 ── */
.community-main {}

/* 상단 컨트롤 바 */
.community-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.community-search {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 0 16px;
  flex: 1;
  max-width: 400px;
  transition: border-color 0.2s;
}

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

.community-search input {
  border: none;
  outline: none;
  padding: 10px 0;
  font-size: 14px;
  width: 100%;
  background: transparent;
}

.community-search .search-icon { color: var(--gray-400); font-size: 16px; }

.sort-select {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  background: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.btn-write {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-write:hover { background: var(--primary-dark); transform: translateY(-1px); }

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

.post-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  padding: 20px 24px;
  cursor: pointer;
  transition: all 0.2s;
}

.post-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(26,86,219,0.08);
  transform: translateY(-1px);
}

.post-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.post-category-badge {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.post-category-badge.cat-free { background: #e3f2fd; color: #1565c0; }
.post-category-badge.cat-info { background: #e8f5e9; color: #2e7d32; }
.post-category-badge.cat-review { background: #fff3e0; color: #e65100; }
.post-category-badge.cat-qna { background: #f3e5f5; color: #7b1fa2; }

.post-author { font-size: 13px; color: var(--gray-500); font-weight: 500; }
.post-date { font-size: 12px; color: var(--gray-400); margin-left: auto; }

.post-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 6px;
  line-height: 1.4;
}

.post-preview {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--gray-400);
}

.post-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── 게시글 상세 ── */
.post-detail {
  background: white;
  border-radius: 16px;
  border: 1px solid var(--gray-200);
  padding: 32px;
}

.post-detail-header { margin-bottom: 24px; border-bottom: 1px solid var(--gray-100); padding-bottom: 16px; }

.post-detail .post-title { font-size: 22px; margin-bottom: 12px; }

.post-detail-info {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--gray-500);
}

.post-detail-body {
  font-size: 15px;
  line-height: 1.8;
  color: var(--gray-800);
  min-height: 200px;
  white-space: pre-wrap;
}

.post-detail-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
}

.btn-like {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: 1px solid var(--gray-200);
  border-radius: 24px;
  background: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-like:hover { border-color: #e74c3c; color: #e74c3c; }
.btn-like.liked { background: #fde8e8; border-color: #e74c3c; color: #e74c3c; }

.btn-back {
  padding: 8px 20px;
  border: 1px solid var(--gray-200);
  border-radius: 24px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--gray-600);
}

.btn-back:hover { background: var(--gray-50); }

/* ── 댓글 섹션 ── */
.comments-section {
  margin-top: 24px;
  background: white;
  border-radius: 16px;
  border: 1px solid var(--gray-200);
  padding: 24px;
}

.comments-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.comment-form-row { display: flex; gap: 10px; }

.comment-form input,
.comment-form textarea {
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.comment-form input:focus,
.comment-form textarea:focus { border-color: var(--primary); }

.comment-form textarea { resize: vertical; min-height: 80px; width: 100%; }
.comment-form input { flex: 1; }

.btn-comment-submit {
  align-self: flex-end;
  padding: 8px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn-comment-submit:hover { opacity: 0.9; }

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

.comment-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}

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

.comment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

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

.comment-author { font-size: 13px; font-weight: 700; color: var(--gray-800); }
.comment-date { font-size: 11px; color: var(--gray-400); }

.comment-body { font-size: 14px; line-height: 1.6; color: var(--gray-700); padding-left: 42px; }

.comment-actions {
  display: flex;
  gap: 12px;
  padding-left: 42px;
  margin-top: 6px;
}

.comment-action-btn {
  border: none;
  background: none;
  font-size: 12px;
  color: var(--gray-400);
  cursor: pointer;
}

.comment-action-btn:hover { color: var(--primary); }

/* ── 사이드바 오른쪽 ── */
.community-sidebar-right {
  position: sticky;
  top: 100px;
  height: fit-content;
}

@media (max-width: 1024px) {
  .community-sidebar-right { position: static; }
}

/* 인기 게시물 랭킹 */
.ranking-list { list-style: none; padding: 0; margin: 0; }

.ranking-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: all 0.15s;
}

.ranking-item:last-child { border-bottom: none; }
.ranking-item:hover { opacity: 0.7; }

.ranking-num {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

.ranking-num.top3 { background: var(--primary); color: white; }
.ranking-num:not(.top3) { background: var(--gray-100); color: var(--gray-500); }

.ranking-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ranking-meta {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
}

/* 뉴스 카드 */
.news-card {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
  text-decoration: none;
  transition: all 0.15s;
}

.news-card:last-child { border-bottom: none; }
.news-card:hover .news-title { color: var(--primary); }

.news-source { font-size: 11px; color: var(--primary); font-weight: 600; margin-bottom: 4px; }

.news-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.4;
  transition: color 0.2s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-date { font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* ── 글쓰기 모달 ── */
.write-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.write-modal.open { display: flex; }

.write-modal-box {
  background: white;
  border-radius: 20px;
  width: 95%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.15);
}

.write-modal-title { font-size: 20px; font-weight: 800; margin-bottom: 20px; }

.write-form { display: flex; flex-direction: column; gap: 14px; }

.write-form label { font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }

.write-form input,
.write-form select,
.write-form textarea {
  padding: 12px 16px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  font-size: 14px;
  outline: none;
}

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

.write-form textarea { min-height: 200px; resize: vertical; line-height: 1.7; }

.write-form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.btn-cancel {
  padding: 10px 24px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: white;
  font-size: 14px;
  cursor: pointer;
}

.btn-submit {
  padding: 10px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-submit:hover { opacity: 0.9; }

/* ── 뉴스 탭 전체 페이지 ── */
.news-full-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.news-full-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  padding: 20px;
  text-decoration: none;
  transition: all 0.2s;
}

.news-full-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(26,86,219,0.08);
  transform: translateY(-2px);
}

.news-full-card .news-source { margin-bottom: 8px; }
.news-full-card .news-title { font-size: 15px; -webkit-line-clamp: 3; margin-bottom: 8px; }
.news-full-card .news-summary { font-size: 13px; color: var(--gray-500); line-height: 1.5; -webkit-line-clamp: 3; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }

/* ── 정책자금 비교 도구 ── */
.compare-section { padding: 20px 0; }

.compare-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.compare-product-card {
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.compare-product-card:hover { border-color: var(--primary); }

.compare-product-card.selected {
  border-color: var(--primary);
  background: rgba(26,86,219,0.03);
}

.compare-product-card.selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.compare-product-name { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.compare-product-inst { font-size: 12px; color: var(--gray-500); }
.compare-product-type {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(26,86,219,0.08);
  color: var(--primary);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
}

.compare-btn {
  padding: 12px 32px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 24px;
}

.compare-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.compare-btn:not(:disabled):hover { opacity: 0.9; }

.compare-table-wrap { overflow-x: auto; }

.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.compare-table th {
  background: var(--gray-50);
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

.compare-table td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: top;
}

.compare-table tr:last-child td { border-bottom: none; }

.compare-table .label-col {
  font-weight: 700;
  color: var(--gray-600);
  background: var(--gray-50);
  width: 120px;
  white-space: nowrap;
}

/* ── 페이지네이션 ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}

.pagination-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  background: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.pagination-btn:hover { border-color: var(--primary); color: var(--primary); }
.pagination-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── 빈 상태 ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 15px; font-weight: 500; }

/* ── 모바일 카테고리 ── */
.mobile-categories {
  display: none;
  overflow-x: auto;
  gap: 6px;
  padding: 0 12px 12px;
}

@media (max-width: 1024px) {
  .mobile-categories { display: flex; }
}

.mobile-cat-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--gray-200);
  background: white;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.mobile-cat-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ── 로딩 ── */
.loading-shimmer {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
  height: 80px;
  margin-bottom: 12px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
