/**
 * 협업 문서 스타일
 */

/* ===== 클라우드 인증 영역 (우측 상단 고정) ===== */

.cloud-auth-area {
    position: fixed;
    top: 16px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 900;
}

.cloud-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    color: #555;
    transition: background 0.15s, box-shadow 0.15s;
}

.cloud-login-btn:hover {
    background: #f8f8f8;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.cloud-user-area {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #555;
}

.cloud-user-photo {
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.cloud-user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cloud-logout-btn {
    display: inline-flex;
    align-items: center;
    padding: 4px;
    border: none;
    background: none;
    cursor: pointer;
    color: #999;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.cloud-logout-btn:hover {
    color: #e74c3c;
    background: #fef0f0;
}

.cloud-saved-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1px solid #b8d4e3;
    border-radius: 20px;
    background: #f0f8ff;
    cursor: pointer;
    font-size: 0.8rem;
    color: #3a7cbd;
    transition: background 0.15s, box-shadow 0.15s;
}

.cloud-saved-btn:hover {
    background: #e0f0ff;
    box-shadow: 0 1px 4px rgba(58,124,189,0.15);
}

/* 문서 목록 패널 */
.saved-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 400px;
    max-height: 420px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.saved-panel.open {
    display: flex;
}

.saved-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
}

.saved-panel-close {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: #999;
    padding: 2px 6px;
    border-radius: 4px;
}

.saved-panel-close:hover {
    background: #f0f0f0;
    color: #333;
}

.saved-list-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.saved-loading,
.saved-empty {
    padding: 20px;
    text-align: center;
    color: #aaa;
    font-size: 0.8rem;
}

.saved-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background 0.12s;
}

.saved-item:hover {
    background: #f0f8ff;
}

