/* Post Wizard Global Styles */
.post-wiki-archive-container,
.post-wiki-single-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Single Page Styles */
.post-wiki-single-container {
    max-width: 920px; /* 15% 증가 (800px → 920px) */
    margin: 40px auto;
    padding: 0 20px;
}

/* Related posts (cards) */
.c2-pw-related-posts {
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid #eee;
}

.c2-pw-related-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 16px 0;
    color: #1a1a1a;
}

.c2-pw-related-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.c2-pw-related-card {
    display: flex;
    gap: 12px;
    align-items: stretch;
    text-decoration: none;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.c2-pw-related-card:hover {
    transform: translateY(-1px);
    border-color: #dbe4ff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.c2-pw-related-thumb {
    width: 120px;
    flex: 0 0 120px;
    background: #f1f3f5;
}

.c2-pw-related-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.c2-pw-related-thumb-empty {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f1f3f5 0%, #e9ecef 100%);
}

.c2-pw-related-thumb-keyword {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    text-align: center;
    background: linear-gradient(
        135deg,
        hsl(var(--c2pw-hue, 210) 75% 92%) 0%,
        hsl(var(--c2pw-hue, 210) 70% 86%) 100%
    );
}

.c2-pw-related-thumb-keyword-text {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.2px;
    line-height: 1.25;
    color: hsl(var(--c2pw-hue, 210) 35% 25%);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: keep-all;
}

.c2-pw-related-body {
    padding: 12px 12px 12px 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.c2-pw-related-card-title {
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.35;
    color: #1a1a1a;
    margin: 0 0 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.c2-pw-related-card-excerpt {
    font-size: 0.9rem;
    color: #495057;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hide common 3rd-party related-posts blocks ONLY on post_wiki single (we render our own 2 cards) */
body.single-post_wiki .jp-relatedposts,
body.single-post_wiki .yarpp-related,
body.single-post_wiki .crp_related,
body.single-post_wiki .rp4wp-related-posts,
body.single-post_wiki .wp_rp_wrap,
body.single-post_wiki .wp_rp_content,
body.single-post_wiki .wprp_related_posts,
body.single-post_wiki .yarpp-thumbnails-horizontal,
body.single-post_wiki .yarpp-thumbnails-vertical {
    display: none !important;
}

.post-wiki-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1a1a1a;
    line-height: 1.3;
}

.post-wiki-meta {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    color: #666;
    font-size: 0.9rem;
}

/* Content Styles - post_wiki 포스트 타입에만 적용 */
body.single-post_wiki .entry-content,
body.post-type-archive-post_wiki .entry-content {
    font-size: 1.1rem;
    color: #333;
}

body.single-post_wiki .entry-content h2,
body.post-type-archive-post_wiki .entry-content h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 50px;
    margin-bottom: 25px;
    color: #1e3c72;
    border-left: 5px solid #1e3c72;
    padding-left: 15px;
}

body.single-post_wiki .entry-content h3,
body.post-type-archive-post_wiki .entry-content h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 35px;
    margin-bottom: 15px;
    color: #2c3e50;
}

body.single-post_wiki .entry-content h4,
body.post-type-archive-post_wiki .entry-content h4 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 25px;
    margin-bottom: 12px;
    color: #374151;
}

body.single-post_wiki .entry-content p,
body.post-type-archive-post_wiki .entry-content p {
    margin-bottom: 25px;
}

/* post_wiki 포스트 타입에만 적용 */
body.single-post_wiki .entry-content ul, 
body.single-post_wiki .entry-content ol,
body.post-type-archive-post_wiki .entry-content ul,
body.post-type-archive-post_wiki .entry-content ol {
    margin-bottom: 25px;
    padding-left: 25px;
}

body.single-post_wiki .entry-content ul,
body.post-type-archive-post_wiki .entry-content ul {
    list-style-type: disc !important;
    list-style-position: outside !important;
}

body.single-post_wiki .entry-content ol,
body.post-type-archive-post_wiki .entry-content ol {
    list-style-type: decimal !important;
    list-style-position: outside !important;
    counter-reset: none !important;
}

body.single-post_wiki .entry-content ul > li,
body.single-post_wiki .entry-content ol > li,
body.post-type-archive-post_wiki .entry-content ul > li,
body.post-type-archive-post_wiki .entry-content ol > li {
    display: list-item !important;
    list-style: inherit !important;
}

/* 추가: ol li에 강제로 번호 표시 */
body.single-post_wiki .entry-content ol > li,
body.post-type-archive-post_wiki .entry-content ol > li {
    list-style-type: decimal !important;
}

