@charset "utf-8";

/**
 * CKEditor5 커스텀 스타일
 * 관리자 패널과의 조화를 위한 최소한의 스타일 오버라이드
 */

/* CKEditor5 에디터 컨테이너 기본 스타일 */
.ck-editor {
    width: 100% !important;
    box-sizing: border-box;
}

/* 에디터 콘텐츠 영역 */
.ck-content {
    font-family: '맑은 고딕', 'Malgun Gothic', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    padding: 15px;
    min-height: 300px;
}

/* 에디터 포커스 시 테두리 색상 */
.ck-editor__editable:focus {
    border-color: #4a90e2 !important;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1) !important;
}

/* 툴바 스타일 */
.ck-toolbar {
    border-bottom: 1px solid #ddd !important;
    background-color: #f9f9f9 !important;
    padding: 10px !important;
}

/* 툴바 버튼 호버 효과 */
.ck-button:hover {
    background-color: #e8e8e8 !important;
}

/* 드롭다운 메뉴 z-index 조정 */
.ck-dropdown__panel {
    z-index: 10000 !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    width: auto !important;
    min-width: 100px !important;
    max-width: 200px !important;
}

/* 폰트 크기 드롭다운 특별 처리 */
.ck-font-size-dropdown .ck-dropdown__panel {
    max-height: 250px !important;
    overflow-y: auto !important;
}

/* 드롭다운 리스트 아이템 크기 조정 */
.ck-list__item {
    font-size: 13px !important;
    padding: 5px 10px !important;
    min-height: auto !important;
}

/* 폰트 크기 드롭다운 아이템 */
.ck-font-size-option {
    font-size: inherit !important;
    line-height: 1.4 !important;
    padding: 5px 10px !important;
}

/* 드롭다운 버튼 크기 조정 */
.ck-dropdown__button {
    min-width: auto !important;
    padding: 5px 10px !important;
}

/* 드롭다운 화살표 아이콘 크기 조정 */
.ck-dropdown__arrow {
    width: 10px !important;
}

/* 모달 다이얼로그 z-index 조정 */
.ck-dialog-overlay {
    z-index: 9999 !important;
}

.ck-dialog {
    z-index: 10000 !important;
}

/* 테이블 스타일 */
.ck-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 15px 0;
}

.ck-content table td,
.ck-content table th {
    border: 1px solid #ddd;
    padding: 10px;
}

.ck-content table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

/* 리스트 스타일 */
.ck-content ul,
.ck-content ol {
    padding-left: 30px;
    margin: 10px 0;
}

.ck-content ul li,
.ck-content ol li {
    margin: 5px 0;
}

/* 인용구 스타일 */
.ck-content blockquote {
    border-left: 4px solid #ddd;
    padding-left: 15px;
    margin: 15px 0;
    color: #666;
}

/* 이미지 스타일 */
.ck-content img {
    max-width: 100%;
    height: auto;
    margin: 10px 0;
}

/* CKEditor5 이미지 정렬 스타일 */
.ck-content figure.image {
    display: table;
    clear: both;
    text-align: center;
    margin: 1em auto;
}

.ck-content figure.image img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    min-width: 50px;
}

.ck-content figure.image figcaption {
    display: table-caption;
    caption-side: bottom;
    word-break: break-word;
    color: #333;
    background-color: #f7f7f7;
    padding: 0.6em;
    font-size: 0.75em;
    outline-offset: -1px;
}

/* 좌측 정렬 */
.ck-content figure.image-style-align-left,
.ck-content figure.image-style-side-left {
    float: left;
    margin-right: 1.5em;
    margin-left: 0;
}

/* 우측 정렬 */
.ck-content figure.image-style-align-right,
.ck-content figure.image-style-side {
    float: right;
    margin-left: 1.5em;
    margin-right: 0;
}

/* 중앙 정렬 (명시적) */
.ck-content figure.image-style-align-center {
    margin-left: auto;
    margin-right: auto;
}

/* 블록 좌측 정렬 */
.ck-content figure.image-style-block-align-left {
    margin-left: 0;
    margin-right: auto;
}

/* 블록 우측 정렬 */
.ck-content figure.image-style-block-align-right {
    margin-left: auto;
    margin-right: 0;
}

/* Float 해제를 위한 clearfix */
.ck-content p:has(+ figure.image-style-align-left),
.ck-content p:has(+ figure.image-style-align-right) {
    clear: both;
}

.ck-content figure.image + p,
.ck-content figure.image + h1,
.ck-content figure.image + h2,
.ck-content figure.image + h3,
.ck-content figure.image + h4 {
    clear: both;
}

