/* 위키 문서 보기 페이지 스타일 - 나무위키 스타일 */
.wiki-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    background: #ffffff;
}

.wiki-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e5e5;
}

.wiki-nav {
    display: flex;
    align-items: center;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
    padding: 0.5rem 0;
}

.back-link:hover {
    color: #333;
}

.back-link i {
    font-size: 0.85rem;
}

.wiki-actions {
    display: flex;
    gap: 0.5rem;
}

.wiki-public-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.wiki-actions .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    border-radius: 4px;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.2s;
}

.wiki-actions .btn i {
    font-size: 0.85rem;
}

.wiki-actions .btn-primary {
    background: #0066cc;
    border-color: #0066cc;
    color: white;
}

.wiki-actions .btn-primary:hover {
    background: #0052a3;
    border-color: #0052a3;
}

.wiki-actions .btn-secondary {
    background: #fff;
    border-color: #d0d0d0;
    color: #333;
}

.wiki-actions .btn-secondary:hover {
    background: #f5f5f5;
    border-color: #b0b0b0;
}

.wiki-content {
    background: white;
    padding: 2rem 2.5rem;
    min-height: 400px;
    line-height: 1.5;
}

.wiki-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: #000;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e5e5;
    line-height: 1.4;
}

.wiki-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: #888;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.wiki-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.wiki-meta i {
    font-size: 0.8rem;
    color: #aaa;
}

.wiki-body {
    line-height: 1.5;
    color: #333;
    font-size: 1rem;
    word-break: keep-all;
    overflow-wrap: break-word;
}

/* 목차 */
.wiki-toc {
    border: 1px solid #e5e5e5;
    background: #fafafa;
    border-radius: 6px;
    padding: 0.9rem 1.25rem 1rem 1.25rem;
    margin: 1rem 0 1.5rem 0;
}

.wiki-toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.wiki-toc-toggle {
    min-width: 24px;
    text-align: right;
    cursor: pointer;
    font-weight: 700;
    line-height: 1;
    color: #333;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(90deg);
    transition: transform 0.15s ease;
}

.wiki-toc.is-collapsed .wiki-toc-list {
    display: none;
}

.wiki-toc.is-collapsed .wiki-toc-header {
    margin-bottom: 0;
}

.wiki-toc.is-collapsed .wiki-toc-toggle {
    transform: rotate(0deg);
}

.wiki-toc-title {
    font-weight: 700;
    color: #000;
    margin-bottom: 0;
    font-size: 1.2rem;
    line-height: 1.2;
    display: flex;
    align-items: center;
}

.wiki-toc-list {
    margin: 0;
    padding-left: 0;
    padding-inline-start: 0;
    line-height: 1.6;
    list-style: none;
    text-indent: 0;
    margin-left: 0;
    margin-inline-start: 0;
}

.wiki-toc-list ol {
    margin: 0.35rem 0 0.35rem 0;
    padding-left: 0;
    padding-inline-start: 0;
    list-style: none;
    margin-left: 0;
    margin-inline-start: 0;
}

/* wiki-body 기본 리스트 패딩 오버라이드 */
.wiki-body .wiki-toc>.wiki-toc-list {
    padding-left: 0;
    padding-inline-start: 0;
    margin-left: 0;
    margin-inline-start: 0;
}

.wiki-body .wiki-toc .wiki-toc-list ol {
    padding-left: 0.9rem;
    padding-inline-start: 0.9rem;
}

.wiki-toc-list li {
    margin: 0.2rem 0;
    list-style: none;
    padding-left: 0;
    padding-inline-start: 0;
    margin-left: 0;
    margin-inline-start: 0;
}

.wiki-toc-list a {
    color: #0066cc;
    text-decoration: none;
    display: inline-flex;
    gap: 0.35rem;
    align-items: baseline;
}

.wiki-toc-list a:hover {
    color: #0052a3;
    text-decoration: underline;
}

