/* [admin.css v3.0.6] - Real-View Style Sync & Blank Support */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

body { 
    font-family: 'Pretendard', -apple-system, sans-serif; 
    background: #f4f6f8; margin: 0; color: #333; overflow: hidden; 
    height: 100vh; height: 100dvh; 
    display: flex; flex-direction: column; 
}
body.resizing { cursor: col-resize; user-select: none; }

::-webkit-scrollbar { width: 6px; } ::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

#login-view { position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; background: #333; z-index: 9999; }
.login-box { background: white; padding: 40px; border-radius: 12px; text-align: center; width: 320px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.login-box input { width: 100%; padding: 12px; margin: 10px 0; border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; }
.login-box button { width: 100%; padding: 12px; background: #333; color: white; border: none; font-weight: bold; cursor: pointer; border-radius: 6px; }

#admin-view { display: none; flex: 1; flex-direction: column; height: 100%; }

/* Header & Buttons */
header { background: #333; color: white; padding: 0 20px; height: 56px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.header-title { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.5px; }

.header-btn { 
    margin-left: 6px; padding: 0 16px; height: 36px; min-width: 100px; 
    border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; cursor: pointer; 
    font-weight: 600; background: #444; color: white; font-size: 0.9rem; 
    transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.header-btn:hover { background: #555; border-color: rgba(255,255,255,0.5); }

/* 기본 활성 버튼 색상 (Article, List 등) - 기존 파란색 유지 */
.header-btn.active {
    background: #007bff;
    border-color: #0056b3;
    color: white;
}

/* [신규] 매거진 버튼 전용 활성 스타일 (보라색) */
#btn-mag.active {
    background-color: #6f42c1 !important;
    border-color: #59359a !important;
    color: white !important;
}

/* 매거진 버튼 호버 효과 (비활성일 때) */
#btn-mag:hover:not(.active) {
    background-color: #555; /* 다른 버튼과 동일한 호버 색상 */
    border-color: rgba(255,255,255,0.5);
}

.btn-backup { background: #ff5e00; border-color: #e04e00; min-width: auto; padding: 0 16px; } 
.btn-backup:hover { background: #e04e00; }

/* Layout Containers */
.container { flex: 1; display: flex; padding: 10px; gap: 0; overflow: hidden; min-height: 0; }
.panel { background: white; border-radius: 8px; border: 1px solid #e0e0e0; display: none; flex-direction: column; overflow: hidden; -webkit-overflow-scrolling: touch; box-shadow: 0 2px 10px rgba(0,0,0,0.03); }
.panel.active { display: flex; }

.list-panel { width: 280px; min-width: 240px; max-width: 400px; flex: none; display: flex; flex-direction: column; margin-right: 5px; }

#resize-handle { width: 8px; background: transparent; cursor: col-resize; flex: none; margin: 0 1px; border-radius: 4px; transition: background 0.2s; }
#resize-handle:hover, #resize-handle.active { background: #d0d7de; }

/* List View */
.list-search-box { padding: 10px; border-bottom: 1px solid #eee; background: #fdfdfd; }
.search-row { display: flex; gap: 5px; margin-bottom: 5px; }
.search-row input { flex: 1; padding: 8px 10px; box-sizing: border-box; border: 1px solid #ddd; border-radius: 6px; outline: none; height: 36px; }
.search-row input:focus { border-color: #333; }
.btn-filter-toggle, .btn-filter-reset { width: 36px; height: 36px; padding: 0; border: 1px solid #ddd; border-radius: 6px; background: white; cursor: pointer; color: #555; font-size: 1.1rem; flex-shrink: 0; transition: all 0.2s; }
.btn-filter-toggle:hover { background: #f0f0f0; border-color: #999; }
.btn-filter-reset { color: #dc3545; margin-right: 2px; }
.btn-filter-reset:hover { background: #fdf2f2; border-color: #dc3545; }

/* [admin.css] 수정: 필터 영역 Grid 레이아웃 적용 */

/* 기존 display: none 제거 -> 기본 표시 */
#list-filter-options { 
    display: grid; /* Flex 대신 Grid 사용 */
    grid-template-columns: repeat(3, 1fr); /* 3열로 분할 (타입/언어/공개) */
    gap: 5px; 
    margin-top: 8px; 
    padding-top: 8px;
    border-top: 1px dashed #eee; /* 위쪽 구분선 추가 */
}

/* 셀렉트 박스 스타일 최적화 (좁은 공간 대응) */
#list-filter-options select { 
    width: 100%; 
    padding: 4px 2px; /* 패딩 축소 */
    border: 1px solid #ddd; 
    border-radius: 4px; 
    font-size: 0.8rem; /* 글자 크기 축소 */
    background: #fff; 
    cursor: pointer; 
    outline: none; 
    text-overflow: ellipsis; /* 글자 넘침 시 ... 처리 */
    white-space: nowrap;
    overflow: hidden;
}

/* 카테고리 필터는 2번째 줄 전체 차지 */
#list-filter-options select#filter-cat {
    grid-column: span 3; /* 3칸 병합 */
    font-weight: 600;
    color: #555;
}

#post-list-container { flex: 1; overflow-y: auto; }
.list-item { padding: 12px 15px; border-bottom: 1px solid #f5f5f5; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; }
.list-item:hover { background: #f9f9f9; }
.post-info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.9rem; max-width: 100%; } 
.post-meta-badges { display: flex; gap: 4px; align-items: center; }
.lang-badge { font-size: 0.65rem; font-weight: bold; padding: 2px 5px; border-radius: 3px; color: #fff; }
.lang-badge.lang-kr { background-color: #007bff; }
.lang-badge.lang-en { background-color: #dc3545; }
.ver-badge { font-size: 0.65rem; font-weight: bold; padding: 2px 5px; border-radius: 3px; background: #eee; color: #555; }

/* Panels Common */
.editor-panel, .cat-manager-panel, .comment-manager-panel, .link-manager-panel, .style-manager-panel { flex: 1; padding: 15px; margin-left: 5px; }
.editor-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-shrink: 0; height: 32px; }
.editor-title-display { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; color: #333; }
.header-icon-box { background: #eee; width: 28px; height: 28px; border-radius: 6px; display: flex; justify-content: center; align-items: center; font-size: 1.1rem; }
.editor-header-buttons { display: flex; gap: 6px; flex-shrink: 0; }

.btn-action { padding: 0 12px; height: 30px; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 0.85rem; color: white; white-space: nowrap; transition: filter 0.2s; display: inline-flex; align-items: center; justify-content: center; }
.btn-action:hover { filter: brightness(90%); }
.btn-save { background: #333; } .btn-vup { background: #28a745; } .btn-hist { background: #17a2b8; } .btn-del { background: #fff; border: 1px solid #dc3545; color: #dc3545; }

/* Editor Meta Form */
.meta-form { display: flex; flex-direction: column; gap: 4px; margin-bottom: 5px; flex-shrink: 0; background: #f8f9fa; padding: 8px 12px; border-radius: 8px; border: 1px solid #eee; transition: all 0.2s; }
.meta-form.collapsed { display: none; }
.form-row { display: flex; gap: 8px; }
.form-group { flex: 1; display: flex; flex-direction: column; }
.form-group label { font-size: 0.7rem; font-weight: 700; color: #666; margin-bottom: 1px; text-transform: uppercase; }
.form-group input, .form-group select { padding: 4px 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.85rem; height: 28px; outline: none; }
.form-group input:focus { border-color: #333; }

/* Editor Canvas */
.editor-wrapper { flex: 1; border: 1px solid #ccc; border-radius: 6px; display: flex; flex-direction: column; background: #fff; overflow: hidden; min-height: 0; position: relative; }
.editor-toolbar { background: #f1f1f1; padding: 4px 10px; border-bottom: 1px solid #ccc; display: flex; gap: 6px; align-items: center; flex-shrink: 0; height: 32px; overflow-x: auto; }
.tool-btn { background: #fff; border: 1px solid #bbb; cursor: pointer; padding: 2px 8px; font-size: 0.8rem; border-radius: 4px; font-weight: 600; white-space: nowrap; }
.tool-btn:hover { background: #e9ecef; border-color: #999; }

.editor-header-strip { display: flex; background: #f8f9fa; border-bottom: 1px solid #ddd; height: 28px; align-items: center; font-size: 0.75rem; color: #888; font-weight: bold; user-select: none; flex-shrink: 0; }
.col-no { width: 35px; text-align: center; border-right: 1px solid #eee; }
.col-check { width: 30px; display: flex; justify-content: center; border-right: 1px solid #eee; }
.col-type, .col-align { width: 70px; display: flex; justify-content: center; border-right: 1px solid #eee; }
.col-content { flex: 1; padding-left: 10px; }
.col-type select, .col-align select { border: none; background: transparent; font-size: 0.75rem; font-weight: bold; color: #555; cursor: pointer; outline: none; width: 100%; text-align: center; }

#vf-editor-canvas { flex: 1; overflow-y: auto; padding: 0 0 80px 0; background: #fff; -webkit-overflow-scrolling: touch; }
#vf-raw-textarea { flex: 1; width: 100%; height: 100%; border: none; padding: 20px; font-family: monospace; font-size: 0.95rem; resize: none; display: none; box-sizing: border-box; }

.sheet-tabs { display: flex; background: #e0e0e0; border-top: 1px solid #ccc; height: 32px; flex-shrink: 0; }
.sheet-tab { padding: 0 20px; display: flex; align-items: center; font-size: 0.85rem; cursor: pointer; background: #e0e0e0; color: #666; border-right: 1px solid #ccc; font-weight: 600; }
.sheet-tab.active { background: #fff; color: #28a745; border-bottom: 3px solid #28a745; margin-bottom: -1px; }

/* Blocks - Visual Sync & Real View Style */
.vf-block { display: flex; border-bottom: 1px solid #f0f0f0; min-height: 28px; align-items: stretch; }
.vf-block.selected { background-color: #e8f0fe; }
.vf-blk-no, .vf-blk-check, .vf-blk-type, .vf-blk-align { flex-shrink: 0; background: #fff; display: flex; align-items: center; justify-content: center; font-family: monospace; cursor: pointer; border-right: 1px solid #f5f5f5; }
.vf-blk-no { width: 35px; color: #aaa; font-size: 0.7rem; }
.vf-blk-check { width: 30px; background: #fafafa; }
.vf-blk-type, .vf-blk-align { width: 70px; font-size: 0.7rem; color: #666; }
.vf-content { flex: 1; outline: none; padding: 6px 12px; line-height: 1.6; font-size: 0.95rem; word-break: break-all; }

/* [Modified] Remove artificial backgrounds, sync with real view */
.vf-block[data-type="L1"] .vf-content { font-size: 1.35em; font-weight: 800; color: #111; margin-top: 5px; margin-bottom: 5px; }
.vf-block[data-type="L2"] .vf-content { font-size: 1.1em; font-weight: 600; color: #222; padding-left: 20px; margin-top: 5px; }
.vf-block[data-type="L3"] .vf-content { font-size: 0.95em; font-weight: 600; color: #444; padding-left: 30px; }
.vf-block[data-type="L4"] .vf-content { font-size: 0.95em; font-weight: 400; color: #444; padding-left: 40px; }
.vf-block[data-type="L5"] .vf-content { font-size: 0.95em; font-weight: 400; color: #666; padding-left: 60px; }
.vf-block[data-type="L6"] .vf-content { font-size: 0.95em; font-weight: 400; color: #666; padding-left: 80px; }
.vf-block[data-type="L7"] .vf-content { font-size: 0.9em; font-weight: 400; color: #777; padding-left: 100px; font-style: italic; }

/* [New] Blank Block Style */
.vf-block[data-type="blank"] .vf-content { min-height: 28px; } /* Ensure clickability */

.vf-block[data-type="table"] .vf-content { padding: 10px; background: #fff; overflow-x: auto; }
.vf-block[data-type="table"] table { width: 100%; border-collapse: collapse; border: 1px solid #ddd; }
.vf-block[data-type="table"] td, .vf-block[data-type="table"] th { border: 1px solid #ddd; padding: 6px; }
.vf-block[data-align="c"] .vf-content { text-align: center; }
.vf-block[data-align="r"] .vf-content { text-align: right; }

/* Toggle Button & Other UI */
.btn-icon-toggle { background: transparent; border: 1px solid #ccc; border-radius: 4px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 0.8rem; color: #666; margin-left: 8px; }
.btn-icon-toggle:hover { background: #eee; }

/* Style Manager Table */
#style-rules-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.9rem; table-layout: fixed; }
#style-rules-table th, #style-rules-table td { border: 1px solid #ddd; padding: 6px; text-align: left; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
#style-rules-table th { background: #f8f9fa; font-weight: bold; color: #555; text-align: center; }
.col-style-trigger { width: 8%; } .col-style-prefix { width: 14%; } .col-style-size { width: 7%; } .col-style-color { width: 7%; } .col-style-font { width: 12%; } .col-style-align { width: 9%; } .col-style-desc { width: auto; } .col-style-move { width: 60px; text-align: center; } .col-style-action { width: 50px; text-align: center; }
#style-rules-table input[type="text"] { width: 100%; padding: 4px; box-sizing: border-box; border: 1px solid #ccc; border-radius: 4px; }
#style-rules-table input[type="color"] { width: 30px; height: 26px; border: none; background: none; cursor: pointer; padding: 0; }
.style-check-label { font-size: 0.8rem; margin-right: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.btn-move { background: white; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; padding: 2px 6px; color: #555; margin: 0 2px; font-size: 0.8rem; }
.btn-move:hover { background: #f0f0f0; color: #000; border-color: #bbb; }

/* Context Menu */
.context-menu { display: none; position: absolute; background: white; border: 1px solid #ccc; box-shadow: 0 4px 12px rgba(0,0,0,0.15); border-radius: 6px; z-index: 200; padding: 5px; width: 130px; }
.gm-header { font-size: 0.7rem; font-weight: bold; color: #aaa; padding: 4px 12px; border-bottom: 1px solid #eee; margin-bottom: 4px; }
.gm-item { padding: 8px 12px; cursor: pointer; font-size: 0.85rem; display: block; border-radius: 4px; }
.gm-item:hover { background: #f1f1f1; }
.gm-sep { height: 1px; background: #eee; margin: 4px 0; }

#history-modal { display: none; position: absolute; top: 50px; right: 20px; width: 280px; background: white; border: 1px solid #ccc; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 100; max-height: 400px; display: flex; flex-direction: column; }
.hist-header { padding: 12px; background: #f1f1f1; border-bottom: 1px solid #ddd; font-weight: bold; display: flex; justify-content: space-between; font-size: 0.9rem; border-radius: 8px 8px 0 0; }
.hist-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; }
.hist-item { padding: 10px 12px; border-bottom: 1px solid #eee; cursor: pointer; font-size: 0.85rem; }
.hist-item:hover { background: #f9f9f9; }

/* Category & Link Panels */
.cat-grid { display: flex; gap: 20px; height: 100%; }
.cat-col { flex: 1; background: white; border: 1px solid #e0e0e0; border-radius: 10px; padding: 15px; display: flex; flex-direction: column; }
.cat-col-header h3 { margin: 0 0 10px 0; font-size: 1rem; color: #555; text-transform: uppercase; font-weight: 800; border-bottom: 2px solid #333; padding-bottom: 8px; }
.cat-input-wrapper { display: flex; flex-direction: column; gap: 8px; padding: 15px; background: #f1f3f5; border-radius: 8px; margin-bottom: 15px; }
.cat-btn-row { display: flex; gap: 5px; }
.cat-add-btn { flex: 2; background: #333; color: white; border: none; padding: 8px; border-radius: 4px; cursor: pointer; font-weight: bold; }
.cat-reset-btn { flex: 1; background: #fff; border: 1px solid #ccc; color: #555; padding: 8px; border-radius: 4px; cursor: pointer; font-weight: bold; }
.cat-list-box { flex: 1; overflow-y: auto; border-top: 1px solid #eee; }
.cat-item { padding: 12px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; cursor: pointer; transition: all 0.2s; }
.cat-item:hover { background: #f8f9fa; }
.cat-item.selected { background: #e8f0fe; color: #1a73e8; font-weight: bold; border-left: 4px solid #1a73e8; }
.cat-item button { background: none; border: 1px solid #e0e0e0; color: #999; border-radius: 4px; padding: 2px 6px; cursor: pointer; }
.cat-item button:hover { background: #fff; color: #dc3545; border-color: #dc3545; }

@media (max-width: 768px) {
    .container { flex-direction: column; margin-top: 5px; }
    .list-panel { width: 100%; height: 200px; display: block; border-bottom: 1px solid #ddd; max-width: none; }
    .editor-panel { flex: 1; }
    #resize-handle { display: none; }
}

/* [admin.css] Magazine Block Editor Styles */
.mag-toolbar-strip {
    background: #fff; padding: 10px 15px; border-radius: 8px; border: 1px solid #e2e8f0;
    margin-bottom: 20px; display: flex; align-items: center; gap: 8px;
    position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.mag-tool-btn {
    background: #f5f3ff; color: #7c3aed; border: 1px solid #ddd6fe;
    padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.9rem;
    transition: 0.2s;
}
.mag-tool-btn:hover { background: #7c3aed; color: white; }

.mag-canvas { display: flex; flex-direction: column; gap: 15px; padding-bottom: 50px; }

/* 공통 블록 스타일 */
.mag-block-item {
    background: white; border: 1px solid #e2e8f0; border-radius: 8px; padding: 15px;
    position: relative; transition: transform 0.2s;
}
.mag-block-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.mag-block-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
    font-size: 0.8rem; color: #94a3b8; font-weight: 700; text-transform: uppercase;
}
.mag-btn-del { color: #ef4444; cursor: pointer; font-weight: bold; }

/* 타입별 스타일 */
.mag-text-input {
    width: 100%; border: 1px solid #cbd5e1; border-radius: 4px; padding: 10px;
    font-size: 1rem; line-height: 1.6; resize: vertical; min-height: 80px; box-sizing: border-box; font-family: inherit;
}
.mag-img-preview-box {
    display: flex; gap: 10px; flex-wrap: wrap; background: #f8fafc; padding: 10px; border-radius: 6px; min-height: 60px; align-items: center; justify-content: center; border: 2px dashed #e2e8f0; cursor: pointer;
}
.mag-img-preview-box:hover { border-color: #7c3aed; background: #fdfcff; }
.mag-img-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; border: 1px solid #ddd; }
.mag-empty-msg { color: #94a3b8; font-size: 0.9rem; pointer-events: none; }


/* [admin.css] Magazine Layout & Preview Styles */

/* 1. 작업 공간 분할 */
.mag-workspace {
    display: flex;
    flex: 1;
    overflow: hidden; /* 내부 스크롤 사용 */
    background: #f0f2f5;
    height: calc(100vh - 60px); /* 헤더 제외 높이 계산 */
}

/* 2. 좌측 에디터 패널 */
.mag-editor-area {
    flex: 1;
    min-width: 400px;
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid #ddd;
}

/* 3. 우측 미리보기 패널 */
.mag-preview-area {
    flex: 1;
    background: #e9ecef;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.mag-preview-header {
    margin-bottom: 15px;
    font-weight: bold;
    color: #555;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

/* [admin.css] 수정: 프리뷰 디바이스 스크롤 활성화 */
.mag-preview-device {
    width: 100%;
    max-width: 450px; /* 모바일 시뮬레이션 폭 */
    background: white;
    height: calc(100vh - 140px); /* [수정] 화면 높이에 맞춤 */
    min-height: 600px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    overflow-y: auto; /* [수정] 내부 스크롤 활성화 -> 전체 내용 확인 가능 */
    padding-bottom: 40px;
    border: 4px solid #333; /* 디바이스 베젤 느낌 추가 */
}
/* 스크롤바 숨김 (깔끔하게) */
.mag-preview-device::-webkit-scrollbar { width: 4px; }
.mag-preview-device::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }


.mag-preview-content {
    padding: 0;
}

/* --- [미리보기 내부 렌더링 스타일] --- */
/* 실제 뷰어(vf-core.js)와 유사하게 보이도록 스타일링 */

.pv-title { padding: 20px 20px 10px; font-size: 1.5rem; font-weight: 800; color: #111; line-height: 1.3; }
.pv-meta { padding: 0 20px 20px; color: #888; font-size: 0.85rem; border-bottom: 1px solid #eee; margin-bottom: 20px; }

.pv-block { margin-bottom: 20px; }

/* 텍스트 블록 */
.pv-text { 
    padding: 0 20px; font-size: 1rem; line-height: 1.7; color: #333; white-space: pre-wrap; 
}

/* 풀스크린 이미지 */
.pv-full img { width: 100%; display: block; height: auto; }

/* 그리드 (Bento Style) */
.pv-grid { 
    display: grid; gap: 4px; padding: 0 4px; 
    grid-template-columns: repeat(2, 1fr); 
}
.pv-grid img { 
    width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1/1; border-radius: 4px; 
}
/* 이미지가 3장일 때 첫번째 크게 */
.pv-grid[data-count="3"] img:first-child { grid-row: span 2; aspect-ratio: auto; }

/* 슬라이더 */
.pv-slider { 
    display: flex; gap: 10px; overflow-x: auto; padding: 0 20px; 
    scroll-snap-type: x mandatory; 
    -ms-overflow-style: none; scrollbar-width: none; /* 스크롤바 숨김 */
}
.pv-slider::-webkit-scrollbar { display: none; }
.pv-slider img { 
    flex: 0 0 85%; /* 옆에 조금 보이게 */
    scroll-snap-align: center;
    border-radius: 8px;
    width: 85%; aspect-ratio: 4/3; object-fit: cover;
}

/* [admin.css] 추가 코드 */

/* 빈줄(Blank) 블록 스타일링 */
.vf-block[data-type="blank"] {
    background-color: #fafafa; /* 아주 연한 회색 배경 */
}

.vf-block[data-type="blank"] .vf-content {
    min-height: 24px; /* 높이를 약간 줄임 */
    color: #ccc;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
}

/* 빈 줄임을 알려주는 가이드 텍스트 (타이핑 시 사라짐) */
.vf-block[data-type="blank"] .vf-content:empty::before,
.vf-block[data-type="blank"] .vf-content br:only-child::before {
    content: '(빈 줄)';
    color: #e0e0e0;
    pointer-events: none;
}

/* [admin.css] Magazine Tab View Styles */

/* 컨테이너 스타일 재정의 */
#magazine-ui { 
    background: #f8f9fa; 
    flex-direction: column; 
    overflow-y: hidden; /* 전체 스크롤 방지 (내부 스크롤 사용) */
    padding: 0 !important;
}

/* 탭 버튼 스타일 (기존 sheet-tab 활용) */
.sheet-tabs {
    display: flex;
    background: #e0e0e0;
    border-top: 1px solid #ccc;
    height: 36px;
    flex-shrink: 0;
    cursor: default;
}
.sheet-tab {
    padding: 0 20px;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    cursor: pointer;
    background: #e0e0e0;
    color: #666;
    border-right: 1px solid #ccc;
    font-weight: 600;
}
.sheet-tab.active {
    background: #fff;
    color: #7c3aed; /* 매거진 전용 컬러 */
    border-bottom: 3px solid #7c3aed;
    margin-bottom: -1px;
}

/* 에디터 폼 영역 넓게 쓰기 */
#mag-edit-container {
    max-width: none !important; /* [수정] 800px 제한 제거 */
    width: 100%;
    margin: 0;
    padding: 0; /* 내부 여백은 mag-content-body에서 처리됨 */
}

.mag-form-card, .mag-toolbar-strip, .mag-block-item {
    margin: 0 0 20px 0;
    width: 100%;
    box-sizing: border-box;
}

/* 미리보기 컨테이너 */
#mag-preview-container {
    background: #e9ecef; /* 배경색으로 구분 */
    height: 100%;
}

/* 기존 분할 레이아웃 잔재 제거 (필요시 삭제) */
.mag-workspace, .mag-editor-area, .mag-preview-area {
    display: block; 
    width: auto; 
    height: auto; 
    padding: 0; 
    border: none;
    overflow: visible;
}

/* 2. 폼 카드(기본정보) 숨김 스타일 추가 */
.mag-form-card {
    transition: all 0.3s ease;
    overflow: hidden;
}

.mag-form-card.collapsed {
    display: none !important; /* [추가] 접혔을 때 숨김 */
}

/* [admin.css] Ensure Full Screen & Tab Layout */

/* 패널 자체 여백 제거 */
#magazine-ui { 
    padding: 0 !important; 
    overflow: hidden !important;
}

/* 탭 버튼 스타일 보정 */
.sheet-tabs {
    margin: 0 !important; /* HTML 인라인 마진 강제 제거 */
    width: 100%;
}

/* 에디터 컨테이너 100% 보장 */
#mag-edit-container {
    width: 100% !important;
    max-width: none !important;
}

/* 폼 카드 숨김 애니메이션 */
.mag-form-card.collapsed {
    display: none !important;
}

/* [admin.css] Magazine Layout Fix & Grid System (Updated v2) */

/* 1. 패널 초기화 (Flex Item으로 복구하여 사이드바 유지) */
#magazine-ui {
    display: none;
    flex-direction: column;
    padding: 0 !important;
    background: #f4f6f8;
    overflow: hidden;
    /* 전체 화면 덮어쓰기 방지: Flex Item 속성 유지 */
    position: static !important; 
    flex: 1;       
    height: auto;
    width: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-left: 5px;
}

/* 2. 헤더 스타일 */
.mag-header-strip {
    background: #fff; border-bottom: 1px solid #ddd;
    padding: 12px 20px;
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0;
}
.mag-header-left { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 800; color: #7c3aed; }
.mag-header-right { display: flex; gap: 6px; }

/* 3. 탭 스타일 */
.sheet-tabs {
    display: flex; background: #e9ecef; border-bottom: 1px solid #ccc;
    height: 40px; flex-shrink: 0; margin: 0 !important; width: 100%;
}
.sheet-tab {
    padding: 0 25px; display: flex; align-items: center;
    font-size: 0.95rem; font-weight: 600; color: #666; cursor: pointer;
    border-right: 1px solid #ccc; transition: 0.2s;
}
.sheet-tab.active { background: #f4f6f8; color: #7c3aed; border-bottom: 3px solid #7c3aed; }
.sheet-tab:hover { background: #dee2e6; }

/* 4. 바디 래퍼 */
.mag-body-wrapper {
    flex: 1; overflow-y: auto; padding: 20px 30px; 
    box-sizing: border-box; width: 100%;
}

/* 5. 에디터 컨테이너 (작성 화면) */
#mag-edit-container {
    width: 100%; max-width: 1200px; margin: 0 auto;
}

/* 6. 메타 정보 폼 카드 (3줄 압축용 6열 그리드 적용) */
.mag-form-card {
    background: #fff; border: 1px solid #ddd; border-radius: 8px;
    padding: 20px; margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1; max-height: 500px; overflow: visible;
}
.mag-form-card.collapsed {
    opacity: 0; max-height: 0; padding: 0; margin: 0; border: none; overflow: hidden;
}

.mag-grid-layout {
    display: grid;
    grid-template-columns: repeat(6, 1fr); /* [수정] 4열 -> 6열 (세밀한 조정 가능) */
    gap: 12px 15px; /* 간격 미세 조정 */
    align-items: end;
}

.mag-field { display: flex; flex-direction: column; gap: 5px; }
.mag-field label { font-size: 0.75rem; font-weight: 700; color: #666; text-transform: uppercase; margin-left: 2px; }
.mag-field input, .mag-field select {
    width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 0.9rem; box-sizing: border-box; outline: none; transition: 0.2s;
    background: #fdfdfd; height: 36px; /* 높이 통일 */
}
.mag-field input:focus, .mag-field select:focus { border-color: #7c3aed; background: #fff; }

/* Grid Span 유틸리티 (6열 기준) */
.span-1 { grid-column: span 1; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } /* Full Width */

/* 7. [수정] 미리보기 컨테이너 (Real View - PC 스타일) */
#mag-preview-container {
    width: 100%; height: 100%;
    display: flex; justify-content: center; /* 중앙 정렬 */
    padding-bottom: 50px;
}

.mag-preview-device {
    width: 100%;
    max-width: 900px; /* 실제 사이트 본문 폭과 유사하게 설정 */
    min-height: 800px;
    background: white; /* 배경 흰색 */
    box-shadow: 0 5px 20px rgba(0,0,0,0.05); /* 은은한 그림자 */
    border: 1px solid #eee; /* 검정 테두리 제거 -> 연한 회색 */
    border-radius: 0; /* 둥근 모서리 제거 (PC 느낌) */
    padding: 40px; /* 내부 여백 */
    overflow-y: visible; /* 스크롤은 부모(mag-body-wrapper)가 처리 */
}

/* 8. 반응형 처리 */
@media (max-width: 1000px) {
    .mag-grid-layout { grid-template-columns: repeat(2, 1fr); }
    .span-1, .span-2, .span-3, .span-4, .span-5, .span-6 { grid-column: span 1; }
    .mag-preview-device { padding: 20px; }
}

/* 툴바 & 캔버스 */
.mag-toolbar-strip { top: 0; position: sticky; z-index: 10; margin-bottom: 20px; }
.mag-canvas { padding-bottom: 100px; }


/* [admin.css] Image Resizer Handle Styles */

/* 이미지 컨테이너를 상대 위치로 설정 (핸들 위치 기준점) */
.vf-content {
    position: relative; 
    display: block; /* 인라인 블록 문제 방지 */
}

/* 선택된 이미지 표시 (선택사항: 테두리) */
.vf-content img.active-img {
    outline: 2px solid #007bff;
    cursor: default;
}

/* 리사이즈 핸들 (우측 하단 파란 네모) */
.vf-resizer-handle {
    width: 12px;
    height: 12px;
    background: #007bff;
    border: 1px solid #fff;
    position: absolute;
    right: 0;
    bottom: 0;
    cursor: nwse-resize; /* 대각선 크기 조절 커서 */
    z-index: 100;
    display: none; /* 기본 숨김 */
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* [admin.css] Math Tool Styles */

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 2000;
    display: flex; justify-content: center; align-items: center;
}

.modal-box.math-modal-box {
    background: white; padding: 25px; border-radius: 12px;
    width: 550px; max-width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex; flex-direction: column;
}

#math-input-source {
    width: 100%; height: 100px; padding: 12px;
    border: 1px solid #ddd; border-radius: 6px;
    font-family: monospace; font-size: 1rem;
    resize: vertical; box-sizing: border-box;
}

.math-preview-box {
    min-height: 80px; padding: 15px; margin-top: 5px;
    background: #fff; border: 1px solid #e0e0e0; border-radius: 6px;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.5rem; overflow-x: auto;
}