body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.6; color: #333; background-color: #f8f9fa; margin: 0; padding: 20px; }

/* --- ▼▼▼ 파일 맨 아래에 이 부분을 추가하세요 ▼▼▼ --- */

/* 좌측 패널 상단 타입 선택기 스타일 */
.type-selector {
    display: flex;
    justify-content: space-around;
    background-color: #e9ecef;
    padding: 20 px;
    border-bottom: 1px solid #ddd;
}
.type-selector a {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: #495057;
    padding: 10px 0;
    font-weight: bold;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}
.type-selector a:hover {
    background-color: #dee2e6;
}
.type-selector a.active {
    background-color: #007bff;
    color: white;
}

/* 기존 h2 태그와 자연스럽게 연결되도록 조정 */
#sticky-stats h2 {
    margin-top: 0;
    padding-top: 15px;
    border-radius: 0; /* 위쪽 둥근 모서리 제거 */
}

#sticky-stats .stats-table {
    border-radius: 0 0 8px 8px; /* 아래쪽 모서리는 둥글게 유지 */
    overflow: hidden; /* IE/Edge 에서 radius 적용을 위함 */
}

#sticky-stats { 
    position: fixed; left: 10px; top: 20px; 
    width: 330px; background-color: #fff; 
    border: 1px solid #ddd; 
    border-radius: 8px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); z-index: 1000; 
    margin-right: 20px; /* 이 부분을 추가하세요 */
}
 
#sticky-stats .stats-table th, #sticky-stats .stats-table td { padding: 8px; text-align: center; border-bottom: 1px solid #f2f2f2; }

#sticky-stats .stats-table th:first-child,
#sticky-stats .stats-table td:first-child {
    min-width: 75px !important;
    text-align: left;
    padding-left: 15px;
}
.container { max-width: 900px; margin-left: 345px; background-color: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

/* --- ▼▼▼ 파일 맨 아래에 이 부분을 추가하세요 ▼▼▼ --- */

/* 현황판에서 선택된 카테고리 행(row) 스타일 */
#sticky-stats .stats-table tr.active-category {
    background-color: #e0e7ff; /* 연한 남색으로 하이라이트 */
}

/* 현황판의 카테고리 이름을 링크처럼 보이게 하고, 셀 전체를 클릭할 수 있도록 함 */
#sticky-stats .stats-table td:first-child a {
    text-decoration: none;
    color: inherit; /* 부모의 글자색 상속 */
    display: block;
    padding: 8px; /* 기존 셀 패딩 값을 링크 안으로 이동 */
    margin: -8px; /* 늘어난 패딩만큼 마이너스 마진을 주어 원래 크기 유지 */
}

@media (max-width: 1280px) {
    #sticky-stats { display: none; }
    .container { margin: 0 auto; }
}
.filters {
    margin-bottom: 20px;
    padding: 30px;
    background-color: #e9ecef;
    border-radius: 30px;
    display: flex;
    gap: 10px;
}
.filters a {
    text-decoration: none;
    padding: 8px 15px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    background-color: #fff;
    color: #495057;
    font-size: 14px;
    transition: all 0.2s;
}
.filters a:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}
.filters a.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: bold;
}

/* --- ▼▼▼ 이전에 추가했던 .mbti-stats-panel 스타일은 삭제해주세요. ▼▼▼ --- */
/*
.mbti-stats-panel {
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
}
*/

/* --- ▼▼▼ 파일 맨 아래에 아래 새로운 코드를 추가하세요. ▼▼▼ --- */

