/* =========================================================
   RESET / 기본
   ========================================================= */

* {
    box-sizing: border-box;
}

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

img {
    border: 1px solid #ccc;
}

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

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

h1 {
    margin-top: 0;
}


/* =========================================================
   공통 입력
   ========================================================= */

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

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


/* =========================================================
   버튼
   ========================================================= */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: 0;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
    font-size: 15px;
}

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

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

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

.button-light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 14px;
}

.button-light:hover {
    background: #f5f5f5;
}

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


/* 블록 추가 버튼 */

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

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


/* =========================================================
   오류
   ========================================================= */

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


/* =========================================================
   게시판 헤더
   ========================================================= */

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

.board-header h1 {
    margin: 0;
}

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

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


/* =========================================================
   게시글 목록 / 테이블
   ========================================================= */

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 {
    padding: 50px;
    color: #888;
    text-align: center;
}


/* =========================================================
   검색
   ========================================================= */

.search-form {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 20px 0;
}

.search-form select {
    height: 40px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
}

.search-form input[type="text"] {
    width: 300px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-form input[type="text"]:focus {
    outline: none;
    border-color: #555;
}

.search-form button {
    height: 40px;
    border: 0;
    cursor: pointer;
}


/* =========================================================
   페이지네이션
   ========================================================= */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 25px 0;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 14px;
}

.pagination a:hover {
    background: #f5f5f5;
}

.pagination .current {
    border-color: #222;
    background: #222;
    color: #fff;
    font-weight: bold;
}

.pagination .disabled {
    background: #f8f8f8;
    color: #bbb;
}


/* =========================================================
   게시글 보기
   ========================================================= */

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

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


/* =========================================================
   본문
   ========================================================= */

.text-block {
    border: 0;
    background: #fff;
    font-size: 17px;
    line-height: 1.8;
    word-break: break-word;
    overflow-wrap: break-word;
}

.text-block h1,
.text-block h2,
.text-block h3 {
    font-weight: 700;
    line-height: 1.4;
}

.text-block h1 {
    margin: 20px 0 12px;
    font-size: 28px;
}

.text-block h2 {
    margin: 18px 0 10px;
    font-size: 23px;
}

.text-block h3 {
    margin: 16px 0 8px;
    font-size: 19px;
}

.text-block b,
.text-block strong {
    font-weight: 700;
}


/* =========================================================
   글자 색상
   ========================================================= */

.text-block .text-red,
.text-block red {
    color: #e53935;
}

.text-block .text-blue,
.text-block blue {
    color: #1e88e5;
}

.text-block .text-green,
.text-block green {
    color: #43a047;
}

.text-block .text-yellow,
.text-block yellow {
    color: #f9a825;
}

.text-block .text-cyan,
.text-block cyan {
    color: #00acc1;
}

.text-block .text-purple {
    color: #8e44ad;
}

.text-block .text-orange {
    color: #f57c00;
}


/* =========================================================
   정렬
   ========================================================= */

.text-block .text-left {
    text-align: left;
}

.text-block .text-center {
    text-align: center;
}

.text-block .text-right {
    text-align: right;
}


/* =========================================================
   형광펜
   ========================================================= */

.text-block mark {
    padding: 1px 3px;
    border-radius: 2px;
    background: #fff176;
    color: inherit;
}


/* =========================================================
   인용문
   ========================================================= */

.text-block blockquote {
    margin: 15px 0;
    padding: 10px 15px;
    border-left: 4px solid #999;
    border-radius: 3px;
    background: #f5f5f5;
    color: #555;
}


/* =========================================================
   목록
   ========================================================= */

.text-block ul,
.text-block ol {
    margin: 12px 0;
    padding-left: 30px;
}

.text-block ul {
    list-style-type: disc;
}

.text-block ol {
    list-style-type: decimal;
}

.text-block li {
    margin: 4px 0;
}


/* =========================================================
   구분선
   ========================================================= */

.text-block hr {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid #ddd;
}


/* =========================================================
   본문 블록
   ========================================================= */

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


/* =========================================================
   블록 제목
   ========================================================= */

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


/* =========================================================
   Textarea
   ========================================================= */

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


/* =========================================================
   드래그
   ========================================================= */

.drag-handle {
    position: absolute;
    top: 20px;
    left: 15px;
    color: #999;
    font-size: 22px;
    cursor: grab;
    user-select: none;
}

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

.block.dragging {
    opacity: 0.4;
}

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


/* =========================================================
   블록 컨트롤
   ========================================================= */

.block-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: 12px;
}


/* 위 / 아래 */

.move-btn,
.delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 30px;
    padding: 0;
    border: 1px solid #d5d5d5;
    border-radius: 5px;
    background: #fff;
    color: #555;
    cursor: pointer;
}

.move-btn {
    width: 34px;
    font-size: 18px;
}

.delete-btn {
    width: 34px;
    font-size: 13px;
}

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

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


/* =========================================================
   글 서식 툴바
   ========================================================= */

.text-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}

.text-toolbar button {
    min-width: 38px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: #fff;
    color: #333;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition:
        background 0.15s,
        border-color 0.15s,
        transform 0.1s;
}

