
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 30px;
    background: #f4f7fc;
    font-family:
        Arial,
        "맑은 고딕",
        sans-serif;
    color: #333;
}

img {
    border: 1px solid #ccc;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 10px;
}

.small-container {
    max-width: 450px;
}

h1 {
    margin-top: 0;
}

.input,
.title {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.title {
    font-size: 20px;
    margin-bottom: 20px;
}

.button {
    display: inline-block;
    padding: 10px 18px;
    border: 0;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
    font-size: 15px;
}

.button-dark {
    background: #333;
    color: white;
}

.button-gray {
    background: #777;
    color: white;
}

.button-red {
    background: #d9534f;
    color: white;
}

.buttons {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.error {
    padding: 12px;
    margin-bottom: 15px;
    background: #ffecec;
    color: #c00;
    border-radius: 5px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 10px;
    border-bottom: 1px solid #ddd;
}

th {
    background: #e2effd;
}

.title-cell {
    text-align: left;
}

.title-cell a {
    color: #333;
    text-decoration: none;
}

.title-cell a:hover {
    text-decoration: underline;
}

.number {
    width: 80px;
    text-align: center;
}

.writer {
    width: 120px;
    text-align: center;
}

.date {
    width: 180px;
    text-align: center;
}

.empty {
    text-align: center;
    padding: 50px;
    color: #888;
}


/* 게시글 보기 */

.post-title {
    font-size: 30px;
    font-weight: bold;
    margin-bottom: 10px;
}

.post-info {
    color: #777;
    font-size: 14px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 25px;
}



.block-title {
    font-weight: bold;
    margin-bottom: 10px;
}

textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    resize: vertical;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
}


.text-block {
    font-size: 17px;
    line-height: 1.8;
    /* white-space: pre-wrap; */
    border: 0;
    background: white;
}


.image-block {
    border: 0;
    background: white;
    text-align: center;
}

.image-block img {
    max-width: 100%;
    height: auto;
    display: inline-block;
    border-radius: 5px;
}

.file-block {
    padding: 20px;
    text-align: center;
    background: #f7f7f7;
}

.file-block a {
    color: #0066cc;
    text-decoration: none;
    font-weight: bold;
}

.video-block video {
    width: 100%;
    max-height: 600px;
    background: #000;
    border-radius: 5px;
}

.save {
    margin-top: 30px;
    width: 100%;
    padding: 15px;
    border: 0;
    background: #333;
    color: white;
    font-size: 17px;
    border-radius: 5px;
    cursor: pointer;
}


/* 파일 선택 */

.block input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
}


/* 블록 추가 버튼 */

.buttons .button {
    background: white;
    color: #333;
    border: 1px solid #ccc;
}


.buttons .button:hover {
    background: #f0f0f0;
}


/* 저장 버튼 */

.save:hover {
    background: #555;
}

.save.uploading {
    opacity: 0.7;
    cursor: wait;
}

.save:disabled {
    cursor: wait;
}


.upload-progress {
    margin-top: 15px;
    padding: 14px 16px;
    background: #f5f7fa;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
}

.upload-progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
}

#uploadPercent {
    font-weight: bold;
    color: #333;
}

.upload-progress-bar {
    width: 100%;
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
}

.upload-progress-fill {
    width: 0%;
    height: 100%;
    background: #4a90e2;
    border-radius: 5px;
    transition: width 0.15s ease;
}

.save.uploading {
    opacity: 0.7;
    cursor: wait;
}

.save:disabled {
    cursor: wait;
}

/* 수정 화면 */

