/* 기본 설정 */
body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

/* 다크모드 */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}

/* 글쓰기 폼 */
#writeForm {
    display: none;
    border: 1px solid #ccc;
    padding: 12px;
    border-radius: 5px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 20px auto;
    background-color: #fff;
    box-sizing: border-box;
}

body.dark-mode #writeForm {
    background-color: #1e1e1e;
    border-color: #444;
}

/* 입력 필드 */
#writeForm input,
#writeForm textarea {
    width: 100%;
    padding: 8px;
    margin: 6px 0;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    color: #000;
}

body.dark-mode #writeForm input,
body.dark-mode #writeForm textarea {
    background-color: #2b2b2b;
    color: #e0e0e0;
    border-color: #555;
}

/* 올리기 버튼 */
#postBtn {
    display: block;
    margin: 12px auto 0 auto;
    padding: 8px 16px;
    background-color: #4caf50;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#postBtn:hover {
    background-color: #45a049;
}

/* 글 목록 */
#postsList {
    list-style-type: none;
    padding: 0;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    box-sizing: border-box;
}

#postsList li {
    border: 1px solid #ccc;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 5px;
    background-color: #fff;
    box-sizing: border-box;
}

body.dark-mode #postsList li {
    background-color: #1e1e1e;
    border-color: #444;
}

/* 글 제목 */
.post-title {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 4px;
}

/* 작성자 정보 */
.post-meta {
    font-size: 0.9em;
    color: #666;
}

body.dark-mode .post-meta {
    color: #aaa;
}

/* 게시글 내용 */
.post-content {
    margin: 8px 0;
    white-space: pre-wrap;
}

/* 버튼 공통 스타일 (내용 펼치기 + 삭제 버튼) */
.toggle-content-btn,
.admin-delete-btn {
    background-color: #2196f3;
    color: white;
    font-size: 14px;
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 6px;
    margin-right: 8px;
}

.admin-delete-btn {
    background-color: #e53935;
}

.admin-delete-btn:hover {
    background-color: #c62828;
}

.toggle-content-btn:hover {
    background-color: #1976d2;
}

/* 다크모드 버튼 */
body.dark-mode .toggle-content-btn {
    background-color: #1565c0;
    color: white;
}

body.dark-mode .toggle-content-btn:hover {
    background-color: #0d47a1;
}

body.dark-mode .admin-delete-btn {
    background-color: #b71c1c;
}

body.dark-mode .admin-delete-btn:hover {
    background-color: #8e0000;
}

/* 글쓰기 버튼 */
#showWriteFormBtn {
    display: block;
    margin: 0 auto 20px auto;
    padding: 10px 20px;
    background-color: #1976d2;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#showWriteFormBtn:hover {
    background-color: #1565c0;
}

/* 삭제 팝업 */
#deletePopup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#deletePopupContent {
    background-color: #fff;
    padding: 20px;
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode #deletePopupContent {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

#adminPwdInput {
    margin-top: 10px;
    padding: 6px;
    width: 80%;
    border: 1px solid #ccc;
    border-radius: 4px;
}

body.dark-mode #adminPwdInput {
    background-color: #2b2b2b;
    color: #fff;
    border-color: #555;
}

#confirmDeleteBtn,
#cancelDeleteBtn {
    margin-top: 10px;
    margin-right: 8px;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#confirmDeleteBtn {
    background-color: #d32f2f;
    color: #fff;
}

#cancelDeleteBtn {
    background-color: #9e9e9e;
    color: #fff;
}

#confirmDeleteBtn:hover {
    background-color: #b71c1c;
}

#cancelDeleteBtn:hover {
    background-color: #757575;
}

/* 반응형 */
@media (max-width: 600px) {

    #writeForm,
    #postsList,
    #postsList li {
        max-width: 100%;
    }

    #adminPwdInput {
        width: 100%;
    }
}

/* 댓글 섹션 */
.comment-section {
    margin-top: 12px;
    border-top: 1px solid #ccc;
    padding-top: 10px;
}

body.dark-mode .comment-section {
    border-color: #444;
}

.comments-list {
    margin-bottom: 8px;
}

.comment-item {
    padding: 4px 0;
    font-size: 0.95em;
}

.comment-time {
    font-size: 0.8em;
    color: #888;
    margin-left: 6px;
}

body.dark-mode .comment-time {
    color: #aaa;
}

.comment-author,
.comment-input {
    width: calc(50% - 6px);
    margin-right: 6px;
    padding: 6px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}

body.dark-mode .comment-author,
body.dark-mode .comment-input {
    background-color: #2b2b2b;
    color: #e0e0e0;
    border-color: #555;
}

.comment-submit {
    padding: 6px 12px;
    background-color: #607d8b;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.comment-submit:hover {
    background-color: #455a64;
}

.like-btn {
    background: none;
    border: 1px solid #888;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 14px;
    color: #444;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    user-select: none;
}

.like-btn:hover {
    background-color: #f0f0f0;
    color: #000;
}

.like-btn:disabled,
.like-btn[disabled] {
    border-color: #ccc;
    color: #aaa;
    cursor: default;
}

.like-count {
    margin-left: 6px;
    font-size: 14px;
    color: #555;
    vertical-align: middle;
}