/* =========================================================
   AdsenseForum - 클리앙 스타일 테마
   작성일: 2025-10-02
   설명: 어두운 헤더 + 화이트 본문의 미니멀 디자인
   ========================================================= */

/* ================================
   0. 스크롤바로 인한 레이아웃 이동 방지
   ================================ */
html {
  overflow-y: scroll; /* 항상 스크롤바 영역 확보 */
}

/* ================================
   1. 기본 색상 및 설정 정의
   ================================ */
:root {
  /* 클리앙 스타일 색상 */
  --header-bg: #374151;           /* 어두운 헤더 배경 */
  --header-border: #4b5563;       /* 헤더 구분선 */
  --header-text: #d1d5db;         /* 헤더 기본 텍스트 */
  --header-text-white: #ffffff;   /* 헤더 활성 텍스트 */
  --header-accent: #60a5fa;       /* 액센트 색상 (파란색) */
  --header-hover: rgba(255,255,255,0.1); /* 호버 배경 */
  
  /* 본문 색상 */
  --body-bg: #ffffff;             /* 본문 배경 (화이트) */
  --text-primary: #1f2937;        /* 기본 텍스트 */
  --text-secondary: #6b7280;      /* 보조 텍스트 */
  --text-muted: #9ca3af;          /* 흐린 텍스트 */
  
  /* 구분선 및 배경 */
  --border-light: #e5e7eb;        /* 연한 구분선 */
  --border-medium: #d1d5db;       /* 중간 구분선 */
  --bg-light: #f8fafc;            /* 연한 배경 */
  
  /* 기본 설정 */
  --container-width: 1080px;      /* 최대 너비 */
  --header-height: 50px;          /* 헤더 높이 */
  --border-radius: 6px;           /* 모서리 둥글기 */
}

/* ================================
   2. 전체 기본 스타일
   ================================ */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', 'Apple SD Gothic Neo', Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--body-bg);
  letter-spacing: -0.2px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--header-accent);
  text-decoration: underline;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 16px;
}

main.container {
  padding-top: 20px;
  padding-bottom: 40px;
}

/* 게시글 본문 p 태그 간격 조정 */
.post-content p {
    margin-bottom: 0.5rem;
}

.post-content p:last-child {
    margin-bottom: 0;
}


/* ================================
   3. 헤더 (클리앙 스타일)
   ================================ */
.clien-header {
  background: var(--header-bg) !important;
  border-bottom: 1px solid var(--header-border) !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.clien-header .navbar {
  min-height: var(--header-height);
  padding: 0;
}

.clien-header .container {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* 로고 스타일 */
.clien-header .navbar-brand {
  color: var(--header-text-white) !important;
  font-weight: 700;
  font-size: 18px;
  padding-right: 20px;
  padding-left: 15px;
  margin-right: 20px;
  border-right: 1px solid var(--header-border);
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.clien-header .navbar-brand:hover {
  text-decoration: none;
  color: var(--header-text-white) !important;
}

.clien-header .navbar-brand i {
  color: var(--header-accent);
  margin-right: 6px;
}

/* 메인 네비게이션 */
.clien-header .main-nav {
  gap: 0;
  margin: 0;
  padding: 0;
}

.clien-header .main-nav .nav-link {
  color: var(--header-text) !important;
  font-weight: 500;
  font-size: 14px;
  padding: 15px 16px !important;
  border-right: 1px solid var(--header-border);
  height: var(--header-height);
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  position: relative;
}

.clien-header .main-nav .nav-link:hover {
  color: var(--header-text-white) !important;
  background: var(--header-hover);
  text-decoration: none;
}

.clien-header .main-nav .nav-link.active {
  color: var(--header-text-white) !important;
  background: var(--header-hover);
  font-weight: 600;
}

/* 활성 메뉴 하단 액센트 바 */
.clien-header .main-nav .nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--header-accent);
}

/* 우측 사용자 메뉴 */
.clien-header .user-nav {
  margin-left: auto;
  gap: 0;
}

.clien-header .user-nav .nav-link {
  color: var(--header-text) !important;
  font-weight: 500;
  font-size: 14px;
  padding: 15px 12px !important;
  height: var(--header-height);
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.clien-header .user-nav .nav-link:hover {
  color: var(--header-text-white) !important;
  background: var(--header-hover);
  text-decoration: none;
}

.clien-header .user-nav .nav-link i {
  font-size: 16px;
  margin-right: 4px;
}

/* 모바일 토글 버튼 */
.clien-header .navbar-toggler {
  border: none;
  padding: 8px;
  color: #fff;
  margin-right: 15px;
}

.clien-header .navbar-toggler:focus {
  box-shadow: none;
  outline: none;
}

.clien-header .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  width: 24px;
  height: 24px;
}

/* ================================
   4. 카드 및 패널
   ================================ */
.card {
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  box-shadow: none !important;
  background: #fff;
}

.card-header {
  background: #fff !important;
  border-bottom: 1px solid var(--border-light);
  padding: 12px 16px;
  font-weight: 600;
}

.card-body {
  padding: 16px;
}

.shadow-sm {
  box-shadow: none !important;
}

/* ================================
   5. 테이블 (게시글 목록)
   ================================ */
.table {
  margin: 0;
  font-size: 14px;
}

.table > :not(caption) > * > * {
  padding: 12px 14px;
  background-color: transparent !important;
  border-bottom: 1px solid var(--border-light) !important;
  vertical-align: middle;
}

.table thead th {
  background: var(--bg-light) !important;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border-medium) !important;
}

