/* 기본 & 전체 레이아웃 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    background-color: #f7f9fc;
    color: #333;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh; /* 전체 화면 높이 사용 */
}

header {
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #fff;
    width: 100%;
    box-sizing: border-box;
}

h1 {
    font-size: 1.5em;
    margin: 0 0 10px 0;
    text-align: center;
}

.progress-container {
    width: 100%;
    background-color: #e9ecef;
    border-radius: 20px;
    overflow: hidden;
    height: 10px;
}

.progress-bar {
    height: 100%;
    background-color: #4dabf7;
    transition: width 0.4s ease;
}

.progress-text {
    text-align: center;
    font-size: 0.8em;
    margin-top: 5px;
    color: #868e96;
    font-weight: bold;
}

main {
    flex-grow: 1; /* 남은 공간 모두 차지 */
    display: flex;
    flex-direction: column;
    overflow-y: hidden; /* main 영역의 스크롤은 숨김 */
}

/* 탭 스타일 */
.tabs {
    display: flex;
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
}

.tab-link {
    flex: 1;
    padding: 12px 15px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1em;
    color: #868e96;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-bottom-color 0.2s;
}

.tab-link:hover {
    color: #495057;
}

.tab-link.active {
    color: #339af0;
    font-weight: 600;
    border-bottom-color: #339af0;
}

/* 컨텐츠 컨테이너 (좌/우 분할) */
.bible-container {
    display: flex;
    flex-grow: 1;
    overflow-y: hidden; /* 내부 스크롤을 위해 */
}

/* 왼쪽: 책 목록 */
.book-list-container {
    width: 300px;
    border-right: 1px solid #dee2e6;
    overflow-y: auto; /* 내용 많으면 스크롤 */
    background-color: #fff;
}

.book-item {
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f5;
}

.book-item:hover {
    background-color: #f8f9fa;
}

.book-item.active {
    background-color: #e7f5ff;
    font-weight: 600;
    color: #1c7ed6;
}

.book-item-title {
    font-size: 1em;
}

.book-item-progress {
    font-size: 0.85em;
    color: #adb5bd;
}

.book-item.active .book-item-progress {
    color: #1c7ed6;
}


/* 오른쪽: 장 목록 */
.chapter-list-container {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto; /* 내용 많으면 스크롤 */
}

.no-selection {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #adb5bd;
    font-size: 1.1em;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 8px;
}

.chapter-grid label {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ced4da;
    border-radius: 8px;
    height: 45px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    position: relative;
}

.chapter-grid input[type="checkbox"] {
    display: none;
}

.chapter-grid span {
    font-size: 1em;
    font-weight: 500;
    color: #495057;
}

.chapter-grid input[type="checkbox"]:checked + span {
    color: transparent;
}

.chapter-grid label:hover {
    border-color: #868e96;
}

.chapter-grid input[type="checkbox"]:checked + span::after {
    content: '✔';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #339af0;
    font-size: 1.8em;
    line-height: 1;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .bible-container {
        flex-direction: column;
    }

    .book-list-container {
        width: 100%;
        height: 40%; /* 화면 높이의 40% 차지 */
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }

    .chapter-list-container {
        height: 60%;
    }

    h1 { font-size: 1.2em; }
    .tab-link { font-size: 0.9em; }
}
