/* blog.css */

/* 폰트 및 기본 스타일 초기화 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;700;900&display=swap');

html, body {
    height: 100%; /* 추가: 높이 기준을 100%로 설정 */
    margin: 0;
    padding: 0;
    width: 100%;
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #e0e0e0;
    background-color: #121212;
    display: flex; /* 추가: .container를 수직 중앙 정렬하기 위해 사용 */
    align-items: flex-start; /* 수정: 상단 정렬로 변경하여 전체 스크롤 허용 */
    justify-content: center;
}

.container {
    max-width: 900px;
    margin: 0 auto; /* 수정: 상하 마진 제거 */
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
    height: 95vh; /* 복원: 쇼케이스 카드가 보이도록 높이 복원 */
    display: flex; /* 추가: 자식 요소를 정렬하기 위해 flex 사용 */
    flex-direction: column; /* 추가: 자식 요소를 세로로 쌓음 (제목 -> 메인 컨텐츠) */
}

main.content-area {
    width: 100%;
    flex-grow: 1; /* 추가: 제목을 제외한 나머지 공간을 모두 차지하도록 설정 */
    min-height: 0; /* 복원: flex 아이템 크기가 비정상적으로 커지는 것을 방지 */
}

#post-list-view {
    height: 100%; /* 수정: 부모(main.content-area) 높이를 100% 채우도록 변경 */
    display: flex;
    align-items: center;
    justify-content: center;
}

#post-detail-view {
    padding: 25px;
    background-color: #1e1e1e;
    border-radius: 12px;
    border: 1px solid #333;
    /* 플로팅 버튼이 있으므로 내부 스크롤 제거하고 전체 페이지 스크롤 사용 */
    box-sizing: border-box;
}

/* 상세 페이지일 때 컨테이너 높이 제한 해제 */
.container.detail-view {
    height: auto !important;
    min-height: 95vh;
}

