/*
 * C-Board CSS — Q-Board 통일 (2026-02-17)
 * 전역 CSS 변수: catsbe-common.css (:root)
 */

/* ========================================
   C-Board 페이지 레이아웃 (Q-Board 통일)
   ======================================== */

.cb-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px var(--cb-pad-x, 20px) 40px;
}

/* ── 헤더 ── */
.cb-page-header {
  margin-bottom: 24px;
}

.cb-page-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cb-page-title {
  font-family: var(--cb-font-serif, Georgia);
  font-size: 2rem;
  font-weight: 700;
  color: var(--cb-text, #1a1714);
  margin: 0;
  line-height: 1.2;
}

.cb-page-subtitle {
  font-family: var(--cb-font-serif, Georgia);
  font-size: 0.9rem;
  color: var(--cb-text-sub, #4a433b);
  margin: 0;
  font-style: italic;
}

.cb-page-desc {
  font-size: 0.9rem;
  color: var(--cb-text-muted, #7a7268);
  line-height: 1.6;
  margin: 0;
}

.cb-write-btn {
  flex-shrink: 0;
  padding: 10px 20px;
  border-radius: var(--cb-radius-pill, 24px);
  font-size: 0.9rem;
  text-decoration: none;
}

/* ── 카테고리 필터 필 (Q-Board 동일) ── */
.cb-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding-top: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--cb-border, #e8e2d8);
  position: sticky;
  top: 56px;
  z-index: 100;
  background: #fff;
}

.cb-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--cb-border, #e8e2d8);
  border-radius: var(--cb-radius-pill, 24px);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cb-text-sub, #4a433b);
  text-decoration: none;
  background: var(--cb-surface, #fff);
  transition: all 0.2s;
}

.cb-pill:hover {
  border-color: var(--cb-accent, #F37021);
  color: var(--cb-accent, #F37021);
}

.cb-pill.active {
  background: var(--cb-accent, #F37021);
  color: #fff;
  border-color: var(--cb-accent, #F37021);
}

.cb-pill-count {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* ── 소카테고리 필 ── */
.cb-sub-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.cb-sub-pill {
  padding: 6px 14px;
  border-radius: var(--cb-radius-pill, 24px);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--cb-text-muted, #7a7268);
  text-decoration: none;
  background: var(--cb-bg-warm, #f8f5f0);
  transition: all 0.2s;
}

.cb-sub-pill:hover {
  color: var(--cb-accent, #F37021);
}

.cb-sub-pill.active {
  background: var(--cb-text, #1a1714);
  color: #fff;
}

/* ── 정렬 컨트롤 (Q-Board 동일) ── */
.cb-list-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-top: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--cb-border-light, #f0ebe4);
  position: sticky;
  top: 104px;
  z-index: 99;
  background: #fff;
}

.cb-list-count {
  font-size: 0.85rem;
  color: var(--cb-accent, #F37021);
  font-weight: 600;
}

.cb-sort-links {
  display: flex;
  gap: 16px;
}

.cb-sort-links a {
  font-size: 0.85rem;
  color: var(--cb-text-muted, #7a7268);
  text-decoration: none;
  font-weight: 500;
}

.cb-sort-links a.active {
  color: var(--cb-text, #1a1714);
  font-weight: 700;
}

/* ── 카드 그리드 (Q-Board 동일: 4열) ── */
.cb-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* ── 피드 카드 (기본: 데스크탑 세로 카드) ── */
.cb-feed-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s;
  border-radius: var(--cb-radius-lg, 12px);
  overflow: hidden;
}

.cb-feed-card:hover {
  transform: translateY(-3px);
}

.cb-feed-thumb {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: var(--cb-radius-lg, 12px);
  background: var(--cb-surface-alt, #f8f5f0);
  margin-bottom: 10px;
}

.cb-feed-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.cb-feed-card:hover .cb-feed-thumb img {
  transform: scale(1.05);
}

/* 카테고리 뱃지 오버레이 */
.cb-feed-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--cb-text-sub, #4a433b);
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 3px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.cb-feed-body {
  padding: 0 2px;
}

.cb-feed-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cb-text, #1a1714);
  margin: 0 0 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cb-feed-category {
  font-size: 0.75rem;
  color: var(--cb-accent, #F37021);
  margin: 0 0 4px;
  font-weight: 500;
}

.cb-feed-desc {
  font-size: 0.8rem;
  color: var(--cb-text-muted, #7a7268);
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── 태블릿 (992px) ── */
@media (max-width: 992px) {
  .cb-card-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

/* ── 모바일 (768px): Q-Board 동일 가로 카드 ── */
@media (max-width: 768px) {
  .cb-card-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .cb-feed-card {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--cb-border, #e8e2d8);
    border-radius: var(--cb-radius, 8px);
    background: #fff;
  }
  .cb-feed-card:hover {
    transform: none;
    border-color: var(--cb-accent, #F37021);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  }
  .cb-feed-thumb {
    width: 108px;
    min-width: 108px;
    height: 108px;
    aspect-ratio: auto;
    border-radius: var(--cb-radius, 8px) 0 0 var(--cb-radius, 8px);
    margin-bottom: 0;
    flex-shrink: 0;
  }
  .cb-feed-badge {
    top: 4px;
    left: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
  }
  .cb-feed-body {
    flex: 1;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
  }
  .cb-feed-title {
    font-size: 0.85rem;
    -webkit-line-clamp: 2;
    margin-bottom: 2px;
  }
  .cb-feed-category {
    font-size: 0.7rem;
    margin-bottom: 2px;
  }
  .cb-feed-desc {
    font-size: 0.75rem;
    -webkit-line-clamp: 2;
  }
}

/* ── 공지 박스 ── */
.cb-notice-box {
  border: 1px solid var(--cb-border, #e8e2d8);
  border-radius: var(--cb-radius-lg, 12px);
  padding: 16px;
  margin-bottom: 24px;
  background: var(--cb-bg-warm, #f8f5f0);
}

.cb-notice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.cb-notice-header h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.cb-notice-header a {
  font-size: 0.8rem;
  color: var(--cb-accent, #F37021);
  text-decoration: none;
}

.cb-notice-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--cb-border-light, #f0ebe4);
  text-decoration: none;
  color: var(--cb-text, #1a1714);
  font-size: 0.9rem;
}

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

.cb-notice-date {
  font-size: 0.8rem;
  color: var(--cb-text-faint, #b0a89c);
  flex-shrink: 0;
  margin-left: 12px;
}

/* ── 페이지네이션 ── */
.cb-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 32px 0;
  font-size: 0.9rem;
}

.cb-pagination a {
  color: var(--cb-accent, #F37021);
  text-decoration: none;
  font-weight: 600;
}

/* ========================================
   댓글 섹션
   ======================================== */
.cb-comments {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--cb-border, #e8e2d8);
}

.cb-comment-form {
  margin-bottom: 2rem;
}

.cb-comment-form textarea {
  width: 100%;
  min-height: 100px;
  padding: 1rem;
  border: 1px solid var(--cb-border, #e8e2d8);
  border-radius: var(--cb-radius, 10px);
  font-size: 0.95rem;
  resize: vertical;
}

.cb-comment-item {
  padding: 1rem;
  border-bottom: 1px solid var(--cb-border, #e8e2d8);
}

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

.cb-comment-reply {
  margin-left: 2rem;
  padding-left: 1rem;
  border-left: 3px solid var(--cb-accent, #F37021);
}

.cb-comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.cb-comment-author {
  font-weight: 600;
  color: var(--cb-text, #1a1714);
}

.cb-comment-time {
  font-size: 0.85rem;
  color: var(--cb-text-light, #9a9288);
}

.cb-comment-body {
  color: var(--cb-text, #1a1714);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.cb-comment-actions {
  display: flex;
  gap: 1rem;
}

.cb-comment-actions button {
  background: none;
  border: none;
  color: var(--cb-text-muted, #7a7268);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}

.cb-comment-actions button:hover {
  color: var(--cb-accent, #F37021);
}

/* ========================================
   반응 버튼 (좋아요/싫어요)
   ======================================== */
.cb-reactions {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
}

.cb-reaction-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--cb-border, #e8e2d8);
  border-radius: var(--cb-radius, 10px);
  background: var(--cb-bg-white, #fff);
  color: var(--cb-text, #1a1714);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.cb-reaction-btn:hover {
  background: var(--cb-bg-light, #f8f5f0);
}

.cb-reaction-btn.active-like {
  background: var(--cb-success, #2e7a44);
  color: white;
  border-color: var(--cb-success, #2e7a44);
}

.cb-reaction-btn.active-dislike {
  background: var(--cb-danger, #a83838);
  color: white;
  border-color: var(--cb-danger, #a83838);
}

.cb-reaction-icon {
  font-size: 1.2rem;
}

.cb-reaction-count {
  font-weight: 600;
}

/* ========================================
   평점 (Rating)
   ======================================== */
.cb-rating-section {
  padding: 1rem;
  background: var(--cb-bg-light, #f8f5f0);
  border-radius: var(--cb-radius, 10px);
  border: 1px solid var(--cb-border, #e8e2d8);
}

.cb-rating-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.cb-rating-label {
  font-weight: 600;
  color: var(--cb-text, #1a1714);
  font-size: 0.95rem;
}

.cb-rating-stars {
  display: inline-flex;
  gap: 0.2rem;
}

.cb-rating-stars .cb-star {
  font-size: 1.3rem;
  color: var(--cb-text-light, #9a9288);
}

.cb-rating-stars .cb-star.filled {
  color: var(--cb-warning, #d4a020);
}

.cb-rating-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--cb-text, #1a1714);
  margin-left: 0.25rem;
}

.cb-rating-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--cb-border, #e8e2d8);
}

.cb-rating-stars.interactive {
  cursor: pointer;
}

.cb-rating-stars.interactive .cb-star {
  transition: all 0.2s ease;
  font-size: 1.5rem;
}

.cb-rating-stars.interactive .cb-star:hover {
  transform: scale(1.2);
  color: var(--cb-warning, #d4a020);
}

.cb-rating-stars.interactive .cb-star.filled {
  color: var(--cb-warning, #d4a020);
}

/* ========================================
   배지
   ======================================== */
.cb-badge-draft {
  background: var(--cb-warning, #d4a020);
  color: white;
}

.cb-badge-published {
  background: var(--cb-success, #2e7a44);
  color: white;
}

.cb-badge-qbarn {
  background: var(--cb-accent, #F37021);
  color: white;
}

/* ========================================
   버튼
   ======================================== */
.cb-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--cb-radius, 10px);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.cb-btn-primary {
  background: var(--cb-accent, #F37021);
  color: white;
  text-decoration: none;
}

.cb-btn-primary:hover {
  opacity: 0.9;
  color: white;
}

.cb-btn-secondary {
  background: var(--cb-secondary, #7a8889);
  color: white;
}

.cb-btn-danger {
  background: var(--cb-danger, #a83838);
  color: white;
}

.cb-btn-outline {
  background: transparent;
  border: 1px solid var(--cb-border, #e8e2d8);
  color: var(--cb-text, #1a1714);
}

.cb-btn-outline:hover {
  background: var(--cb-bg-light, #f8f5f0);
}

/* ========================================
   글쓰기 페이지 (SNS 스타일)
   ======================================== */

.cb-write-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 12px;
}

/* 상단 바 */
.cb-write-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--cb-border, #e8e2d8);
  margin-bottom: 16px;
  position: sticky;
  top: 56px;
  background: #fff;
  z-index: 50;
}

.cb-write-back {
  font-size: 0.9rem;
  color: var(--cb-text-muted, #7a7268);
  text-decoration: none;
}

.cb-write-title-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--cb-text, #1a1714);
}

.cb-write-submit-top {
  padding: 6px 16px;
  background: var(--cb-accent, #F37021);
  color: #fff;
  border: none;
  border-radius: var(--cb-radius-pill, 24px);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

/* 제목 필드 */
.cb-write-field input[type="text"],
.cb-write-field .form-control {
  border: none;
  border-bottom: 2px solid var(--cb-border, #e8e2d8);
  border-radius: 0;
  padding: 12px 4px;
  font-size: 1.15rem;
  font-weight: 600;
  background: transparent;
}
.cb-write-field input:focus {
  border-color: var(--cb-accent, #F37021);
  box-shadow: none;
  outline: none;
}

/* 분류 (카테고리+타입) */
.cb-write-classify {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.cb-write-classify .cb-write-select {
  flex: 1;
}
.cb-write-classify select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--cb-border, #e8e2d8);
  border-radius: var(--cb-radius-sm, 6px);
  font-size: 0.85rem;
  background: var(--cb-bg-warm, #f8f5f0);
}
.cb-write-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cb-text-muted, #7a7268);
  margin-bottom: 4px;
}

/* ── 미니 툴바 ── */
.cb-write-toolbar {
  border: 1px solid var(--cb-border, #e8e2d8);
  border-radius: var(--cb-radius, 10px);
  background: var(--cb-bg-warm, #f8f5f0);
  padding: 6px;
  margin-bottom: 8px;
}

.cb-tb-main {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}

.cb-tb-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--cb-radius-sm, 6px);
  background: transparent;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--cb-text-sub, #4a433b);
  transition: background 0.15s;
}
.cb-tb-btn:hover,
.cb-tb-btn.active {
  background: var(--cb-bg-hover, #f2ede6);
}

.cb-tb-media {
  font-size: 1.2rem;
}

.cb-tb-divider {
  width: 1px;
  height: 20px;
  background: var(--cb-border, #e8e2d8);
  margin: 0 4px;
}

.cb-tb-more {
  margin-left: auto;
  font-size: 1.1rem;
  font-weight: 700;
}

.cb-tb-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding-top: 6px;
  margin-top: 6px;
  border-top: 1px solid var(--cb-border-light, #f0ebe4);
}

.cb-tb-select {
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--cb-border, #e8e2d8);
  border-radius: var(--cb-radius-sm, 6px);
  font-size: 0.8rem;
  background: #fff;
}

/* ── 에디터 영역 ── */
.cb-write-editor {
  border: 1px solid var(--cb-border, #e8e2d8);
  border-radius: var(--cb-radius, 10px);
  background: #fff;
  min-height: 300px;
  margin-bottom: 16px;
}

/* ── 추가 설정 (details) ── */
.cb-write-extra {
  border: 1px solid var(--cb-border-light, #f0ebe4);
  border-radius: var(--cb-radius, 10px);
  margin-bottom: 16px;
  overflow: hidden;
}
.cb-write-extra summary {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--cb-text-muted, #7a7268);
  cursor: pointer;
  background: var(--cb-bg-warm, #f8f5f0);
}
.cb-write-extra-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cb-write-field-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cb-text-muted, #7a7268);
  margin-bottom: 4px;
}

/* ── 하단 액션 ── */
.cb-write-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 40px;
}
.cb-write-save {
  flex: 1;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
}

/* ── 영상 모달 ── */
.cb-video-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.cb-video-modal-body {
  background: #fff;
  padding: 24px;
  border-radius: var(--cb-radius-lg, 12px);
  width: 90%;
  max-width: 420px;
}
.cb-video-modal-body h4 {
  margin: 0 0 12px;
  font-size: 1rem;
}

/* ========================================
   모바일 보정
   ======================================== */
@media (max-width: 768px) {
  .cb-page {
    padding: 16px 14px 40px;
  }

  .cb-page-title {
    font-size: 1.5rem;
  }

  .cb-page-desc {
    font-size: 0.82rem;
  }

  /* sticky 요소 edge-to-edge (padding 보상) */
  .cb-filter-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 12px;
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
    padding-right: 14px;
  }
  .cb-filter-pills::-webkit-scrollbar { display: none; }

  .cb-list-control {
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
    padding-right: 14px;
    top: 100px;
  }

  .cb-pill {
    flex-shrink: 0;
    padding: 6px 14px;
    font-size: 0.8rem;
  }

  .cb-sub-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
    padding-right: 14px;
  }
  .cb-sub-pills::-webkit-scrollbar { display: none; }
  .cb-sub-pill {
    flex-shrink: 0;
  }

  .cb-write-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .cb-write-header {
    top: 48px;
    padding: 10px 0;
  }

  .cb-write-classify {
    flex-direction: column;
    gap: 6px;
  }

  .cb-tb-btn {
    min-width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  .cb-tb-media {
    font-size: 1.1rem;
  }
}

/* ── 데스크탑 스티키 조정 ── */
@media (min-width: 992px) {
  .cb-filter-pills { top: 56px; }
  .cb-list-control { top: 104px; }
}
