/* 글쓰기 페이지 */
.write-box {
    padding: 26px 28px;
}

.write-form .form-group {
    margin-bottom: 20px;
}

.write-form .form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

.write-form .form-group input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #d5d9e0;
    border-radius: 7px;
    font-size: 14px;
    outline: none;
}

.write-form .form-group input:focus {
    border-color: #2f6fed;
}

.write-form textarea {
    width: 100%;
    min-height: 300px;
    padding: 14px 12px;
    border: 1px solid #d5d9e0;
    border-radius: 7px;
    font-size: 14px;
    font-family: "Malgun Gothic", "맑은 고딕", Arial, sans-serif;
    resize: vertical;
    outline: none;
}

.write-form textarea:focus {
    border-color: #2f6fed;
}

.write-actions {
    margin-top: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.write-actions button {
    border: none;
    cursor: pointer;
}

/* CKEditor */
.ck-editor__editable {
    min-height: 320px;
}

.ck-content {
    font-size: 15px;
    line-height: 1.7;
}

/* 게시글 상세 */
.post-detail-box {
    padding: 30px;
}

.post-detail-header {
    padding-bottom: 22px;
    border-bottom: 1px solid #e4e7ec;
}

.post-board-name {
    margin-bottom: 10px;
}

.post-board-name a {
    font-size: 14px;
    font-weight: 700;
    color: #2f6fed;
}

.post-detail-header h2 {
    margin-bottom: 14px;
    font-size: 28px;
    font-weight: 800;
    color: #222;
    line-height: 1.4;
}

.post-detail-meta {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: #777;
}

.post-detail-meta strong {
    color: #333;
}

.post-detail-content {
    min-height: 300px;
    padding: 30px 0;
    font-size: 16px;
    line-height: 1.8;
    color: #222;
    border-bottom: 1px solid #e4e7ec;
}

.post-detail-content p {
    margin-bottom: 14px;
}

.post-detail-content img {
    max-width: 100%;
    height: auto;
}

.post-detail-content ul,
.post-detail-content ol {
    margin-left: 24px;
    margin-bottom: 14px;
}

.post-detail-actions {
    margin-top: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.post-owner-actions {
    display: flex;
    gap: 8px;
}

.btn-edit,
.btn-delete {
    display: inline-block;
    padding: 9px 15px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 700;
}

.btn-edit {
    border: 1px solid #d5d9e0;
    background-color: #fff;
    color: #333;
}

.btn-edit:hover {
    background-color: #f2f4f7;
}

.btn-delete {
    background-color: #e5484d;
    color: #fff;
}

.btn-delete:hover {
    background-color: #d6363b;
}

/* 댓글 */
.comment-section {
    margin-top: 34px;
    padding-top: 26px;
    border-top: 1px solid #e4e7ec;
}

.comment-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.comment-title h3 {
    font-size: 20px;
    font-weight: 800;
}

.comment-title span {
    font-size: 14px;
    color: #2f6fed;
    font-weight: 700;
}

.comment-form {
    margin-bottom: 24px;
}

.comment-form textarea {
    width: 100%;
    min-height: 90px;
    padding: 12px;
    border: 1px solid #d5d9e0;
    border-radius: 7px;
    font-size: 14px;
    font-family: "Malgun Gothic", "맑은 고딕", Arial, sans-serif;
    resize: vertical;
    outline: none;
}

.comment-form textarea:focus {
    border-color: #2f6fed;
}

.comment-form-actions {
    margin-top: 10px;
    text-align: right;
}

.comment-form-actions button {
    padding: 9px 15px;
    border: none;
    border-radius: 7px;
    background-color: #2f6fed;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.comment-form-actions button:hover {
    background-color: #1f5bd8;
}

.comment-login-guide {
    margin-bottom: 24px;
    padding: 14px;
    border-radius: 7px;
    background-color: #f6f8fb;
    color: #666;
    font-size: 14px;
    text-align: center;
}

.comment-login-guide a {
    color: #2f6fed;
    font-weight: 700;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.comment-item {
    position: relative;
    padding: 16px 18px;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background-color: #fafbfc;
}

.comment-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
}

.comment-meta strong {
    color: #222;
}

.comment-meta span {
    color: #888;
}

.comment-content {
    font-size: 14px;
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap;
}

.comment-delete-form {
    position: absolute;
    top: 14px;
    right: 16px;
}

.comment-delete-form button {
    border: none;
    background: none;
    color: #d93025;
    font-size: 13px;
    cursor: pointer;
}

.comment-delete-form button:hover {
    text-decoration: underline;
}

.empty-comments {
    padding: 30px 0;
    color: #888;
    text-align: center;
    font-size: 14px;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.comment-action-btn {
    padding: 4px 8px;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
    font-size: 13px;
    cursor: pointer;
}

.comment-action-btn:hover {
    background-color: #f5f6f8;
}

.comment-action-btn.danger {
    border-color: #e03131;
    color: #e03131;
}

.comment-action-btn.danger:hover {
    background-color: #fff0f0;
}

.comment-edit-form {
    margin-top: 10px;
}

.comment-edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.5;
}

.comment-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 8px;
}

.comment-updated {
    margin-left: 6px;
    color: #888;
    font-size: 12px;
}

.comment-edit-error-message {
    margin-bottom: 8px;
    padding: 9px 11px;
    border: 1px solid #f1aeb5;
    border-radius: 5px;
    background-color: #fff5f5;
    color: #c92a2a;
    font-size: 13px;
    font-weight: 600;
}

.comment-section .form-error-message {
    margin: 10px 0 12px;
    padding: 10px 12px;
    font-size: 13px;
}

.post-delete-form {
    display: inline-block;
    margin: 0;
}

.post-delete-form .btn-delete {
    display: inline-block;
    padding: 8px 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
}


/* 게시글 상세 - CKEditor 이미지 기본 */
/* 기본 이미지: 중앙 */
.post-detail-content figure.image {
    display: table;
    clear: both;
    margin: 20px auto;
    text-align: center;
}

.post-detail-content figure.image img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

/* 좌측 정렬 */
.post-detail-content figure.image.image-style-align-left {
    float: left;
    clear: none;
    margin: 20px 20px 20px 0;
    text-align: left;
}

.post-detail-content figure.image.image-style-align-left img {
    margin-left: 0;
    margin-right: auto;
}

/* 우측 정렬 */
.post-detail-content figure.image.image-style-align-right {
    float: right;
    clear: none;
    margin: 20px 0 20px 20px;
    text-align: right;
}

.post-detail-content figure.image.image-style-align-right img {
    margin-left: auto;
    margin-right: 0;
}

/* 중앙 정렬 */
.post-detail-content figure.image.image-style-align-center {
    float: none;
    clear: both;
    margin: 20px auto;
    text-align: center;
}

.post-detail-content::after {
    content: "";
    display: block;
    clear: both;
}

@media (max-width: 768px) {
    .post-detail-box {
        padding: 22px 18px;
    }

    .post-detail-header h2 {
        font-size: 23px;
        line-height: 1.35;
    }

    .post-detail-meta {
        flex-direction: column;
        gap: 5px;
        font-size: 13px;
    }

    .post-detail-content {
        padding: 24px 0;
        font-size: 15px;
        line-height: 1.75;
    }

    .post-detail-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .post-owner-actions {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .post-owner-actions .btn-edit,
    .post-owner-actions .post-delete-form {
        flex: 1;
    }

    .post-owner-actions .btn-edit,
    .post-owner-actions .btn-delete {
        width: 100%;
        text-align: center;
    }

    .post-delete-form {
        display: block;
    }

    .comment-item {
        padding: 15px 14px;
    }

    .comment-meta {
        flex-direction: column;
        gap: 3px;
        padding-right: 52px;
    }

    .comment-delete-form {
        top: 12px;
        right: 12px;
    }

    .comment-actions {
        flex-wrap: wrap;
    }

    .comment-edit-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .comment-edit-actions button {
        width: 100%;
    }

    .post-detail-content figure.image,
    .post-detail-content figure.image.image-style-align-left,
    .post-detail-content figure.image.image-style-align-right,
    .post-detail-content figure.image.image-style-align-center {
        float: none;
        clear: both;
        display: block;
        max-width: 100%;
        margin: 20px auto;
        text-align: center;
    }

    .post-detail-content figure.image img,
    .post-detail-content figure.image.image-style-align-left img,
    .post-detail-content figure.image.image-style-align-right img,
    .post-detail-content figure.image.image-style-align-center img {
        display: block;
        max-width: 100%;
        height: auto;
        margin: 0 auto;
    }

    .write-box {
        padding: 22px 18px;
    }

    .write-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .write-actions a,
    .write-actions button {
        width: 100%;
        text-align: center;
    }

    .ck-editor__editable {
        min-height: 260px;
    }
}