.table tbody tr {
  transition: background-color 0.15s ease;
  cursor: pointer;
}

.table tbody tr:hover {
  background: var(--bg-light);
}

.table tbody tr:hover .fw-semibold,
.table tbody tr:hover .fw-bold {
  color: var(--header-accent);
  text-decoration: underline;
}

/* 테이블 내 텍스트 정렬은 HTML의 인라인 스타일로 처리 */


/* ================================
   6. 뱃지 (게시판, 카테고리 표시)
   ================================ */
.badge {
  border-radius: 12px;
  font-weight: 600;
  font-size: 11px;
  padding: 4px 8px;
}

.badge.bg-primary {
  background: #e0f2fe !important;
  color: #0d6efd !important;
}

.badge.bg-secondary {
  background: #f1f5f9 !important;
  color: #475569 !important;
}

.badge.bg-danger {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

.badge.bg-light {
  background: var(--bg-light) !important;
  color: var(--header-accent) !important;
}

/* ================================
   7. 폼 요소 (입력창, 버튼 등)
   ================================ */
.form-control,
.form-select {
  border: 1px solid var(--border-medium);
  border-radius: var(--border-radius);
  font-size: 14px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--header-accent);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}

.btn {
  border-radius: var(--border-radius);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--header-accent);
  border-color: var(--header-accent);
}

.btn-outline-primary {
  color: var(--header-accent);
  border-color: var(--header-accent);
}

.btn-outline-secondary {
  color: var(--text-secondary);
  border-color: var(--border-medium);
}

.btn:active {
  transform: translateY(0.5px);
}

/* ================================
   8. 페이지네이션
   ================================ */
.pagination {
  gap: 4px;
}

.page-link {
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  padding: 8px 12px;
}

.page-item.active .page-link {
  background: var(--header-accent);
  border-color: var(--header-accent);
  color: #fff;
}

.page-link:hover {
  background: var(--bg-light);
  color: var(--header-accent);
}

/* ================================
   9. 푸터
   ================================ */
footer {
  background: var(--bg-light) !important;
  border-top: 1px solid var(--border-light);
  color: var(--text-secondary);
}

footer a {
  color: var(--text-secondary);
}

footer a:hover {
  color: var(--header-accent);
}

/* ================================
   10. 유틸리티 클래스
   ================================ */
.text-muted {
  color: var(--text-muted) !important;
}

.fw-bold, .fw-semibold {
  font-weight: 600 !important;
}