.page-title {
    font-size: 2.8rem;
    font-weight: 900;
    margin: 10px 0 20px;
    text-align: center;
    background: linear-gradient(45deg, #4f80c8, #7a54a8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    flex-shrink: 0; /* 추가: 제목이 컨텐츠 영역에 의해 줄어들지 않도록 설정 */
}

/* --- ✨ 쇼케이스 스타일 --- */
.showcase-container {
    position: relative;
    width: 100%;
    height: 100%;
    perspective: 1500px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.showcase-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}
.showcase-card {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    margin: auto;
    width: 70%;
    max-width: 650px;
    height: 95%; /* 이 값은 부모 높이(#post-list-view)의 95%가 되므로 의도대로 작동합니다. */
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    cursor: auto;
}
.showcase-card.active { 
    transform: translateX(0) scale(1); 
    opacity: 1; 
    z-index: 10;
    cursor: pointer;
}
.showcase-card.prev { transform: translateX(-45%) scale(0.8); opacity: 0.4; z-index: 5; filter: blur(2px); }
.showcase-card.next { transform: translateX(45%) scale(0.8); opacity: 0.4; z-index: 5; filter: blur(2px); }
.showcase-card.hidden { transform: scale(0.5); opacity: 0; pointer-events: none; z-index: 1; }
.card-image, .card-image-placeholder { width: 100%; height: 55%; object-fit: cover; }
.card-image-placeholder { background: linear-gradient(45deg, #222, #333); }
.card-content { padding: 20px; display: flex; flex-direction: column; flex-grow: 1; overflow: hidden; }
.card-title { font-size: 1.4rem; margin: 0 0 5px; color: #fff; }
.card-meta { font-size: 0.8rem; color: #a0a0a0; margin-bottom: 15px; }
.card-preview { font-size: 1.0rem; line-height: 1.6; flex-grow: 1; overflow-y: auto; }

.showcase-nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 20;
    background-color: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2);
    color: white; width: 45px; height: 45px; border-radius: 50%;
    font-size: 1.5rem; cursor: pointer; backdrop-filter: blur(5px); transition: all 0.3s ease;
}
.showcase-nav:hover:not(:disabled) { background-color: rgba(255, 255, 255, 0.2); transform: translateY(-50%) scale(1.1); }
.showcase-nav:disabled { opacity: 0.3; cursor: not-allowed; }
.showcase-nav.prev { left: 5%; }
.showcase-nav.next { right: 5%; }

/* --- 상세 페이지 스타일 --- */
.post-title { font-size: 1.8rem; font-weight: 700; margin: 0 0 10px; color: #ffffff; }
.post-meta { font-size: 0.9rem; color: #a0a0a0; margin-bottom: 20px; }
.post-content { font-size: 1rem; line-height: 1.7; color: #c0c0c0; }
.post-content img { max-width: 100%; height: auto; display: block; margin: 1em 0; border-radius: 8px; }
.post-navigation { display: flex; justify-content: space-between; margin-bottom: 25px; border-bottom: 1px solid #333; padding-bottom: 20px; }
.nav-button { color: #a0a0a0; text-decoration: none; font-weight: 700; font-size: 1rem; transition: color 0.2s; }
.nav-button:hover { color: #ffffff; }
.nav-button.disabled { color: #555; cursor: not-allowed; }

/* --- 플로팅 액션 버튼 (FAB) --- */
.fab-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
}
.fab {
    width: 56px;
    height: 56px;
    background: linear-gradient(45deg, #4f80c8, #7a54a8);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(122, 84, 168, 0.5);
}
.fab[style*="display: none"] {
    display: none !important;
}

/* --- 상세 보기용 액션 버튼 --- */
#detail-actions {
    padding: 15px 0 0;
    text-align: right;
    margin-top: 20px;
}
.action-button {
    display: inline-block;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #e0e0e0;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 10px;
}
.action-button:hover {
    background-color: #333;
    border-color: #666;
}
.action-button.edit-button {
    background: linear-gradient(45deg, #007BFF, #6f42c1);
    border: none;
    color: white;
    margin-top: 20px;
}

/* --- 댓글 스타일 --- */
.back-button {
    display: inline-block;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #e0e0e0;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.back-button:hover {
    background-color: #333;
    border-color: #666;
}

.back-button.home {
    background: linear-gradient(45deg, #4f80c8, #7a54a8);
    border: none;
    color: white;
}

.back-button.history {
    background: linear-gradient(45deg, #6c757d, #495057);
    border: none;
    color: white;
}

/* 댓글 섹션 스타일 */
#comments-section {
    margin-top: 30px;
}

#comments-section h3 {
    color: #ffffff;
    font-size: 1.3rem;
    margin-bottom: 20px;
}

.comment-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.comment-input-group input {
    flex: 1;
    min-width: 0;
    padding: 12px;
    background-color: #1e1e1e;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.comment-input-group input:focus {
    outline: none;
    border-color: #4f80c8;
}

#comment-content {
    width: 100%;
    min-height: 100px;
    background-color: #1e1e1e;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 12px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease;
    margin-bottom: 15px;
}

#comment-content:focus {
    outline: none;
    border-color: #4f80c8;
}

#comment-form {
    margin-top: 20px;
}

#comment-form .back-button {
    margin-top: 10px;
}

.comment-item {
    border-bottom: 1px solid #333;
    padding: 20px 0;
    margin-bottom: 10px;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-item .comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.comment-item .comment-author {
    font-weight: 700;
    color: #ffffff;
    font-size: 0.95rem;
}

.comment-item .comment-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.comment-item .comment-date {
    color: #666;
    font-size: 0.8rem;
}

.comment-item .comment-actions {
    font-size: 0.75rem;
}

.comment-item .comment-actions a {
    color: #999;
    text-decoration: none;
    transition: color 0.2s ease;
}

.comment-item .comment-actions a:hover {
    color: #ccc;
}

.comment-item .comment-content {
    color: #c0c0c0;
    line-height: 1.6;
    margin: 0;
    font-size: 0.9rem;
}

/* --- 모바일 반응형 --- */
@media (max-width: 768px) {
    .page-title { font-size: 2.2rem; }
    .showcase-card { width: 70%; }
    .showcase-nav.prev { left: 2%; }
    .showcase-nav.next { right: 2%; }
    .showcase-card.prev { transform: translateX(-40%) scale(0.7); }
    .showcase-card.next { transform: translateX(40%) scale(0.7); }
    
    .fab-container {
        flex-direction: row-reverse;
        width: 100%;
        justify-content: center;
        bottom: 20px;
        right: 0;
        left: 0;
        gap: 25px;
    }
}

@media (max-width: 480px) {
    /** 추가: 내용을 수직 중앙이 아닌 상단에 정렬하도록 변경 **/
    body {
        align-items: flex-start;
    }
    /* 컨테이너의 상하 여백을 늘려 전체적으로 숨 쉴 공간을 확보합니다. */
    .container {
        height: auto;
        padding-top: 15px;
        padding-bottom: 15px;
        box-sizing: border-box;
    }

    /* 카드의 높이를 75vh로 줄여 하단 버튼과의 충돌을 방지합니다. */
    #post-list-view {
        height: 65vh;
    }

    /* 페이지 제목의 하단 여백을 늘려 카드와의 간격을 확보합니다. */
    .page-title {
        font-size: 1.8rem;
        margin: 0 0 10px 0;
    }
    
    /* --- 아래는 기존과 동일한 코드입니다 --- */
    .showcase-card { width: 85%; }
    .card-title { font-size: 0.6rem !important;} 
    .card-preview { font-size: 0.4rem !important;} 
    .comment-input-group { 
        flex-direction: column; 
        gap: 8px;
    }
    .comment-input-group input {
        flex: none;
        width: 100%;
        min-width: 100%;
    }
    #post-detail-view { padding: 15px; }
}

/* 매우 작은 화면에서의 추가 처리 */
@media (max-width: 360px) {
    .comment-input-group {
        gap: 6px;
    }
    .comment-input-group input {
        padding: 10px;
        font-size: 0.85rem;
    }
    #comment-content {
        min-height: 80px;
        font-size: 0.85rem;
    }
}