* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f0f2f5;
    color: #222;
}

.editor-wrapper {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px 40px;
}

.editor-header {
    background: #fff;
    padding: 16px 20px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    margin-bottom: 16px;
}

.editor-header label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

#post-title {
    width: 100%;
    padding: 10px 12px;
    font-size: 20px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    margin-bottom: 10px;
}

.editor-slug-wrap {
    margin-top: 8px;
}

.slug-input-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #6b7280;
}

.slug-prefix {
    white-space: nowrap;
}

#post-slug {
    flex: 1;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    font-size: 13px;
}

/* 메인 레이아웃 */

.editor-main {
    display: grid;
    grid-template-columns: minmax(0, 2.5fr) 1.1fr;
    gap: 16px;
}

/* 콘텐츠 영역 */

.editor-content-area {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    padding: 10px 12px 16px;
}

.editor-tabs {
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 8px;
}

.tab-btn {
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: #6b7280;
}

.tab-btn.active {
    border-color: #2563eb;
    color: #111827;
    font-weight: 600;
}

/* 툴바 */

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 4px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    margin-bottom: 8px;
}

.editor-toolbar button {
    border: 1px solid transparent;
    background: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.editor-toolbar button:hover {
    border-color: #d1d5db;
    background: #f3f4f6;
}

.toolbar-divider {
    border-left: 1px solid #e5e7eb;
    margin: 0 4px;
}

/* 비주얼 에디터 */

.editor-visual {
    min-height: 320px;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
}

.editor-visual:focus {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

/* HTML 에디터 */

.editor-html {
    display: none;
    width: 100%;
    min-height: 320px;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* 사이드바 */

.editor-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    padding: 10px 12px 12px;
    font-size: 13px;
}

.panel h3 {
    margin: 0 0 8px;
    font-size: 14px;
}

.panel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 6px;
}

.panel-row span {
    white-space: nowrap;
}

.panel-row select,
.panel-row input[type="datetime-local"] {
    flex: 1;
    padding: 4px 6px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
}

.panel-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.panel-actions button {
    border-radius: 4px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}

.panel-actions button.primary {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #fff;
}

/* 대표 이미지 */

.featured-image-preview {
    margin-top: 8px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px dashed #d1d5db;
    padding: 6px;
    text-align: center;
    min-height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.featured-image-preview img {
    max-width: 100%;
    max-height: 160px;
    border-radius: 4px;
}

/* ----- 에디터 이미지 모달 ----- */
.editor-modal-backdrop {
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-modal {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.35);
    width: 480px;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 14px;
}

.editor-modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.editor-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.editor-modal-close {
    border: none;
    background: none;
    font-size: 16px;
    cursor: pointer;
    color: #6b7280;
}

.editor-modal-close:hover {
    color: #111827;
}

.editor-modal-body {
    padding: 14px 18px 10px;
    overflow-y: auto;
}

.editor-modal-tabs {
    display: flex;
    border-radius: 9999px;
    background: #f3f4f6;
    padding: 3px;
    margin-bottom: 12px;
    gap: 3px;
}

.editor-modal-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 5px 0;
    font-size: 13px;
    border-radius: 9999px;
    cursor: pointer;
    color: #6b7280;
}

.editor-modal-tab.active {
    background: #ffffff;
    color: #111827;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.editor-modal-pane {
    margin-top: 6px;
}

.editor-modal-label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    color: #4b5563;
}

.editor-modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 9px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 13px;
}

.editor-modal-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

/* 드롭존 */
.editor-upload-drop {
    display: block;
    border-radius: 10px;
    border: 1px dashed #cbd5e1;
    padding: 16px 12px;
    text-align: center;
    background: #f9fafb;
    cursor: pointer;
}

.editor-upload-drop:hover {
    background: #f3f4f6;
    border-color: #94a3b8;
}

.editor-upload-drop .drop-main-text {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 4px;
}

.editor-upload-drop .drop-sub-text {
    display: block;
    font-size: 12px;
    color: #6b7280;
}

/* 미리보기 */
.editor-upload-preview {
    margin-top: 10px;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    text-align: center;
}

.editor-upload-preview img {
    max-width: 100%;
    max-height: 220px;
    display: inline-block;
}

/* 푸터 버튼 */
.editor-modal-footer {
    padding: 10px 18px 12px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.editor-modal-footer .btn-cancel,
.editor-modal-footer .btn-primary {
    min-width: 70px;
    border-radius: 9999px;
    font-size: 13px;
    padding: 6px 12px;
    border: none;
    cursor: pointer;
}

.editor-modal-footer .btn-cancel {
    background: #e5e7eb;
    color: #111827;
}

.editor-modal-footer .btn-cancel:hover {
    background: #d1d5db;
}

.editor-modal-footer .btn-primary {
    background: #1d4ed8;
    color: #ffffff;
}

.editor-modal-footer .btn-primary:hover {
    background: #1e40af;
}

/* 반응형 */

@media (max-width: 900px) {
    .editor-main {
        grid-template-columns: 1fr;
    }
}

.editor-img-wrap {
    display: inline-block;
    position: relative;
}

.editor-img-resize-handle {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 12px;
    height: 12px;
    border: 1px solid #4b5563;
    background: #ffffff;
    cursor: se-resize;
    box-shadow: 0 0 2px rgba(0,0,0,.3);
    border-radius: 2px;
}