.small, small {
  font-size: 12px;
}

/* ================================
   11. 모바일 반응형
   ================================ */
@media (max-width: 991.98px) {
  /* 헤더 모바일 조정 (기존 유지) */
  .clien-header .navbar-brand {
    border-right: none;
    margin-right: auto;
    padding-right: 0;
  }
  
  .clien-header .navbar-collapse {
    background: var(--header-bg);
    border-top: 1px solid var(--header-border);
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  }
  
  .clien-header .main-nav,
  .clien-header .user-nav {
    flex-direction: column;
    width: 100%;
  }
  
  .clien-header .nav-link {
    border-right: none !important;
    border-bottom: 1px solid var(--header-border);
    padding: 12px 20px !important;
    height: auto !important;
  }
  
  .clien-header .main-nav .nav-link.active::after {
    display: none;
  }
  
  .clien-header .user-nav {
    border-top: 1px solid var(--header-border);
  }
  
  /* 기본 테이블 컬럼 숨김 (태블릿) */
  .table.post-table td:nth-child(1), /* 번호 */
  .table.post-table th:nth-child(1),
  .table.post-table td:nth-child(6), /* 추천 */
  .table.post-table th:nth-child(6) {
    display: none;
  }
}

@media (max-width: 575.98px) {
  /* ===== 메인 페이지 (7컬럼) 모바일 최적화 ===== */
  .index-page .table.post-table td:nth-child(1), /* 번호 */
  .index-page .table.post-table th:nth-child(1),
  .index-page .table.post-table td:nth-child(2), /* 게시판 */
  .index-page .table.post-table th:nth-child(2),
  .index-page .table.post-table td:nth-child(4), /* 작성자 */
  .index-page .table.post-table th:nth-child(4),
  .index-page .table.post-table td:nth-child(5), /* 작성일 */
  .index-page .table.post-table th:nth-child(5),
  .index-page .table.post-table td:nth-child(6), /* 조회 */
  .index-page .table.post-table th:nth-child(6),
  .index-page .table.post-table td:nth-child(7), /* 추천 */
  .index-page .table.post-table th:nth-child(7) {
    display: none;
  }
  
  /* 메인 페이지: 제목만 표시 */
  .index-page .table.post-table td:nth-child(3) {
    max-width: 100%;
    white-space: normal;
  }
  
  /* ===== 게시판 페이지 (6컬럼) 모바일 최적화 ===== */
  .board-page .table.post-table td:nth-child(1), /* 번호 */
  .board-page .table.post-table th:nth-child(1),
  .board-page .table.post-table td:nth-child(3), /* 작성자 - 추가 */
  .board-page .table.post-table th:nth-child(3),
  .board-page .table.post-table td:nth-child(4), /* 작성일 - 추가 */
  .board-page .table.post-table th:nth-child(4),
  .board-page .table.post-table td:nth-child(5), /* 조회 */
  .board-page .table.post-table th:nth-child(5),
  .board-page .table.post-table td:nth-child(6), /* 추천 */
  .board-page .table.post-table th:nth-child(6) {
    display: none;
  }
  
  /* 게시판 페이지: 제목만 표시 */
  .board-page .table.post-table td:nth-child(2) { /* 제목 */
    max-width: 100%;
    white-space: normal;
  }
  
  /* 공통 스타일 */
  .table > :not(caption) > * > * {
    padding: 10px 8px;
  }
  
  .table.post-table .badge {
    font-size: 10px;
    padding: 2px 6px;
  }
  
  .table.post-table .comment-count {
    font-size: 11px;
  }
}

/* 아주 작은 화면 (375px 이하) */
@media (max-width: 374.98px) {
  /* 메인 페이지: 제목만 */
  .index-page .table.post-table td:nth-child(3) {
    font-size: 13px;
  }
  
  /* 게시판 페이지: 제목만 */
  .board-page .table.post-table td:nth-child(2) {
    font-size: 13px;
  }
}