/* 인라인 스타일 text-align 지원 */
.ck-content [style*="text-align:center"] figure.image,
.ck-content [style*="text-align: center"] figure.image {
    margin-left: auto;
    margin-right: auto;
}

.ck-content [style*="text-align:right"] figure.image,
.ck-content [style*="text-align: right"] figure.image {
    margin-left: auto;
    margin-right: 0;
}

.ck-content [style*="text-align:left"] figure.image,
.ck-content [style*="text-align: left"] figure.image {
    margin-left: 0;
    margin-right: auto;
}

/* 링크 스타일 */
.ck-content a {
    color: #4a90e2;
    text-decoration: none;
}

.ck-content a:hover {
    text-decoration: underline;
}

/* 코드 블록 스타일 */
.ck-content pre {
    background-color: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    overflow-x: auto;
}

.ck-content code {
    background-color: #f4f4f4;
    padding: 2px 4px;
    border-radius: 2px;
    font-family: 'Courier New', monospace;
}

/* 수평선 스타일 */
.ck-content hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 20px 0;
}

/* CKEditor5 글자 크기 클래스 */
.ck-content .text-tiny {
    font-size: 0.7em;
}

.ck-content .text-small {
    font-size: 0.85em;
}

.ck-content .text-big {
    font-size: 1.4em;
}

.ck-content .text-huge {
    font-size: 1.8em;
}

/* 제목 스타일 */
.ck-content h1 {
    font-size: 28px;
    margin: 20px 0 15px;
}

.ck-content h2 {
    font-size: 24px;
    margin: 18px 0 12px;
}

.ck-content h3 {
    font-size: 20px;
    margin: 15px 0 10px;
}

.ck-content h4 {
    font-size: 18px;
    margin: 12px 0 8px;
}

/* 프라이즈 에디터 전용 스타일 */
.prize-editor-wrapper .ck-editor {
    border: 1px solid #ddd;
    border-radius: 4px;
}

.prize-editor-wrapper .ck-content {
    min-height: 250px;
}

/* CKEditor5 전역 스타일 보호 */
.ck-reset_all,
.ck-reset_all * {
    box-sizing: border-box !important;
}

/* 폰트 크기 관련 전역 스타일 리셋 */
.ck-dropdown__panel .ck-list {
    font-size: 13px !important;
}

.ck-dropdown__panel .ck-button {
    font-size: 13px !important;
    text-align: left !important;
}

/* 폰트 크기 옵션별 실제 크기 표시 */
.ck-font-size-option[data-value="8"] { font-size: 8px !important; }
.ck-font-size-option[data-value="9"] { font-size: 9px !important; }
.ck-font-size-option[data-value="10"] { font-size: 10px !important; }
.ck-font-size-option[data-value="11"] { font-size: 11px !important; }
.ck-font-size-option[data-value="12"] { font-size: 12px !important; }
.ck-font-size-option[data-value="14"] { font-size: 14px !important; }
.ck-font-size-option[data-value="16"] { font-size: 16px !important; }
.ck-font-size-option[data-value="18"] { font-size: 18px !important; }
.ck-font-size-option[data-value="20"] { font-size: 20px !important; }
.ck-font-size-option[data-value="22"] { font-size: 22px !important; }
.ck-font-size-option[data-value="24"] { font-size: 24px !important; }
.ck-font-size-option[data-value="26"] { font-size: 26px !important; }
.ck-font-size-option[data-value="28"] { font-size: 28px !important; }
.ck-font-size-option[data-value="30"] { font-size: 30px !important; }
.ck-font-size-option[data-value="36"] { font-size: 36px !important; }
.ck-font-size-option[data-value="48"] { font-size: 48px !important; }
.ck-font-size-option[data-value="72"] { font-size: 72px !important; }

/* 반응형 처리 */
@media (max-width: 768px) {
    .ck-toolbar {
        flex-wrap: wrap;
    }

    .ck-toolbar__items {
        flex-wrap: wrap;
    }
}

/* 테이블 셀 내 에디터 조정 */
.tblBox01 .editor-cell {
    padding: 0;
}

.tblBox01 .editor-cell .ck-editor {
    border: none;
    border-radius: 0;
}

/* 읽기 전용 모드 스타일 */
.ck-editor__editable.ck-read-only {
    background-color: #f5f5f5;
    color: #666;
}

/* 에디터 로딩 중 스타일 */
.ck-editor-loading {
    position: relative;
    min-height: 300px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ck-editor-loading::after {
    content: '에디터 로딩 중...';
    color: #999;
    font-size: 14px;
}