/* Relay Novel — 목록, 목차 없는 뷰어, 제목 입력. 공통 문서 스타일은 doc.css */

:root {
    --nv-row-h: 40px;
    --card-hover: rgba(255, 255, 255, 0.20);
}

/* 목록만 뷰포트에 맞춘다. :has()는 첫 페인트 이후 맞아 레이아웃이 한 번 흔들릴 수 있다. */
html.nv-list-page,
html.nv-list-page body {
    height: 100%;
}

/* 편집 화면: 페이지 스크롤 없이 뷰포트에 고정. 본문만 에디터 안에서 스크롤 */
html:has(.doc-edit-page) {
    height: 100%;
    overflow: hidden;
}

html:has(.doc-edit-page) body {
    height: 100%;
    overflow: hidden;
}

/* ── 목록 ── */
.nv-main {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 2rem;
    overflow-y: auto;
}

.nv-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 720px;
    min-height: 0;
}

.nv-panel-label {
    font-family: var(--font-page-title);
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.2;
    min-height: calc(2.4rem + 0.65rem);
    color: var(--text);
    padding-top: 0.65rem;
    margin-bottom: 0.65rem;
}

.nv-list-panel {
    flex: 1;
    gap: 0.65rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.nv-list-header {
    display: flex;
    align-items: center;
    padding: 0.65rem 1rem;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.nv-col-title { flex: 1; text-align: left; }
.nv-col-date { width: 130px; text-align: right; flex-shrink: 0; }

.nv-list-body {
    height: calc(var(--nv-row-h) * 10);
    overflow-y: auto;
}

.nv-row {
    display: flex;
    align-items: center;
    height: var(--nv-row-h);
    padding: 0 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    transition: background 0.15s;
    user-select: none;
    text-decoration: none;
    color: inherit;
}

.nv-row:last-child { border-bottom: none; }
.nv-row:hover { background: var(--card-hover); }

.nv-row-title {
    flex: 1;
    min-width: 0;
    padding-right: 0.5rem;
}

.nv-row-title-text {
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.nv-row-title-text.is-empty {
    opacity: 0.7;
    font-style: italic;
}

.nv-row-date {
    width: 130px;
    text-align: right;
    flex-shrink: 0;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.85);
}

.nv-empty {
    padding: 1.25rem 1rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
}

.nv-list-footer {
    display: flex;
    justify-content: flex-end;
    padding: 0.75rem 0 0;
    min-height: 2.5rem;
}

.nv-create-btn {
    display: flex;
    font-family: var(--font-main);
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--text);
    background: var(--card-bg);
    border: 2px solid var(--border);
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.nv-create-btn:hover {
    border-color: var(--secondary);
    color: var(--secondary);
}

.nv-create-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.nv-create-btn[hidden] {
    display: none !important;
}

/* ── 뷰어: 목차 없음, 본문 전체 폭 ── */
.doc-page--no-toc .wiki-content-meta-row,
.doc-page--no-toc .wiki-content-row,
.doc-page--no-toc .doc-content-meta-row,
.doc-page--no-toc .doc-content-row {
    grid-template-columns: 1fr;
}

.doc-page--no-toc .wiki-content-meta-toc {
    display: none;
}

.doc-page--no-toc .wiki-content-meta-main,
.doc-page--no-toc .wiki-body,
.doc-page--no-toc .doc-body,
.doc-page--no-toc .doc-content-meta-main {
    grid-column: 1;
    width: 100%;
}

/* ── 편집기 제목 입력 ── */
.doc-page.doc-edit-page {
    overflow: hidden;
    padding-bottom: 1rem;
}

.doc-page.doc-edit-page .wiki-edit-content-row {
    flex: 1;
    min-height: 0;
}

.doc-page.doc-edit-page .wiki-edit-sheet {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.doc-page.doc-edit-page #editor {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    max-height: none;
}

.doc-page.doc-edit-page #editor .tiptap,
.doc-page.doc-edit-page #editor .ProseMirror {
    height: 100%;
    min-height: 0;
    max-height: none;
}

.doc-title-input {
    font-family: var(--font-page-title);
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    color: var(--text);
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border);
    padding: 0 0.2rem 0.1rem;
    width: 100%;
    max-width: 36rem;
    box-sizing: border-box;
    outline: none;
}

.doc-title-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
    font-weight: 500;
}

.doc-title-input:focus {
    border-bottom-color: var(--secondary);
}

.doc-edit-side-col {
    grid-column: 1;
}

.doc-collab-timer {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.85rem 0.75rem;
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text);
    flex-shrink: 0;
}

.doc-collab-timer[hidden] {
    display: none !important;
}

.doc-collab-timer.is-locked .doc-collab-timer-display {
    pointer-events: none;
    cursor: default;
}

.doc-collab-timer.is-locked .doc-collab-timer-btn {
    pointer-events: none;
}

.doc-collab-timer-title {
    margin: 0 0 0.1rem;
    padding-bottom: 0.35em;
    border-bottom: 2px solid var(--border);
    font-family: var(--font-header);
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

.doc-collab-timer-display-wrap {
    display: block;
}

.doc-collab-timer-display {
    display: block;
    width: 100%;
    box-sizing: border-box;
    font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    background: transparent;
    border: none;
    padding: 0.1rem 0;
    outline: none;
    text-align: center;
}

.doc-collab-timer-adjust,
.doc-collab-timer-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
}

.doc-collab-timer-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.doc-collab-timer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-main);
    font-size: 0.75rem;
    padding: 0.35rem 0.15rem;
    cursor: pointer;
    color: var(--text);
    background: transparent;
    border: 2px solid var(--border);
    white-space: nowrap;
}

.doc-collab-timer-btn:hover:not(:disabled) {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #fff;
}

.doc-collab-timer-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

@media (max-width: 640px) {
    .nv-main {
        padding: 1rem;
    }

    .nv-col-date,
    .nv-row-date {
        width: 96px;
        font-size: 0.8rem;
    }

    .doc-title-input {
        font-size: 1.25rem;
        max-width: 100%;
    }
}