/* ================================
   12. 댓글 수 표시 스타일
   ================================ */
.comment-count {
  color: #0d6efd;
  font-size: 13px;
  font-weight: 600;
  margin-left: 4px;
}

.table.post-table .comment-count {
  color: #60a5fa;
  font-weight: 700;
}

/* 모바일 댓글 수 */
@media (max-width: 575.98px) {
  .comment-count {
    font-size: 12px;
  }
}

/* ================================
   게시판 페이지 전용 테이블 스타일
   ================================ */

/* 게시판 페이지 (6개 컬럼) */
.board-page .table.post-table th:nth-child(1),
.board-page .table.post-table td:nth-child(1) { 
  width: 70px; 
  text-align: center; 
  color: var(--text-secondary); 
}

/* 제목 컬럼 */
.board-page .table.post-table th:nth-child(2),
.board-page .table.post-table td:nth-child(2) { 
  min-width: 250px;
}

/* 작성자 */
.board-page .table.post-table th:nth-child(3),
.board-page .table.post-table td:nth-child(3) { 
  width: 110px; 
  text-align: center; 
}

/* 작성일 */
.board-page .table.post-table th:nth-child(4),
.board-page .table.post-table td:nth-child(4) { 
  width: 110px; 
  text-align: center; 
}

/* 조회 */
.board-page .table.post-table th:nth-child(5),
.board-page .table.post-table td:nth-child(5) { 
  width: 70px; 
  text-align: center; 
}

/* 추천 */
.board-page .table.post-table th:nth-child(6),
.board-page .table.post-table td:nth-child(6) { 
  width: 70px; 
  text-align: center; 
}

/* 메인 페이지 (7개 컬럼) */
.index-page .table.post-table th:nth-child(1),
.index-page .table.post-table td:nth-child(1) { 
  width: 70px; 
  text-align: center; 
  color: var(--text-secondary); 
}

.index-page .table.post-table th:nth-child(2),
.index-page .table.post-table td:nth-child(2) { 
  width: 110px; 
  text-align: center;
}

/* 제목 컬럼 */
.index-page .table.post-table th:nth-child(3),
.index-page .table.post-table td:nth-child(3) { 
  min-width: 250px;
}

.index-page .table.post-table th:nth-child(4),
.index-page .table.post-table td:nth-child(4) { 
  width: 110px; 
  text-align: center; 
}

.index-page .table.post-table th:nth-child(5),
.index-page .table.post-table td:nth-child(5) { 
  width: 110px; 
  text-align: center; 
}

.index-page .table.post-table th:nth-child(6),
.index-page .table.post-table td:nth-child(6) { 
  width: 70px; 
  text-align: center; 
}

.index-page .table.post-table th:nth-child(7),
.index-page .table.post-table td:nth-child(7) { 
  width: 70px; 
  text-align: center; 
}



/* ================================
   13. 게시글 상세보기 스타일
   ================================ */

/* 게시글 본문 컨테이너 */
.post-content {
  width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

/* 게시글 내 이미지 반응형 처리 */
.post-content img {
  max-width: 100% !important;
  height: auto !important;
  display: block;
  margin: 10px 0;
}

/* 게시글 내 iframe (유튜브 등) 반응형 */
.post-content iframe {
  max-width: 100%;
}

/* 게시글 내 테이블 반응형 */
.post-content table {
  max-width: 100%;
  overflow-x: auto;
  display: block;
}

/* 게시글 내 pre, code 블록 */
.post-content pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* 긴 URL 줄바꿈 */
.post-content a {
  word-break: break-all;
}

/* 모바일 최적화 */
@media (max-width: 575.98px) {
  .post-content {
    font-size: 14px;
    line-height: 1.6;
  }
  
  .post-content img {
    margin: 8px 0;
  }
}


/* 추천 버튼 커서 스타일 */
#like-button {
    cursor: pointer;
    transition: all 0.3s ease;
}

#like-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#like-button:active:not(:disabled) {
    transform: translateY(0);
}

#like-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}