/* 혹시 before로 커스텀 번호를 만든 경우 제거 */
body.single-post_wiki .entry-content ol > li::before,
body.post-type-archive-post_wiki .entry-content ol > li::before {
    content: none !important;
}

body.single-post_wiki .entry-content ol > li::marker,
body.post-type-archive-post_wiki .entry-content ol > li::marker {
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
    text-transform: none;
    text-indent: 0px !important;
    text-align: start !important;
}

/* 잘못된 HTML 구조 (<li></li><ul>) 대응 */
/* li 바로 뒤에 오는 ul의 불릿을 제거하여 겹침 방지 */
body.single-post_wiki .entry-content li + ul,
body.post-type-archive-post_wiki .entry-content li + ul {
    list-style-type: none !important;
    margin-top: 5px !important;
    margin-left: 0 !important;
    padding-left: 25px !important;
}

body.single-post_wiki .entry-content li + ul > li,
body.post-type-archive-post_wiki .entry-content li + ul > li {
    list-style-type: disc !important;
    display: list-item !important;
}

body.single-post_wiki .entry-content li + ul > li::before,
body.post-type-archive-post_wiki .entry-content li + ul > li::before {
    content: none !important;
}

body.single-post_wiki .entry-content li + ul > li::marker,
body.post-type-archive-post_wiki .entry-content li + ul > li::marker {
    content: normal !important;
}

/* 올바른 중첩 구조의 ul은 불릿 유지 */
body.single-post_wiki .entry-content li > ul,
body.post-type-archive-post_wiki .entry-content li > ul {
    list-style-type: circle !important;
    margin-top: 5px !important;
    margin-bottom: 5px !important;
}

body.single-post_wiki .entry-content li > ul > li,
body.post-type-archive-post_wiki .entry-content li > ul > li {
    list-style-type: circle !important;
    display: list-item !important;
}

body.single-post_wiki .entry-content li > ul > li::before,
body.post-type-archive-post_wiki .entry-content li > ul > li::before {
    content: none !important;
}

body.single-post_wiki .entry-content li > ul > li > ul,
body.post-type-archive-post_wiki .entry-content li > ul > li > ul {
    list-style-type: square !important;
}

body.single-post_wiki .entry-content li > ul > li > ul > li,
body.post-type-archive-post_wiki .entry-content li > ul > li > ul > li {
    list-style-type: square !important;
    display: list-item !important;
}

body.single-post_wiki .entry-content li > ul > li > ul > li::before,
body.post-type-archive-post_wiki .entry-content li > ul > li > ul > li::before {
    content: none !important;
}

body.single-post_wiki .entry-content li,
body.post-type-archive-post_wiki .entry-content li {
    margin-bottom: 10px;
}

body.single-post_wiki .entry-content blockquote,
body.post-type-archive-post_wiki .entry-content blockquote {
    background: #f9f9f9;
    border-left: 5px solid #ccc;
    margin: 30px 0;
    padding: 20px;
    font-style: italic;
    color: #555;
}

/* Table Styles - post_wiki 포스트 타입에만 적용 */
body.single-post_wiki .entry-content table,
body.single-post_wiki .entry-content .post-wiki-table,
body.post-type-archive-post_wiki .entry-content table,
body.post-type-archive-post_wiki .entry-content .post-wiki-table,
.post-wiki-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    table-layout: auto;
    word-wrap: break-word;
}