.wiki-toc-list .toc-number {
    color: #666;
    min-width: 1.8rem;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.wiki-toc-list .toc-text {
    color: inherit;
}

.wiki-body h1,
.wiki-body h2,
.wiki-body h3,
.wiki-body h4,
.wiki-body h5,
.wiki-body h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: #000;
    line-height: 1.4;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 0.5rem;
}

.wiki-body h1 {
    font-size: 2rem;
    border-bottom: 2px solid #e5e5e5;
}

.wiki-body h2 {
    font-size: 1.75rem;
    margin-top: 1.25rem;
}

.wiki-body h3 {
    font-size: 1.5rem;
    margin-top: 1rem;
}

.wiki-body h4 {
    font-size: 1.25rem;
}

.wiki-body p {
    margin-bottom: 0.6rem;
    line-height: 1.5;
}

.wiki-body ul,
.wiki-body ol {
    margin-bottom: 0.6rem;
    padding-left: 2rem;
    line-height: 1.5;
}

.wiki-body li {
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.wiki-body code {
    background: #f5f5f5;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.wiki-body pre {
    background: #f8f8f8;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 0.6rem;
    border: 1px solid #e5e5e5;
}

.wiki-body pre code {
    background: none;
    padding: 0;
    color: #333;
    font-size: 0.9em;
}

.wiki-body blockquote {
    border-left: 4px solid #d0d0d0;
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 0.6rem;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    padding: 1rem 1rem 1rem 1.5rem;
    border-radius: 0 4px 4px 0;
}

.wiki-body .wiki-classic-ref {
    margin: 0.7rem 0;
    padding: 0.7rem 0.82rem;
    border: 1px solid #bfd0e8;
    border-radius: 8px;
    background: #fbfdff;
}

.wiki-body .wiki-classic-ref-link {
    font-size: 0.78rem;
    color: #456ca4;
    text-decoration: none;
    white-space: nowrap;
    margin-left: auto;
}

.wiki-body .wiki-classic-ref-link:hover {
    text-decoration: none;
}

.wiki-body .wiki-classic-ref .wiki-classic-ref-link:hover,
.wiki-body .wiki-classic-ref .wiki-classic-ref-link:focus,
.wiki-body .wiki-classic-ref .wiki-classic-ref-link:active {
    text-decoration: none !important;
}

.wiki-body .wiki-classic-ref-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #7488a3;
    font-size: 0.77rem;
    margin-bottom: 0.35rem;
}

.wiki-body .wiki-classic-ref-state {
    color: #60748f;
    font-size: 0.83rem;
    margin-bottom: 0.1rem;
}

.wiki-body .wiki-classic-ref-original,
.wiki-body .wiki-classic-ref-translation {
    white-space: pre-wrap;
    line-height: 1.58;
    font-size: 0.92rem;
}

.wiki-body .wiki-classic-ref-original {
    color: #233248;
    margin-bottom: 0.28rem;
}

.wiki-body .wiki-classic-ref-translation {
    color: #576d89;
}

.wiki-body .wiki-classic-ref-translation.is-empty {
    font-style: italic;
    opacity: 0.85;
}

.wiki-body .wiki-classic-ref.is-error {
    border-color: #e0c2c2;
    background: #fffafb;
}


.wiki-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius, 8px);
    margin: 0.6rem 0;
}

.wiki-body a {
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s;
}

.wiki-body a:hover {
    color: #0052a3;
    text-decoration: underline;
}

/* 위키 내부 링크 스타일 */
.wiki-body a.wiki-link {
    color: #0066cc;
    font-weight: 500;
    border-bottom: 1px dotted #0066cc;
    padding-bottom: 1px;
}

.wiki-body a.wiki-link.is-missing {
    color: #d32f2f;
    border-bottom-color: #d32f2f;
}

.wiki-body a.wiki-link.is-missing:hover {
    color: #b71c1c;
    border-bottom-style: solid;
    text-decoration: none;
}

.wiki-body a.wiki-link:hover {
    color: #0052a3;
    border-bottom-style: solid;
    text-decoration: none;
}

/* 각주 참조 스타일 */
.wiki-body .footnote-ref {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85em;
    vertical-align: super;
    line-height: 0;
}

