/* 기본 설정 */
:root {
    --header-height: 70px;
    --max-width: 1200px;
    --card-background: #ffffff;
    --post-padding: 2.5rem;
    --accent-color: #0984e3;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --border-color: #dfe6e9;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

/* 포스트 래퍼 */
.post-wrapper {
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    background: #f8f9fa;
}

/* 포스트 컨테이너 */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

.post-detail {
    background: var(--card-background);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    margin: 2rem auto;
    overflow: hidden;
}

/* 포스트 헤더 */
.post-header {
    padding: var(--post-padding);
    border-bottom: 1px solid var(--border-color);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.post-category {
    background: var(--accent-color);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.9rem;
}

.post-views {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-title {
    font-size: 2.3rem;
    line-height: 1.3;
    margin: 1.5rem 0 1rem;
    color: var(--text-primary);
    font-weight: 700;
    word-break: keep-all;
}

.post-description {
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

/* 포스트 콘텐츠 */
.post-content {
    padding: var(--post-padding);
}

.markdown-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 2em;
    margin-bottom: 1em;
    font-weight: 600;
    line-height: 1.3;
}

.markdown-body h1 { font-size: 2.2rem; }
.markdown-body h2 { font-size: 1.8rem; }
.markdown-body h3 { font-size: 1.5rem; }
.markdown-body h4 { font-size: 1.3rem; }
.markdown-body h5 { font-size: 1.1rem; }
.markdown-body h6 { font-size: 1rem; }

.markdown-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2rem auto;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.markdown-body p {
    margin: 1.5rem 0;
}

.markdown-body a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.markdown-body a:hover {
    border-bottom-color: var(--accent-color);
}

/* 코드 블록 */
.markdown-body pre {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.markdown-body code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    background: #f1f3f5;
    border-radius: 4px;
}

.markdown-body pre code {
    padding: 0;
    background: none;
    font-size: 0.95em;
}

/* 인용구 */
.markdown-body blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    border-left: 4px solid var(--accent-color);
    background: #f8f9fa;
    border-radius: 0 12px 12px 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* 관련 글 섹션 */
.related-posts {
    background: #f8f9fa;
    padding: 4rem 0;
}

.related-posts h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    list-style: none;
    padding: 0;
}

.related-post {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s, box-shadow 0.3s;
}

.related-post:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.related-image {
    width: 100%;
    height: 240px;
    object-fit: cover;
    border-radius: 16px 16px 0 0;
}

.related-content {
    padding: 1.5rem;
}

.related-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 1rem;
    line-height: 1.4;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 내비게이션 */
.post-navigation {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    padding: var(--post-padding);
    border-top: 1px solid var(--border-color);
}

.prev-post,
.next-post {
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.prev-post:hover,
.next-post:hover {
    border-color: var(--accent-color);
    background: #f8f9fa;
}

.nav-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.nav-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 반응형 디자인 */
@media (max-width: 1200px) {
    .container {
        width: 95%;
    }
}

@media (max-width: 768px) {
    :root {
        --post-padding: 1.5rem;
    }

    .post-title {
        font-size: 1.8rem;
    }

    .post-navigation {
        grid-template-columns: 1fr;
    }

    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .markdown-body {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .post-meta {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .related-image {
        height: 200px;
    }
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-detail {
    animation: fadeIn 0.6s ease-out;
}

.related-post {
    animation: fadeIn 0.6s ease-out backwards;
}

.related-post:nth-child(1) { animation-delay: 0.1s; }
.related-post:nth-child(2) { animation-delay: 0.2s; }
.related-post:nth-child(3) { animation-delay: 0.3s; }
.related-post:nth-child(4) { animation-delay: 0.4s; }
.related-post:nth-child(5) { animation-delay: 0.5s; }
.related-post:nth-child(6) { animation-delay: 0.6s; }

.related-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s;
}

.related-link:hover {
    transform: translateY(-5px);
}

.related-post {
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.related-post:hover {
    transform: none;
}
/* 첨부 파일 섹션 스타일 */
.post-files {
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    background: white;
}

.post-files h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-item {
    margin: 0.5rem 0;
}

.file-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.file-link:hover {
    background: var(--accent-color);
    color: white;
}

.file-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* 삭제 버튼 스타일 */
.admin-actions {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

.delete-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #dc3545;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.delete-button:hover {
    background: #c82333;
    transform: scale(1.1);
}

.delete-button svg {
    width: 24px;
    height: 24px;
}

/* 삭제 버튼 텍스트 숨기기 */
.delete-button span {
    display: none;
}