/* --- Variables --- */
:root {
  --primary-bg: #ffffff;
  --secondary-bg: #f3f4f6;
  --accent-color: #3b82f6;
  --brand-color: #374151;
  --danger-color: #ef4444;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --border-color-light: #f3f4f6;
  --white: #ffffff;
  --black: #000000;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Resets & Base Styles --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: var(--font-sans); font-size: 16px; line-height: 1.5; }
body { background-color: var(--secondary-bg); color: var(--text-primary); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; }

/* --- Layout --- */
.app-header { background-color: var(--primary-bg); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); position: sticky; top: 0; z-index: 50; height: 64px; display: flex; align-items: center; }
.header-nav { width: 100%; max-width: 800px; margin-left: auto; margin-right: auto; padding-left: 16px; padding-right: 16px; display: flex; justify-content: space-between; align-items: center; }
.app-main-container { max-width: 800px; margin-left: auto; margin-right: auto; padding: 24px 16px; }
.text-center { text-align: center; }
.text-left { text-align: left; }

/* --- Header --- */
.logo { font-size: 24px; font-weight: 700; color: var(--accent-color); cursor: pointer; transition: opacity 0.2s; }
.logo:hover { opacity: 0.8; }
.header-auth-buttons { display: flex; align-items: center; gap: 16px; }
.welcome-message { color: var(--text-secondary); font-size: 14px; }
.welcome-message .username { font-weight: 600; color: var(--text-primary); }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; font-weight: 600; border-radius: 6px; padding: 8px 16px; font-size: 16px; transition: background-color 0.2s, color 0.2s, border-color 0.2s; outline: none; white-space: nowrap; border: 1px solid transparent; cursor: pointer; }
.btn:disabled { opacity: 0.7; cursor: not-allowed; }
.btn:focus { box-shadow: 0 0 0 2px var(--primary-bg), 0 0 0 4px var(--accent-color); }
.btn .icon { width: 20px; height: 20px; margin-right: 8px; }
.btn-primary { background-color: var(--accent-color); color: var(--white); }
.btn-primary:hover:not(:disabled) { background-color: #2563eb; }
.btn-secondary { background-color: var(--primary-bg); color: var(--text-secondary); border-color: var(--border-color); }
.btn-secondary:hover:not(:disabled) { background-color: #f9fafb; }
.btn-danger { background-color: var(--danger-color); color: var(--white); }
.btn-danger:hover:not(:disabled) { background-color: #dc2626; }
.btn-dark { background-color: var(--brand-color); color: var(--white); }
.btn-dark:hover:not(:disabled) { background-color: #1f2937; }
.btn-full { width: 100%; }
.link-button { font-size: 14px; color: var(--accent-color); background: none; border: none; padding: 0; cursor: pointer; }
.link-button:hover { text-decoration: underline; }

/* --- Board --- */
.board-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-title { font-size: 30px; font-weight: 700; color: var(--text-primary); }
.search-container { width: 33.33%; position: relative; }
.search-input { width: 100%; background-color: var(--primary-bg); border: 1px solid var(--border-color); color: var(--text-primary); border-radius: 9999px; padding: 8px 16px 8px 40px; transition: box-shadow 0.2s; }
.search-input::placeholder { color: var(--text-secondary); }
.search-input:focus { outline: none; box-shadow: 0 0 0 2px var(--accent-color); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-secondary); pointer-events: none; }
.table-container { background-color: var(--primary-bg); box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1); border-radius: 8px; overflow-x: auto; }
.board-table { min-width: 100%; border-collapse: collapse; }
.board-table thead { background-color: #f9fafb; }
.board-table th { padding: 14px 6px; text-align: center; font-size: 16px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.board-table tbody { background-color: var(--white); border-top: 1px solid var(--border-color); }
.board-table tr { border-bottom: 1px solid var(--border-color); }
.board-table tr:last-child { border-bottom: none; }
.board-table td { padding: 12px 6px; white-space: nowrap; text-align: center; font-size: 14px; color: var(--text-secondary); }
.board-table tbody tr:hover { background-color: #f9fafb; cursor: pointer; }
.board-table td.text-left { color: var(--text-primary); max-width: 250px; overflow: hidden; text-overflow: ellipsis; }
.no-posts-message { padding: 64px 0; text-align: center; font-size: 18px; color: var(--text-secondary); }
.board-footer { margin-top: 24px; display: flex; justify-content: space-between; align-items: center; }

/* --- Pagination --- */
.pagination { display: inline-flex; border-radius: 6px; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.pagination-btn { position: relative; display: inline-flex; align-items: center; padding: 8px 16px; border: 1px solid var(--border-color); font-size: 14px; font-weight: 500; background-color: var(--white); color: var(--text-secondary); }
.pagination-btn:hover { background-color: #f9fafb; }
.pagination-btn:not(:last-child) { border-right: none; }
.pagination-btn:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.pagination-btn:last-child { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.pagination-btn.active { z-index: 10; background-color: var(--brand-color); border-color: var(--brand-color); color: var(--white); }

/* --- Post Detail --- */
.post-container { background-color: var(--primary-bg); padding: 32px; border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1); max-width: 100%; }
.post-not-found { text-align: center; padding: 32px; }
.post-not-found h2 { font-size: 24px; color: var(--text-secondary); }
.post-header { border-bottom: 2px solid var(--border-color-light); padding-bottom: 16px; margin-bottom: 24px; }
.post-title { font-size: 26px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.post-meta { display: flex; gap: 16px; font-size: 14px; color: var(--text-secondary); }
.post-content { padding: 24px 0; min-height: 200px; line-height: 1.8; color: var(--text-primary); }
.post-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; }
.btn-group { display: flex; gap: 8px; }

/* --- Post Form --- */
.form-container { background-color: var(--primary-bg); padding: 32px; border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1); }
.form-title { font-size: 24px; font-weight: 700; text-align: center; margin-bottom: 24px; color: var(--text-primary); }
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-bottom: 8px; }
.form-input { width: 100%; padding: 12px; font-size: 16px; border: 1px solid var(--border-color); border-radius: 6px; transition: border-color 0.2s, box-shadow 0.2s; background-color: var(--primary-bg); color: var(--text-primary); }
.form-input:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
.form-textarea { width: 100%; padding: 12px; font-size: 16px; border: 1px solid var(--border-color); border-radius: 6px; transition: border-color 0.2s, box-shadow 0.2s; background-color: var(--primary-bg); color: var(--text-primary); }
.form-textarea:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
.form-error { color: var(--danger-color); text-align: center; margin-top: -12px; margin-bottom: 12px; font-size: 14px; }
.form-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.form-footer-modal { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; }

/* --- Ad Placeholder --- */
.ad-placeholder { margin: 32px 0; padding: 16px; background-color: var(--secondary-bg); border: 1px solid var(--border-color); border-radius: 6px; text-align: center; }
.ad-placeholder p { font-size: 14px; color: var(--text-secondary); }

/* --- Modal --- */
.modal-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 100; opacity: 1; transition: opacity 0.3s ease-in-out; }
.modal-container.hidden { opacity: 0; pointer-events: none; }
.modal-content { background-color: var(--primary-bg); padding: 24px; border-radius: 8px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); max-width: 400px; width: 90%; position: relative; transform: scale(1); transition: transform 0.3s ease-in-out; }
.modal-container.hidden .modal-content { transform: scale(0.95); }
.modal-close-btn { position: absolute; top: 8px; right: 8px; background: none; border: none; cursor: pointer; padding: 4px; color: var(--text-secondary); transition: color 0.2s; }
.modal-close-btn:hover { color: var(--text-primary); }
.modal-close-btn .icon { width: 24px; height: 24px; }
.modal-links { text-align: center; margin-top: 16px; }
body.modal-open { overflow: hidden; }

/* --- 게시판 테이블 열 너비 최적화 --- */
.board-table thead th:first-child, .board-table tbody td:first-child { width: 60px; } /* # (ID) */
.board-table thead th:nth-child(3), .board-table tbody td:nth-child(3) { width: 90px; } /* 작성자 */
.board-table thead th:nth-child(4), .board-table tbody td:nth-child(4) { width: 90px; } /* 조회수 */
.board-table thead th:nth-child(5), .board-table tbody td:nth-child(5) { width: 100px; } /* 작성일 */
.board-table td.text-left { max-width: none; text-align: left; 
    padding: 0 0 0 20px; } /* 제목 너비 제한 해제 */

/* --- [추가] 공지 글 스타일 --- */
.board-table tr.notice-post {
    background-color: #fefce8; /* 연한 노란색 배경 */
}
.board-table tr.notice-post:hover {
    background-color: #fef9c3; /* 호버 시 조금 더 진한 노란색 */
}
.board-table tr.notice-post td {
    color: var(--text-primary);
    font-weight: 500;
}
.notice-prefix {
    color: var(--danger-color);
    margin-right: 4px;
}

/* --- [추가] 공지 등록 체크박스 스타일 --- */
.form-group.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-check-input {
    width: 16px;
    height: 16px;
}
.form-check-label {
    margin: 0;
    font-weight: normal;
    color: var(--text-primary);
}


/* --- Animations --- */
.animate-fade-in { animation: fadeIn 0.5s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.app-footer {
    text-align: center;
    padding: 20px 0;
    font-size: 16px;
    color: #888;
}

.app-footer a {
    color: #888;
    text-decoration: none;
}

/* --- Comments --- */
.comments-section { margin-top: 40px; }
.comments-title { font-size: 22px; font-weight: 700; color: var(--text-primary); margin-bottom: 16px; }
.comments-list { margin-bottom: 24px; border-top: 1px solid var(--border-color); }
.comment { padding: 16px 0; border-bottom: 1px solid var(--border-color-light); }
.comment:last-child { border-bottom: none; }
.comment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.comment-author { font-weight: 600; color: var(--text-primary); }
.comment-date { font-size: 12px; color: var(--text-secondary); }
.comment-content { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }
.comment-actions { margin-top: 8px; text-align: right; }
.no-comments { text-align: center; color: var(--text-secondary); padding: 24px 0; }
.comment-form-container { background-color: var(--primary-bg); padding: 20px; border-radius: 8px; border: 1px solid var(--border-color); }
#comment-form .form-footer { padding-top: 12px; }
/* --- [수정] 댓글 입력창 디자인 수정 --- */
#comment-form .form-textarea {
    width: 100%;
    height: 160px;
	border: 2px solid #00f;
}

/* --- [추가] 정보 섹션 스타일 --- */
.info-bar {
    max-width: 800px;
    height: 90px;
    margin: 5px auto;
    padding: 5px 16px;
    background-color: var(--primary-bg);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.info-bar-section {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}
.info-bar-section.left { justify-content: flex-start; }
.info-bar-section.center { justify-content: center; }
.info-bar-section.right { justify-content: flex-end; }
.sns-share-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
.sns-share-button:hover { background-color: var(--secondary-bg); }
.sns-share-button svg { width: 24px; height: 24px; }
/* --- [추가] X(트위터) 아이콘 색상 강제 지정 --- */
.sns-share-button[data-type="twitter"] svg path { fill: #000000 !important; }

/* --- [수정] 실시간 시계 스타일 --- */
.live-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.25;
}
#live-date {
    font-size: 14px;
    color: var(--text-secondary);
}
#live-time {
    font-size: 22px;
    font-weight: 600;
    color: var(--brand-color);
    letter-spacing: 1px;
}
.visitor-stats { text-align: right; font-size: 14px; color: var(--text-secondary); }
.visitor-stats div { margin: 4px 0; }
.visitor-stats span { font-weight: 600; color: var(--text-primary); }

.up-ad {
    max-width: 800px;
    height: 120px;
    margin: 5px auto;
    padding: 5px 16px;
    background-color: var(--primary-bg);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    align-items: center;
}

/* --- [추가] 게시물 작성/수정 페이지 컨테이너 최대 가로폭 설정 --- */
.post-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