.wiki-body .footnote-ref:hover {
    color: #0052a3;
    text-decoration: underline;
}

/* 각주 블록 스타일 */
.wiki-body .footnotes {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e5e5;
    font-size: 0.9em;
    color: #666;
}

.wiki-body .footnotes hr {
    display: none;
}

/* 각주 항목 스타일 */
.wiki-body .footnote-item {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.6;
}

.wiki-body .footnote-item .footnote-number {
    position: absolute;
    left: 0;
    font-weight: 600;
    color: #333;
}

.wiki-body .footnote-item .footnote-content {
    display: inline;
    color: #666;
}

/* 각주 backlink 스타일 */
.wiki-body .footnote-backlink {
    color: #0066cc;
    text-decoration: none;
    margin-left: 0.5rem;
    font-size: 0.9em;
    font-weight: 500;
}

.wiki-body .footnote-backlink:hover {
    color: #0052a3;
    text-decoration: underline;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.error {
    text-align: center;
    padding: 3rem;
    color: #d32f2f;
}

.wiki-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.6rem;
    border: 1px solid #e5e5e5;
}

.wiki-body table th,
.wiki-body table td {
    border: 1px solid #e5e5e5;
    padding: 0.75rem;
    text-align: left;
}

.wiki-body table th {
    background: #f8f8f8;
    font-weight: 600;
    color: #000;
}

.wiki-body table tr:nth-child(even) {
    background: #fafafa;
}

.wiki-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 0.6rem 0;
    border: 1px solid #e5e5e5;
}

.wiki-body hr {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 1rem 0;
}

/* 미리보기 및 모달에서도 동일한 스타일 적용 */
.preview-content .wiki-body,
.modal-body .wiki-body {
    line-height: 1.5;
    color: #333;
    font-size: 1rem;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.preview-content .wiki-body h1,
.preview-content .wiki-body h2,
.preview-content .wiki-body h3,
.preview-content .wiki-body h4,
.preview-content .wiki-body h5,
.preview-content .wiki-body h6,
.modal-body .wiki-body h1,
.modal-body .wiki-body h2,
.modal-body .wiki-body h3,
.modal-body .wiki-body h4,
.modal-body .wiki-body h5,
.modal-body .wiki-body h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: #000;
    line-height: 1.4;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 0.5rem;
}

.preview-content .wiki-body h1,
.modal-body .wiki-body h1 {
    font-size: 2rem;
    border-bottom: 2px solid #e5e5e5;
}

.preview-content .wiki-body h2,
.modal-body .wiki-body h2 {
    font-size: 1.75rem;
    margin-top: 1.25rem;
}

.preview-content .wiki-body h3,
.modal-body .wiki-body h3 {
    font-size: 1.5rem;
    margin-top: 1rem;
}

.preview-content .wiki-body h4,
.modal-body .wiki-body h4 {
    font-size: 1.25rem;
}

.preview-content .wiki-body p,
.modal-body .wiki-body p {
    margin-bottom: 0.6rem;
    line-height: 1.5;
}

.preview-content .wiki-body ul,
.preview-content .wiki-body ol,
.modal-body .wiki-body ul,
.modal-body .wiki-body ol {
    margin-bottom: 0.6rem;
    padding-left: 2rem;
    line-height: 1.5;
}

.preview-content .wiki-body li,
.modal-body .wiki-body li {
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.preview-content .wiki-body code,
.modal-body .wiki-body code {
    background: #f5f5f5;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.preview-content .wiki-body pre,
.modal-body .wiki-body pre {
    background: #f8f8f8;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 0.6rem;
    border: 1px solid #e5e5e5;
}

.preview-content .wiki-body pre code,
.modal-body .wiki-body pre code {
    background: none;
    padding: 0;
    color: #333;
    font-size: 0.9em;
}

.preview-content .wiki-body blockquote,
.modal-body .wiki-body blockquote {
    border-left: 4px solid #d0d0d0;
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 0.6rem;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    padding: 1rem 1rem 1rem 1.5rem;
    border-radius: 0 4px 4px 0;
}

.preview-content .wiki-body table,
.modal-body .wiki-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.6rem;
    border: 1px solid #e5e5e5;
}

.preview-content .wiki-body table th,
.preview-content .wiki-body table td,
.modal-body .wiki-body table th,
.modal-body .wiki-body table td {
    border: 1px solid #e5e5e5;
    padding: 0.75rem;
    text-align: left;
}

.preview-content .wiki-body table th,
.modal-body .wiki-body table th {
    background: #f8f8f8;
    font-weight: 600;
    color: #000;
}

.preview-content .wiki-body table tr:nth-child(even),
.modal-body .wiki-body table tr:nth-child(even) {
    background: #fafafa;
}

.preview-content .wiki-body img,
.modal-body .wiki-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 0.6rem 0;
    border: 1px solid #e5e5e5;
}