.saved-item-info {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.saved-item-title {
    font-size: 0.82rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-item-date {
    font-size: 0.7rem;
    color: #aaa;
    margin-top: 2px;
}

.saved-item-pin {
    flex-shrink: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: #ccc;
    fill: none;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s, fill 0.15s, background 0.15s;
}

.saved-item-pin:hover {
    color: #f0a030;
    background: #fef8ee;
}

.saved-item-pin.pinned {
    color: #e8930c;
    fill: #e8930c;
}

.saved-item-pin.pinned:hover {
    color: #c07808;
    fill: #c07808;
    background: #fef3e0;
}

.saved-item-delete {
    flex-shrink: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: #ccc;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.saved-item-delete:hover {
    color: #e74c3c;
    background: #fef0f0;
}

/* 페이지 스크롤 제거, 뷰포트 꽉 채우기 */
html, body {
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
}

.footer {
    margin-top: 0 !important;
    padding: 6px 20px !important;
    flex-shrink: 0;
}

.page-header {
    flex-shrink: 0;
    padding-bottom: 6px;
}

.page-header .title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.page-header h1 {
    font-size: 1.6rem;
    margin-bottom: 0;
}

.page-header .subtitle {
    text-align: center;
    margin-top: 2px;
    margin-bottom: 0;
    font-size: 0.85rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}

.share-btn:hover {
    opacity: 0.9;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.share-btn:active {
    opacity: 0.8;
}

/* ===== 에디터 페이지 ===== */
.editor-container {
    width: 100%;
    max-width: 1230px;
    margin: 0 auto;
    padding: 12px 20px 0;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 커스텀 툴바 기능 버튼 */
.toolbar-right {
    margin-left: auto !important;
    display: flex;
    align-items: center;
    gap: 2px;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: #555;
    border-radius: 4px;
    transition: background 0.12s, color 0.12s;
}

.toolbar-btn:hover {
    background: #e8e8f0;
    color: #333;
}

.toolbar-btn:active {
    background: #ddd;
}

.toolbar-sep {
    width: 1px;
    height: 18px;
    background: #ddd;
    margin: 0 4px;
}

/* 용지 크기 버튼 */
.paper-size-btn {
    width: auto !important;
    gap: 3px;
    padding: 0 6px !important;
    font-size: 0.72rem;
}

.paper-size-label {
    font-weight: 600;
    color: #555;
    min-width: 32px;
    text-align: center;
}

/* 프레즌스 바 */
.presence-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    margin-bottom: 8px;
    min-height: 28px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.presence-user {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    animation: fadeIn 0.3s ease;
}

.presence-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: white;
    opacity: 0.7;
}

.presence-me {
    opacity: 0.6;
}

.archive-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fcd34d;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* ===== 문서 영역 (Quill) ===== */
.document-wrapper {
    flex: 1;
    min-height: 0;
    width: 100%;
    margin: 0 auto;
    background: linear-gradient(135deg, #e8eaf6 0%, #f3e5f5 100%);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: visible;
    position: relative;
}

/* Quill 커스터마이즈 */
.ql-toolbar.ql-snow {
    border: none;
    border-bottom: 1px solid #eee;
    padding: 8px 12px;
    background: #fafbfc;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

/* 툴바 버튼 확대 (scale은 클릭 영역 문제가 있어 button에만 사용) */
.ql-toolbar.ql-snow button {
    width: 32px !important;
    height: 32px !important;
    padding: 4px !important;
    margin: 0 1px;
}

.ql-toolbar.ql-snow button svg {
    width: 22px;
    height: 22px;
}

/* 피커(헤딩, 색상 등) 확대 — transform 미사용 */
.ql-toolbar.ql-snow .ql-picker {
    height: 32px;
    margin: 0 2px;
}

/* 헤딩 피커 폭 확대 (텍스트 2줄 방지) */
.ql-toolbar.ql-snow .ql-picker.ql-header {
    width: 150px;
}

.ql-toolbar.ql-snow .ql-picker-label {
    padding: 4px 8px;
    font-size: 0.9rem;
}

.ql-toolbar.ql-snow .ql-picker-label svg {
    width: 20px;
    height: 20px;
}

/* 드롭다운 펼침 시 레이어/배경 */
.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options {
    z-index: 2000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* 색상 피커 아이템 크기 확대 */
.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

/* 에디터 본문 용지 크기 제한 */
.document-wrapper .ql-container.ql-snow {
    max-width: 794px; /* A4 기본값 */
    width: 100%;
    margin: 0 auto;
    transition: max-width 0.2s ease;
    background: white;
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
    border-radius: 0 0 12px 12px;
}

/* Quill 툴팁(링크 등) 문서 밖 넘침 방지 */
.ql-container.ql-snow .ql-tooltip {
    z-index: 2000;
}

/* 커스텀 링크 팝오버 */
.custom-link-popover {
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 14px 16px;
    z-index: 2500;
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.custom-link-popover label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #555;
}

.custom-link-popover input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.88rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.custom-link-popover input:focus {
    border-color: #7c9cbf;
}

.link-popover-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 4px;
}

.link-popover-actions button {
    padding: 5px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.12s;
}

.link-popover-cancel {
    background: #f5f5f5;
    color: #555;
}

.link-popover-cancel:hover {
    background: #eee;
}

.link-popover-confirm {
    background: #7c9cbf;
    color: white;
    border-color: #7c9cbf !important;
}

.link-popover-confirm:hover {
    background: #6a8aad;
}

.ql-container.ql-snow {
    border: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.ql-editor {
    min-height: 100%;
    padding: 32px 40px;
    line-height: 1.8;
    color: #333;
}

.ql-editor.ql-blank::before {
    font-style: normal;
    color: #ccc;
}

/* 첫 줄 = 문서 제목 */
.ql-editor > *:first-child {
    font-size: 1.8em;
    font-weight: 700;
    text-align: center;
    color: #2c3e50;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #eee;
}

/* 페이지 나누기 (화면) */
.ql-page-break {
    border: none;
    border-top: 2px dashed #b0b8d6;
    margin: 2em auto;
    height: 0;
    position: relative;
}

.ql-page-break::after {
    content: '페이지 나누기';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 0 12px;
    font-size: 0.72rem;
    color: #999;
}

html[lang="en"] .ql-page-break::after {
    content: 'Page break';
}

/* Quill 헤딩 스타일 */
.ql-editor h1 { font-size: 1.8rem; font-weight: 700; color: #2c3e50; margin-bottom: 0.4em; }
.ql-editor h2 { font-size: 1.4rem; font-weight: 600; color: #34495e; margin-bottom: 0.3em; }
.ql-editor h3 { font-size: 1.15rem; font-weight: 600; color: #4a5568; margin-bottom: 0.3em; }
.ql-snow .ql-editor blockquote {
    border-left: 3px solid #b0b8d6;
    padding: 0 0 0 14px;
    margin: 0 3em 0 3em !important;
    color: #666;
}

/* 연속 인용문 뭉치: 첫 줄 위 여백, 마지막 줄 아래 여백 */
.ql-snow .ql-editor blockquote:not(blockquote + blockquote) {
    margin-top: 2em !important;
}

.ql-snow .ql-editor blockquote:not(:has(+ blockquote)) {
    margin-bottom: 2em !important;
}
.ql-snow .ql-editor code {
    background-color: #f5f5fa !important;
    border: 1px solid #d0d0d8 !important;
    padding: 1px 5px !important;
    border-radius: 3px !important;
    font-size: 0.88em !important;
    color: #555 !important;
}

.ql-snow .ql-editor .ql-code-block-container {
    background-color: transparent !important;
    border: 1px solid #d0d0d8 !important;
    border-radius: 8px !important;
    padding: 14px 18px !important;
    color: #444 !important;
    white-space: pre-wrap !important;
    word-break: break-all !important;
    text-indent: -1.5em !important;
    padding-left: calc(18px + 1.5em) !important;
    width: 85%;
    margin: 12px auto;
}

/* 이미지 */
/* 이미지 삽입 모달 */
.image-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.image-modal {
    background: white;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    width: 420px;
    max-width: 90vw;
    overflow: hidden;
}

.image-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
}

.image-modal-close {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #999;
    padding: 2px 6px;
    border-radius: 4px;
}

.image-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.image-modal-body {
    padding: 18px;
}

.image-drop-zone {
    border: 2px dashed #d0d0d8;
    border-radius: 10px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    color: #999;
    font-size: 0.88rem;
    margin-bottom: 14px;
}

.image-drop-zone:hover,
.image-drop-zone.drag-over {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.04);
}

.image-drop-zone p {
    margin: 8px 0 0;
}

.image-drop-hint {
    font-size: 0.75rem;
    color: #bbb;
}

.image-url-row {
    display: flex;
    gap: 8px;
}

.image-url-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
}

.image-url-input:focus {
    border-color: #667eea;
}

/* 템플릿 모달 */
.template-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.template-modal {
    background: white;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    width: 620px;
    max-width: 90vw;
    height: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.template-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
    flex-shrink: 0;
}

.template-modal-close {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #999;
    padding: 2px 6px;
    border-radius: 4px;
}

.template-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.template-modal-body {
    padding: 14px 18px;
    overflow-y: auto;
    flex: 1;
}

.template-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.template-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
}

.template-item:hover {
    background: #f5f5fa;
}

.template-shortcut {
    font-size: 0.72rem;
    color: #888;
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    font-family: monospace;
    flex-shrink: 0;
}

.template-label {
    font-weight: 500;
    font-size: 0.88rem;
    color: #333;
    min-width: 50px;
    flex-shrink: 0;
}

.template-preview {
    flex: 1;
    font-size: 0.78rem;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.template-actions button {
    border: none;
    background: none;
    cursor: pointer;
    color: #aaa;
    font-size: 0.85rem;
    padding: 2px 4px;
    border-radius: 4px;
}

.template-actions button:hover {
    background: #f0f0f0;
    color: #333;
}

.template-actions .template-del:hover {
    color: #e74c3c;
}

.template-empty {
    padding: 20px;
    color: #aaa;
    font-size: 0.82rem;
    text-align: center;
}

.template-add-btn {
    margin-top: 10px;
    padding: 8px;
    width: 100%;
    border: 2px dashed #d0d0d8;
    border-radius: 8px;
    background: transparent;
    color: #999;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.template-add-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.template-add-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 템플릿 편집 모달 */
.template-edit-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-edit-modal {
    background: white;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 560px;
    max-width: 90vw;
    padding: 24px;
}

.template-edit-modal h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px;
}

.template-edit-modal label {
    font-size: 0.85rem;
    color: #555;
    display: block;
    margin-bottom: 4px;
}

.template-edit-modal input,
.template-edit-modal textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.template-edit-modal textarea {
    min-height: 200px;
    resize: vertical;
    font-family: 'Consolas', 'Monaco', monospace;
    line-height: 1.6;
}

.template-edit-modal .btn-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

/* 이미지 선택: 테두리 + 모서리 점 (box-shadow) */
.ql-editor img.img-selected {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    --dot: 5px;
    --neg: -5px;
    --white: 0 0 0 2px white;
    --fill: 0 0 0 var(--dot) #667eea;
    box-shadow:
        inset var(--dot) var(--dot) 0 var(--neg) #667eea,
        inset var(--neg) var(--dot) 0 var(--neg) #667eea,
        inset var(--dot) var(--neg) 0 var(--neg) #667eea,
        inset var(--neg) var(--neg) 0 var(--neg) #667eea;
}

.ql-snow .ql-editor img {
    max-width: 85% !important;
    height: auto !important;
    border-radius: 6px;
    display: block;
    margin: 2em auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* 표 */
.ql-editor table {
    border-collapse: collapse;
    width: 85%;
    max-width: 85% !important;
    margin: 12px auto;
    border-top: 2px solid #555;
    border-bottom: 2px solid #555;
}

.ql-editor table td {
    border: none;
    border-bottom: 1px solid #d0d0d8;
    border-right: 1px solid #d0d0d8;
    padding: 8px 12px;
    min-width: 60px;
}

/* 셀 내 줄바꿈 */
.cell-br {
    display: block;
    height: 1em;
}

.ql-editor table td:last-child {
    border-right: none;
}

/* 1행 헤더 스타일 */
.ql-editor table tr:first-child td {
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #555;
    background: #f5f5fa;
}

/* 표 버튼 SVG 스타일 */
.ql-table-btn {
    cursor: pointer;
}

.ql-table-btn svg {
    width: 18px;
    height: 18px;
}

.ql-table-btn .ql-stroke {
    fill: none;
    stroke: #444;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ql-table-btn:hover .ql-stroke {
    stroke: #06c;
}

/* 표 열 너비 조절 커서 */
.ql-editor.col-resizing,
.ql-editor.col-resizing * {
    cursor: col-resize !important;
}

/* 표 셀 선택 하이라이트 */
.ql-editor table td.cell-selected {
    background: rgba(102, 126, 234, 0.12) !important;
    outline: 2px solid rgba(102, 126, 234, 0.4);
    outline-offset: -2px;
}

/* 표 컨텍스트 메뉴 */
.table-context-menu {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 4px 0;
    z-index: 3000;
    min-width: 160px;
}

.table-context-item {
    padding: 7px 14px;
    font-size: 0.85rem;
    color: #333;
    cursor: pointer;
    transition: background 0.1s;
}

.table-context-item:hover {
    background: #f0f0f5;
}

.table-context-sep {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}

.ql-editor hr {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 16px 0;
}

/* 원격 커서 스타일 */
.remote-cursor {
    position: absolute;
    width: 2px;
    background: var(--cursor-color);
    pointer-events: none;
    z-index: 10;
}

.remote-cursor-label {
    position: absolute;
    top: -18px;
    left: 0;
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 3px;
    color: white;
    background: var(--cursor-color);
    white-space: nowrap;
    pointer-events: none;
}

/* ===== 로딩 오버레이 ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #e8eaf6 0%, #f3e5f5 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    gap: 20px;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 0.95rem;
    color: #888;
}

.loading-overlay.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ===== 인쇄 ===== */
@media print {
    html, body {
        height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
    }
    .page-header, .presence-bar, .ql-toolbar,
    .home-button, .lang-toggle, .footer,
    .cloud-auth-area, .saved-panel, .toast,
    .loading-overlay, .remote-cursor,
    #bmc-wbtn, .bmc-btn-container {
        display: none !important;
    }
    .editor-container, .document-wrapper {
        display: block !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        overflow: visible !important;
    }
    .ql-container.ql-snow {
        overflow: visible !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        max-width: 100% !important;
        border: none !important;
    }
    .ql-editor {
        padding: 20px !important;
        min-height: auto !important;
    }
    .ql-editor table {
        width: 85% !important;
        max-width: 85% !important;
        margin: 12px auto !important;
    }
    .ql-editor .ql-code-block-container {
        width: 85% !important;
        margin: 12px auto !important;
    }
    .ql-page-break {
        border: none !important;
        margin: 0 !important;
        break-after: page;
    }
    .ql-page-break::after {
        display: none !important;
    }
    .ql-editor table td.cell-selected {
        background: transparent !important;
        outline: none !important;
    }
}

/* ===== 반응형 ===== */
@media (max-width: 600px) {
    .landing-container {
        padding-top: 60px;
    }

    .doc-title-input {
        font-size: 1.3rem;
    }

    .ql-editor {
        padding: 20px 16px;
        min-height: 350px;
    }

    .editor-header {
        flex-wrap: wrap;
    }

    .cloud-auth-area {
        top: 12px;
        right: 12px;
    }

    .saved-panel {
        width: 300px;
    }
}