.text-toolbar button:hover {
    border-color: #aaa;
    background: #f1f1f1;
}

.text-toolbar button:active {
    transform: translateY(1px);
}

.text-toolbar button:first-child {
    font-size: 15px;
}

.text-toolbar .h1-button {
    font-size: 16px;
}

.text-toolbar .h2-button {
    font-size: 15px;
}

.text-toolbar .h3-button {
    font-size: 14px;
}

.text-toolbar .red-button {
    color: #e53935;
}

.text-toolbar .blue-button {
    color: #1e88e5;
}

.text-toolbar .green-button {
    color: #43a047;
}

.text-toolbar .yellow-button {
    color: #b8860b;
    background: #fffde7;
}


/* =========================================================
   이미지
   ========================================================= */

.image-block {
    border: 1;
    background: #fbfcff;
    text-align: center;
}

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


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

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

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

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

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

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

.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;
    padding: 0 6px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

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

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

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

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


/* =========================================================
   파일
   ========================================================= */

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

.file-block a {
    color: #06c;
    text-decoration: none;
    font-weight: 700;
}

.file-block a:hover {
    text-decoration: underline;
}

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


/* =========================================================
   수정 화면 파일
   ========================================================= */

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

.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;
    border-radius: 5px;
    background: #f5f5f5;
}

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


/* =========================================================
   동영상
   ========================================================= */

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


/* =========================================================
   링크
   ========================================================= */

.link-block {
    text-align: center;
}

.link-block a {
    color: #06c;
    text-decoration: none;
    font-weight: 700;
}

.link-block a:hover {
    text-decoration: underline;
}


/* =========================================================
   저장
   ========================================================= */

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

.save:hover {
    background: #555;
}

.save.uploading,
.save:disabled {
    cursor: wait;
}

.save.uploading {
    opacity: 0.7;
}


/* =========================================================
   업로드 진행률
   ========================================================= */

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

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

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

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

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


/* =========================================================
   상단 고정 버튼
   ========================================================= */

.view-fixed-wrap {
    position: fixed;
    z-index: 99999;
    top: 15px;
    left: 0;
    width: 100%;
    pointer-events: none;
}

.view-fixed-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    pointer-events: auto;
}

.view-fixed-buttons .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

.view-fixed-buttons .button:hover {
    border-color: #ccc;
    background: #f5f5f5;
}

.view-fixed-buttons .button-red {
    border-color: #ddd;
    background: #fff;
    color: #d00;
}

.view-fixed-buttons .button-red:hover {
    border-color: #e0b0b0;
    background: #fff5f5;
}


/* =========================================================
   보기 페이지
   ========================================================= */

.view-page {
    padding-top: 65px;
}


/* =========================================================
   인쇄
   ========================================================= */

@media print {
    .view-fixed-wrap {
        display: none !important;
    }

    .view-page {
        padding-top: 0 !important;
    }
}


/* =========================================================
   모바일
   ========================================================= */

@media (max-width: 600px) {

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

    .container {
        padding: 8px;
    }

    .view-page {
        padding-top: 60px;
    }

    .view-fixed-wrap {
        top: 10px;
    }

    .view-fixed-buttons {
        gap: 5px;
        padding: 0 10px;
    }

    .view-fixed-buttons .button {
        height: 36px;
        padding: 0 11px;
        font-size: 13px;
    }


    /* 제목 */

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

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


    /* 게시글 */

    .post-title {
        font-size: 22px;
    }

    .post-info {
        font-size: 12px;
    }


    /* 본문 */

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

    .text-block h1 {
        margin: 16px 0 10px;
        font-size: 22px;
    }

    .text-block h2 {
        margin: 14px 0 8px;
        font-size: 19px;
    }

    .text-block h3 {
        margin: 12px 0 6px;
        font-size: 17px;
    }

    .text-block blockquote {
        margin: 10px 0;
        padding: 8px 12px;
    }

    .text-block ul,
    .text-block ol {
        padding-left: 25px;
    }


    /* 블록 */

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

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

    .drag-handle {
        display: none;
    }


    /* 입력 */

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


    /* 버튼 */

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

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

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

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

    .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;
    }


    /* 글 서식 */

    .text-toolbar {
        gap: 4px;
        margin-bottom: 6px;
    }

    .text-toolbar button {
        min-width: 34px;
        height: 31px;
        padding: 0 8px;
        font-size: 13px;
    }

    .text-toolbar .h1-button {
        font-size: 14px;
    }

    .text-toolbar .h2-button {
        font-size: 13px;
    }

    .text-toolbar .h3-button {
        font-size: 12px;
    }


    /* 검색 */

    .search-form {
        flex-wrap: wrap;
    }

    .search-form select {
        width: 110px;
    }

    .search-form input[type="text"] {
        width: calc(100% - 122px);
    }

    .search-form button {
        width: 70px;
    }


    /* 페이지네이션 */

    .pagination {
        gap: 3px;
    }

    .pagination a,
    .pagination span {
        min-width: 32px;
        height: 32px;
        padding: 0 5px;
    }


    /* 이미지 */

    .edit-preview {
        max-width: 100%;
        max-height: 250px;
    }

    .edit-video {
        max-height: 300px;
    }
}