.preview-content .wiki-body a,
.modal-body .wiki-body a {
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s;
}

.preview-content .wiki-body a:hover,
.modal-body .wiki-body a:hover {
    color: #0052a3;
    text-decoration: underline;
}

.preview-content .wiki-body a.wiki-link,
.modal-body .wiki-body a.wiki-link {
    color: #0066cc;
    font-weight: 500;
    border-bottom: 1px dotted #0066cc;
    padding-bottom: 1px;
}

.preview-content .wiki-body a.wiki-link:hover,
.modal-body .wiki-body a.wiki-link:hover {
    color: #0052a3;
    border-bottom-style: solid;
    text-decoration: none;
}

/* 미리보기 및 모달에서 각주 스타일 */
.preview-content .wiki-body .footnote-ref,
.modal-body .wiki-body .footnote-ref {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85em;
    vertical-align: super;
    line-height: 0;
}

.preview-content .wiki-body .footnote-ref:hover,
.modal-body .wiki-body .footnote-ref:hover {
    color: #0052a3;
    text-decoration: underline;
}

.preview-content .wiki-body .footnotes,
.modal-body .wiki-body .footnotes {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e5e5;
    font-size: 0.9em;
    color: #666;
}

.preview-content .wiki-body .footnote-item,
.modal-body .wiki-body .footnote-item {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.6;
}

.preview-content .wiki-body .footnote-item .footnote-number,
.modal-body .wiki-body .footnote-item .footnote-number {
    position: absolute;
    left: 0;
    font-weight: 600;
    color: #333;
}

.preview-content .wiki-body .footnote-item .footnote-content,
.modal-body .wiki-body .footnote-item .footnote-content {
    display: inline;
    color: #666;
}

.preview-content .wiki-body .footnote-backlink,
.modal-body .wiki-body .footnote-backlink {
    color: #0066cc;
    text-decoration: none;
    margin-left: 0.5rem;
    font-size: 0.9em;
    font-weight: 500;
}

.preview-content .wiki-body .footnote-backlink:hover,
.modal-body .wiki-body .footnote-backlink:hover {
    color: #0052a3;
    text-decoration: underline;
}

.preview-content .wiki-body hr,
.modal-body .wiki-body hr {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 1rem 0;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .wiki-container {
        padding: 1rem 0.5rem;
    }

    .wiki-content {
        padding: 1rem;
        /* 여백 축소 */
    }

    .wiki-title {
        font-size: 1.75rem;
    }

    .wiki-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .wiki-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .wiki-actions .btn {
        flex: 1;
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
        justify-content: center;
    }

    .wiki-meta {
        font-size: 0.8rem;
        gap: 1rem;
    }

    .wiki-body {
        font-size: 0.95rem;
        line-height: 1.6;
        /* 가독성 향상 */
    }

    .wiki-body table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .wiki-body pre {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .wiki-body h1 {
        font-size: 1.75rem;
    }

    .wiki-body h2 {
        font-size: 1.5rem;
    }

    .wiki-body h3 {
        font-size: 1.25rem;
    }

    .wiki-public-actions {
        width: 100%;
        margin-top: 1rem;
    }

    .modal-content {
        width: 95%;
        max-width: 95%;
    }
}

/* 모달 기본 스타일 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-large {
    max-width: 90%;
    width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e5e5;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #000;
}