/* MBTI 유형 그리드 패널 스타일 */
.mbti-grid-panel {
    margin-top: 20px;
}
.mbti-grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2개의 열을 만듬 */
    gap: 6px; /* 아이템 사이의 간격 */
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #ddd;
}
.mbti-type-link {
    display: block;
    padding: 8px;
    text-align: center;
    text-decoration: none;
    color: #333;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}
.mbti-type-link:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.mbti-type-link.active {
    background-color: #007bff;
    color: white;
    font-weight: bold;
    border-color: #007bff;
}
/* --- ▼▼▼ 파일 맨 아래에 이 부분을 추가하세요 ▼▼▼ --- */

h1, h2 { border-bottom: 2px solid #eee; padding-bottom: 10px; margin-bottom: 20px; }
form { margin-bottom: 30px; padding: 20px; background-color: #f8f9fa; border-radius: 8px; display: flex; align-items: center; gap: 15px; }
label { font-weight: bold; }
select, button { padding: 10px 15px; border-radius: 5px; border: 1px solid #ccc; font-size: 16px; }
button { background-color: #007bff; color: white; border-color: #007bff; cursor: pointer; transition: background-color 0.2s; }
button:hover { background-color: #0056b3; }
.result-item { margin-bottom: 30px; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; }

/* 1. 이 부분을 찾아서 아래 코드로 완전히 교체해주세요. */
.result-header {
    background-color: #f2f2f2;
    padding: 10px 15px;
    font-weight: bold;
    display: flex;                 /* 자식 요소들을 가로로 배치 */
    justify-content: space-between; /* 자식 요소들을 양쪽 끝으로 밀어냄 */
    align-items: center;           /* 자식 요소들의 세로 높이를 중앙에 맞춤 */
}

/* 2. 바로 아래의 이 부분도 아래 코드로 교체하거나 확인해주세요. */
.result-header > span:last-child > button + button {
    margin-left: 8px;
}
/* --- ▲▲▲ 여기까지 추가 --- */
.copy-btn { padding: 5px 10px; font-size: 12px; background-color: #6c757d; color: white; }
.copy-btn:hover { background-color: #5a6268; }
.status-btn { padding: 5px 10px; font-size: 12px; color: white; }
.status-btn.toggle-view-btn {
    background-color: #6c757d;
}
.status-btn.toggle-view-btn:hover {
    background-color: #5a6268;
}
.status-btn.completed-btn { background-color: #28a745; }
.status-btn.completed-btn:hover { background-color: #218838; }
.status-btn.used-btn { background-color: #dc3545; }
.status-btn.used-btn:hover { background-color: #c82333; }

.result-item.is-completed {
    background-color: #e8f5e9;
}
.result-item.is-completed .result-header {
    background-color: #c8e6c9;
}
.result-item.is-used-0 {
background-color: #fbe9e7; /* 항목 배경색 유지 (선택 사항) */
}
.result-item.is-used-0 .result-header {
background-color: #ffccbc;  /* 헤더 배경색 유지 */
}
.result-item.is-used-0 textarea {
background-color: rgba(255, 204, 204, 0.5) !important; /* 연한 분홍색, 투명도 50% */
opacity: 1 !important; /* 텍스트는 불투명하게 유지 */
pointer-events: none; /* 텍스트 편집 방지 */
}
textarea { width: 100%; height: 150px; padding: 15px; box-sizing: border-box; border: none; font-size: 15px; line-height: 1.6; resize: vertical; background-color: #fdfdfd; }
.no-results { text-align: center; color: #777; padding: 50px 0; }
.pagination { text-align: center; margin-bottom: 20px; }
.pagination a { color: #007bff; text-decoration: none; padding: 8px 16px; border: 1px solid #ddd; margin: 0 4px; border-radius: 4px; transition: background-color 0.2s; }
.pagination a:hover { background-color: #f0f0f0; }

.pagination a.active { background-color: #007bff; color: white; border-color: #007bff; }

/* --- ▼▼▼ 파일 맨 아래에 이 부분을 추가하세요 ▼▼▼ --- */

/* 맨 위로 가기 버튼 스타일 */
#scrollToTopBtn {
    display: none; /* 기본적으로 숨김 */
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1001; /* 다른 요소들 위에 오도록 */
    border: none;
    outline: none;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%; /* 원형 버튼 */
    font-size: 18px;
    line-height: 1; /* 글자가 중앙에 오도록 */
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s;
}

#scrollToTopBtn:hover {
    background-color: #0056b3;
}

/* --- ▼▼▼ 파일 맨 아래에 이 부분을 추가하세요 ▼▼▼ --- */

/* 필터와 보기 옵션 버튼을 한 줄에 배치하기 위한 컨테이너 */
.controls-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* 창이 좁아지면 줄바꿈 */
    gap: 10px;
}

/* 제목만 보기 모드가 활성화되었을 때 스타일 */
#results-container.title-view-mode .result-item textarea {
    display: none;
}
#results-container.title-view-mode .result-item {
    margin-bottom: 10px; /* 제목만 보일 때는 간격을 줄여서 쾌적하게 */
}

/* =================================== */
/* v7.0 UI/UX 개선 스타일 추가         */
/* =================================== */

/* 상단 고정 내비게이션 바 */
.top-nav {
    position: sticky;
    top: 0;
    width: 100%;
    background-color: #ffffff;
    z-index: 1020; /* 다른 요소들보다 위에 오도록 설정 */
    padding: 8px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px; /* 컨테이너와의 간격 */
}

.links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.links a {
    padding: 8px 15px;
    border-radius: 8px;
    background-color: #f8f9fa;
    color: #343a40;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease-in-out;
}

.links a:hover {
    background-color: #007bff;
    color: #fff;
    border-color: #0056b3;
    transform: translateY(-2px);
}

/* 메인 컨테이너의 top 마진 조정 */
body {
    padding-top: 60px; /* 고정된 내비게이션 바 높이만큼 여백 추가 */
}

/* result-item 헤더 내부의 레벨 버튼 */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-buttons {
    display: flex;
    gap: 5px;
}

.level-btn {
    padding: 5px 10px;
    font-size: 12px;
}
.level-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
}
.level-btn.inactive {
    background-color: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
    border-color: #ced4da;
}

/* 레벨별 콘텐츠 래퍼 및 개별 콘텐츠 */
.level-content-wrapper {
    border-top: 1px solid #e0e0e0;
}

.level-content {
    padding: 10px;
    background-color: #fdfdfd;
}
.level-content:not(:last-child) {
    border-bottom: 1px dashed #e0e0e0;
}

.level-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
    color: #6c757d;
}

/* 제목만 보기 모드 (compact-view) */
.compact-view .level-content-wrapper {
    display: none;
}
/* 제목만 보기 모드에서 개별적으로 펼쳐진 항목 */
.compact-view .result-item.expanded .level-content-wrapper {
    display: block;
}