/*
 * MultyBBSwrite 전용 보완 CSS
 * 원본 /assets/styles.css의 디자인을 유지하면서 ASP.NET Web Forms/CHEditor 렌더링만 보정합니다.
 */

/* Google Fonts가 차단/오프라인이어도 한글이 깨져 보이지 않도록 Windows 한글 폰트 fallback */
#board-write,
#board-write input,
#board-write textarea,
#board-write select,
#board-write button,
#board-write a {
    font-family: 'Noto Sans KR', 'Malgun Gothic', '맑은 고딕', AppleGothic, sans-serif;
}

#board-write h1,
#board-write h2,
#board-write h3,
#board-write h4 {
    font-family: 'Noto Serif KR', 'Nanum Myeongjo', 'Batang', '바탕', serif;
}

#board-write.board-write-section {
    padding-top: 40px;
}

#board-write .board-write-wrap {
    max-width: 790px;
}

/* ASP.NET TextBox가 브라우저 기본 스타일을 끌고 오지 않도록 원본 form-input과 동일하게 고정 */
#board-write .form-input {
    display: block;
    min-height: 46px;
    margin: 0;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

#board-write .form-label .req,
#board-write .req {
    color: var(--gold);
    margin-left: 2px;
}

#board-write .notice-inline,
#board-write .security-inline {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
    font-size: 13px;
    color: var(--ink-soft);
}

#board-write .notice-inline input,
#board-write .security-inline input,
#board-write .radio-list input {
    accent-color: var(--sea);
}

#board-write .radio-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    font-size: 13.5px;
    color: var(--ink);
}

#board-write .radio-list tbody,
#board-write .radio-list tr,
#board-write .radio-list td {
    display: contents;
}

#board-write .radio-list label {
    margin-left: 5px;
}

/* textarea는 CHEditor 로딩 실패 시에도 원본 시안 형태로 보임 */
#board-write .bbs-editor-source {
    width: 100%;
    min-height: 260px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    box-sizing: border-box;
    font-size: 14px;
    color: var(--ink);
    background: #fff;
    line-height: 1.7;
    resize: vertical;
}

#board-write .bbs-editor-source:focus {
    outline: none;
    border-color: var(--gold);
}

/* =========================================================
   CHEditor 전용 레이아웃 보정
   - 실제 DOM 구조(.cheditor-container / .cheditor-editarea-wrapper /
     iframe.cheditor-editarea)에만 적용
   - 숨김 iframe에는 영향을 주지 않음
   ========================================================= */
#board-write .bbs-editor-wrap {
    width: 100%;
    max-width: 100%;
    overflow: visible;
    position: relative;
}

/* CHEditor 전체 컨테이너 */
#board-write .cheditor-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* CHEditor 툴바
   inline height:47px 때문에 줄바꿈 시 겹치는 현상을 방지 */
#board-write .cheditor-tb-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 47px;
    box-sizing: border-box !important;
    overflow: visible !important;
    display: flow-root;
}

/* 실제 편집영역 wrapper */
#board-write .cheditor-editarea-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    float: none !important;
    clear: both !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden;
}

/* 실제 글 작성 iframe만 전체 폭으로 확장
   .cheditor-container 마지막의 display:none 숨김 iframe은 건드리지 않음 */
#board-write iframe.cheditor-editarea {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    display: block !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* 하단 상태바 / 리사이즈바 */
#board-write .cheditor-modify-block,
#board-write .cheditor-tag-path,
#board-write .cheditor-resizebar,
#board-write .cheditor-viewmode {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box !important;
}

/* 공통 사이트 CSS의 img { max-width:100%; display:block; }가
   CHEditor 내부 아이콘/버튼 레이아웃에 영향을 주지 않도록 보호 */
#board-write .cheditor-container img {
    max-width: none !important;
    display: inline !important;
}

/* 툴바 버튼들이 사이트 공통 스타일 영향을 덜 받도록 보호 */
#board-write .cheditor-tb-wrapper button,
#board-write .cheditor-tb-wrapper input,
#board-write .cheditor-tb-wrapper select {
    box-sizing: content-box;
}

#board-write .form-actions .asp-save {
    font: inherit;
    text-decoration: none;
}

#board-write .bbs-access-denied {
    text-align: center;
    color: var(--ink-soft);
}

/* 파일첨부 컨트롤은 기존 code-behind 컴파일 호환용으로만 존재하며 절대 표시하지 않음 */
.bbs-hidden-compat {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

@media (max-width: 760px) {
    #board-write.board-write-section {
        padding-top: 26px;
    }

    #board-write .board-write-wrap {
        padding-left: 18px;
        padding-right: 18px;
    }

    #board-write .form-card {
        padding: 26px 20px;
    }

    #board-write .form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    #board-write .form-actions .btn {
        width: 100%;
    }
}