body.single-post_wiki .entry-content table thead,
body.single-post_wiki .entry-content .post-wiki-table thead,
body.post-type-archive-post_wiki .entry-content table thead,
body.post-type-archive-post_wiki .entry-content .post-wiki-table thead,
.post-wiki-table thead {
    background: linear-gradient(135deg, #1e3c72 0%, #2a4d7a 100%);
    color: #fff;
}

body.single-post_wiki .entry-content table th,
body.single-post_wiki .entry-content .post-wiki-table th,
body.post-type-archive-post_wiki .entry-content table th,
body.post-type-archive-post_wiki .entry-content .post-wiki-table th,
.post-wiki-table th {
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
    font-size: 1rem;
    border-bottom: 2px solid #1a3361;
    letter-spacing: 0.3px;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

body.single-post_wiki .entry-content table tbody tr,
body.single-post_wiki .entry-content .post-wiki-table tbody tr,
body.post-type-archive-post_wiki .entry-content table tbody tr,
body.post-type-archive-post_wiki .entry-content .post-wiki-table tbody tr,
.post-wiki-table tbody tr {
    border-bottom: 1px solid #e5e5e5;
    transition: background-color 0.2s ease;
}

body.single-post_wiki .entry-content table tbody tr:hover,
body.single-post_wiki .entry-content .post-wiki-table tbody tr:hover,
body.post-type-archive-post_wiki .entry-content table tbody tr:hover,
body.post-type-archive-post_wiki .entry-content .post-wiki-table tbody tr:hover,
.post-wiki-table tbody tr:hover {
    background-color: #f5f7fa;
}

body.single-post_wiki .entry-content table tbody tr:last-child,
body.single-post_wiki .entry-content .post-wiki-table tbody tr:last-child,
body.post-type-archive-post_wiki .entry-content table tbody tr:last-child,
body.post-type-archive-post_wiki .entry-content .post-wiki-table tbody tr:last-child,
.post-wiki-table tbody tr:last-child {
    border-bottom: none;
}

body.single-post_wiki .entry-content table td,
body.single-post_wiki .entry-content .post-wiki-table td,
body.post-type-archive-post_wiki .entry-content table td,
body.post-type-archive-post_wiki .entry-content .post-wiki-table td,
.post-wiki-table td {
    padding: 14px 18px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #333;
    vertical-align: top;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

body.single-post_wiki .entry-content table tbody tr:nth-child(even),
body.single-post_wiki .entry-content .post-wiki-table tbody tr:nth-child(even),
body.post-type-archive-post_wiki .entry-content table tbody tr:nth-child(even),
body.post-type-archive-post_wiki .entry-content .post-wiki-table tbody tr:nth-child(even),
.post-wiki-table tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

body.single-post_wiki .entry-content table tbody tr:nth-child(even):hover,
body.single-post_wiki .entry-content .post-wiki-table tbody tr:nth-child(even):hover,
body.post-type-archive-post_wiki .entry-content table tbody tr:nth-child(even):hover,
body.post-type-archive-post_wiki .entry-content .post-wiki-table tbody tr:nth-child(even):hover,
.post-wiki-table tbody tr:nth-child(even):hover {
    background-color: #f0f2f5;
}

/* AdSense 가로 넘침 방지 (모바일 흔들림 방지) */
@media (max-width: 1024px) {
    html,
    body {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
}

/* 전체 페이지 오버플로우 차단 (가로 흔들림 방지) */
body.tag,
body.archive,
body.post-type-archive-post_wiki,
body.single-post_wiki {
    overflow-x: hidden;
}

/* AdSense 가로 넘침 방지 - post_wiki 관련 페이지에만 적용 */
body.single-post_wiki .entry-content ins.adsbygoogle,
body.single-post_wiki .entry-content .adsbygoogle,
body.post-type-archive-post_wiki .entry-content ins.adsbygoogle,
body.post-type-archive-post_wiki .entry-content .adsbygoogle,
body.single-post_wiki ins.adsbygoogle,
body.single-post_wiki .adsbygoogle,
body.post-type-archive-post_wiki ins.adsbygoogle,
body.post-type-archive-post_wiki .adsbygoogle,
body.tag ins.adsbygoogle,
body.tag .adsbygoogle {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow: hidden;
    margin-left: 0 !important;
    margin-right: 0 !important;
    min-width: 0 !important;
}

/* 광고 내부 iframe/ins가 넓이를 밀어내지 않도록 보정 - post_wiki에만 적용 */
body.single-post_wiki .entry-content ins.adsbygoogle iframe,
body.single-post_wiki .entry-content .adsbygoogle iframe,
body.single-post_wiki .entry-content ins.adsbygoogle > ins,
body.single-post_wiki .entry-content .adsbygoogle > ins,
body.post-type-archive-post_wiki .entry-content ins.adsbygoogle iframe,
body.post-type-archive-post_wiki .entry-content .adsbygoogle iframe,
body.post-type-archive-post_wiki .entry-content ins.adsbygoogle > ins,
body.post-type-archive-post_wiki .entry-content .adsbygoogle > ins {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box;
    min-width: 0 !important;
}

/* 자동 배치 광고 래퍼가 가로 폭을 넘지 않도록 - post_wiki 관련 페이지에만 적용 */
body.single-post_wiki .google-auto-placed,
body.single-post_wiki .google-auto-placed .adsbygoogle,
body.post-type-archive-post_wiki .google-auto-placed,
body.post-type-archive-post_wiki .google-auto-placed .adsbygoogle,
body.tag .google-auto-placed,
body.tag .google-auto-placed .adsbygoogle {
    max-width: 100% !important;
    width: 100% !important;
    overflow: hidden;
    box-sizing: border-box;
}

/* 모바일에서 표 반응형 처리 */
@media (max-width: 768px) {
    /* WordPress 블록 에디터 표 블록 처리 - 스크롤 가능한 컨테이너 */
    .entry-content .wp-block-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 0;
        box-sizing: border-box;
    }
    
    .entry-content .wp-block-table table {
        display: table;
        width: 100%;
        max-width: 100%;
        table-layout: auto;
        margin: 0;
        min-width: 0;
    }
    
    /* 직접 자식 표 처리 - 스크롤 가능한 컨테이너로 감싸기 */
    .entry-content > table,
    .entry-content > .post-wiki-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 0;
        box-sizing: border-box;
    }
    
    .entry-content > table > table,
    .entry-content > .post-wiki-table > table {
        display: table;
        width: 100%;
        max-width: 100%;
        margin: 0;
        min-width: 0;
    }
    
    /* 모든 표에 공통 적용 - 화면 크기에 맞게 조정 */
    .entry-content table,
    .entry-content .post-wiki-table,
    .post-wiki-table {
        display: table;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        table-layout: auto;
        font-size: 0.85rem;
        box-sizing: border-box;
    }
    
    /* 셀 내용이 줄바꿈되도록 설정 */
    .entry-content table th,
    .entry-content table td,
    .entry-content .post-wiki-table th,
    .entry-content .post-wiki-table td,
    .post-wiki-table th,
    .post-wiki-table td {
        padding: 8px 10px;
        font-size: 0.85rem;
        word-wrap: break-word;
        word-break: break-word;
        white-space: normal !important;
        hyphens: auto;
        overflow-wrap: break-word;
        box-sizing: border-box;
    }
    
    /* 헤더 셀 크기 조정 */
    .entry-content table th,
    .entry-content .post-wiki-table th,
    .post-wiki-table th {
        font-size: 0.9rem;
        padding: 10px 8px;
    }
}

/* 작은 모바일 화면 (480px 이하) */
@media (max-width: 480px) {
    .entry-content table th,
    .entry-content table td,
    .entry-content .post-wiki-table th,
    .entry-content .post-wiki-table td,
    .post-wiki-table th,
    .post-wiki-table td {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    .entry-content table th,
    .entry-content .post-wiki-table th,
    .post-wiki-table th {
        font-size: 0.85rem;
    }
}

/* Admin Styles */
#batch-log {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
    background: #fafafa;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.5;
    display: none;
}

#batch-log div {
    margin-bottom: 4px;
    border-bottom: 1px dashed #eee;
    padding-bottom: 4px;
}

/* 태그 설명 영역 링크 스타일 (파란 배경에서 가독성 향상) - post_wiki 태그에만 적용 */
.post-wiki-term-description a,
.post-wiki-archive-header .post-wiki-term-description a,
.c2-pw-tag-archive-description a,
body.tax-post_wiki .taxonomy-description a,
body.tax-post_wiki .term-description a,
body.tax-post_wiki .tag-description a,
body.tax-post_wiki .archive-description a,
body.post-type-archive-post_wiki .taxonomy-description a,
body.post-type-archive-post_wiki .term-description a,
body.post-type-archive-post_wiki .tag-description a,
body.post-type-archive-post_wiki .archive-description a {
    color: #FFD700 !important; /* 노란색 (금색) - 파란 배경에서 잘 보임 */
    text-decoration: underline;
    font-weight: 500;
    transition: all 0.2s ease;
}

.post-wiki-term-description a:hover,
.post-wiki-archive-header .post-wiki-term-description a:hover,
.c2-pw-tag-archive-description a:hover,
body.tax-post_wiki .taxonomy-description a:hover,
body.tax-post_wiki .term-description a:hover,
body.tax-post_wiki .tag-description a:hover,
body.tax-post_wiki .archive-description a:hover,
body.post-type-archive-post_wiki .taxonomy-description a:hover,
body.post-type-archive-post_wiki .term-description a:hover,
body.post-type-archive-post_wiki .tag-description a:hover,
body.post-type-archive-post_wiki .archive-description a:hover {
    color: #FFC107 !important; /* 더 밝은 노란색 */
    text-decoration: underline;
    opacity: 0.9;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .post-wiki-single-container,
    .post-wiki-archive-container {
        padding: 0 15px;
        margin: 20px auto;
    }

    .post-wiki-title {
        font-size: 1.8rem;
    }

    .entry-content {
        font-size: 1rem;
    }

    .c2-pw-related-grid {
        grid-template-columns: 1fr;
    }

    .c2-pw-related-thumb {
        width: 110px;
        flex-basis: 110px;
    }
}