.existing-file {
    margin-bottom: 10px;
    padding: 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.existing-file a {
    color: #06c;
    text-decoration: none;
}

.edit-preview {
    display: block;
    max-width: 400px;
    max-height: 300px;
    object-fit: contain;
}

.edit-video {
    display: block;
    width: 100%;
    max-width: 600px;
    max-height: 400px;
    background: #000;
}

.file-replace {
    margin-top: 10px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 5px;
}

.file-replace input[type="file"] {
    margin-top: 8px;
}



/* 게시판 헤더 */

.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.board-header h1 {
    margin: 0;
}

.admin-info {
    font-size: 14px;
    color: #666;
}

.admin-info a {
    margin-left: 10px;
    color: #666;
    text-decoration: none;
}


/* 수정 화면 블록 */

.block {
    position: relative;
    padding: 20px 50px 20px 50px;
    margin-bottom: 12px;
    background: #fbfcff;
    border: 1px solid #ddd;
    border-radius: 8px;
}


/* 드래그 손잡이 */

.drag-handle {
    position: absolute;
    left: 15px;
    top: 20px;

    font-size: 22px;
    color: #999;

    cursor: grab;

    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}


/* 드래그 중 */

.block.dragging {
    opacity: 0.4;
}


/* 드래그해서 들어갈 위치 */

.block.drag-over {
    border-top: 3px solid #333;
}


/* 기존 파일 */

.existing-file {
    margin-bottom: 10px;
    padding: 10px;

    background: white;

    border: 1px solid #ddd;

    border-radius: 5px;
}


/* 이미지 미리보기 */

.edit-preview {
    display: block;

    max-width: 400px;
    max-height: 300px;

    object-fit: contain;
}


/* 동영상 미리보기 */

.edit-video {
    display: block;

    width: 100%;
    max-width: 600px;
    max-height: 400px;

    background: #000;
}


/* 파일 교체 */

.file-replace {
    margin-top: 10px;
    padding: 10px;

    background: #f5f5f5;

    border-radius: 5px;
}

.file-replace input[type="file"] {
    margin-top: 8px;
}


/* 블록 상단 버튼 영역 */

.block-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;

    gap: 4px;

    margin-bottom: 12px;
}


/* 위 / 아래 이동 버튼 */

.move-btn {
    box-sizing: border-box;

    width: 34px;
    height: 30px;

    padding: 0;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #d5d5d5;
    border-radius: 5px;

    background: #fff;
    color: #555;

    font-size: 18px;
    font-weight: 400;

    line-height: 1;

    cursor: pointer;

    vertical-align: middle;

    transition:
        background-color 0.15s,
        border-color 0.15s,
        color 0.15s;
}


.move-btn:hover {
    background: #f5f5f5;
    border-color: #aaa;
    color: #222;
}


.move-btn:active {
    background: #e9e9e9;
}


/* 삭제 버튼 */

.delete-btn {

    
    box-sizing: border-box;

    width: 34px;
    height: 30px;

    padding: 0;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #d5d5d5;
    border-radius: 5px;

    background: #fff;
    color: #555;

    font-size: 13px;
    font-weight: 400;

    line-height: 1;

    cursor: pointer;

    vertical-align: middle;

    transition:
        background-color 0.15s,
        border-color 0.15s,
        color 0.15s;

}


.delete-btn:hover {
    background: #f5f5f5;
    border-color: #aaa;
    color: #333;
}


/* =========================
   이미지 편집기
========================= */

.image-editor {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f8f9fa;
}

.image-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 10px;
}

.image-editor-toolbar button {
    padding: 6px 10px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
}

.image-editor-toolbar button:hover {
    background: #eee;
}

.image-editor-toolbar button.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

.image-editor-toolbar input[type="color"] {
    width: 38px;
    height: 32px;
    padding: 2px;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
}

.image-editor-toolbar select {
    height: 32px;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 0 6px;
}

.canvas-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
    background: #fff;
}

.canvas-wrapper img {
    display: block;
    max-width: 100%;
    height: auto;
}

.canvas-wrapper canvas {
    position: absolute;
    left: 0;
    top: 0;
    cursor: crosshair;
}

.editor-hint {
    margin-top: 7px;
    font-size: 12px;
    color: #777;
}

.edit-preview {
    max-width: 100%;
    height: auto;
    display: block;
}



@media (max-width: 600px) {

    body {
        padding: 3px;
        font-size: 11px;
    }

    .container {
        padding: 8px;
    }

    h1 {
        font-size: 17px;
        margin-bottom: 8px;
    }

    .title {
        font-size: 15px;
        padding: 7px;
        margin-bottom: 8px;
    }

    .block {
        padding: 8px;
        margin-bottom: 6px;
    }

    .text-block {
        font-size: 14px;
        line-height: 1.5;
    }

    textarea {
        font-size: 13px;
        padding: 7px;
        min-height: 100px;
    }

    .button {
        font-size: 12px;
        padding: 6px 9px;
    }

    .buttons {
        gap: 4px;
        margin-top: 8px;
    }

    .block-controls {
        margin-bottom: 6px;
        gap: 2px;
    }

    .move-btn {
        width: 27px;
        height: 25px;
        font-size: 14px;
    }

    .delete-btn {
        height: 25px;
        font-size: 11px;
        padding: 0 6px;
    }

    .save {
        margin-top: 10px;
        padding: 10px;
        font-size: 13px;
    }

    .writer,
    .date {
        display: none;
    }

    .number {
        width: 40px;
    }

    th,
    td {
        padding: 7px 4px;
        font-size: 12px;
    }

    .empty {
        padding: 30px 10px;
        font-size: 13px;
    }
}