/* 메인 스타일시트 */

/* 웹 폰트 임포트 */
@import url('https://fonts.googleapis.com/css2?family=Nanum+Gothic:wght@400;700;800&display=swap');

/* 전체 페이지 스타일 */
html {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
    font-family: 'Nanum Gothic', sans-serif;
}

/* 해결책: 트랜지션 속성 명시적 제한 */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
    font-family: 'Nanum Gothic', sans-serif;
}

main {
    flex: 1 0 auto;
    position: relative;
    z-index: 1;
}

/* 네비게이션 바 스타일링 */
.navbar {
    position: relative;
    z-index: 1050 !important; /* 기존 1040에서 1050으로 증가 */
}

.navbar-brand {
    font-weight: bold;
    font-family: 'Nanum Gothic', sans-serif;
}

.nav-link {
    font-weight: 500;
    font-family: 'Nanum Gothic', sans-serif;
}

.navbar-collapse {
    z-index: 1050 !important; /* 기존 1030에서 1050으로 증가 */
}

/* 태블릿 크기에서 네비게이션 바 스타일링 (768px ~ 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .navbar-nav .nav-link-icon {
        padding: 0.5rem;
        text-align: center;
        width: 60px; /* 고정 너비 조정 */
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .navbar-nav .nav-link-icon .nav-text {
        display: none !important; /* 텍스트 숨김 */
    }

    .navbar-nav .nav-link-icon i {
        margin: 0; /* 아이콘 마진 제거 */
        font-size: 1.5rem; /* 아이콘 크기 확대 */
    }

    /* 알림 배지 조정 */
    .notification-dropdown .notification-badge {
        top: -5px;
        right: -5px;
        font-size: 0.7rem;
    }

    /* 드롭다운 메뉴는 텍스트 유지 */
    .dropdown-menu .dropdown-item .nav-text {
        display: inline;
    }

    /* 네비게이션 항목 간격 조정 */
    .navbar-nav .nav-item {
        margin: 0 0.5rem; /* 항목 간 간격 조정 */
    }

    /* 다크 모드에서 아이콘 색상 유지 */
    html.dark-mode .navbar-nav .nav-link-icon {
        color: #eaeaea !important;
    }

    /* 드롭다운 비활성화 */
    .nav-item.dropdown.d-none.d-lg-block {
        display: none !important;
    }
    .nav-item.d-lg-none {
        display: block !important;
    }

    /* 네비게이션 바 컨테이너 패딩 조정 */
    .navbar .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* 모바일에서 네비게이션 메뉴 오른쪽 정렬 */
@media (max-width: 991.98px) {
    .navbar-collapse {
        position: absolute;
        top: 100%;
        right: 0;
        width: 200px;
        background-color: #0d6efd; /* 주 메뉴 바탕색 */
        border-radius: 0 0 0 8px;
        box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.2);
        transition: transform 0.3s ease-in-out;
        transform: translateX(100%);
        z-index: 1030;
    }

    .navbar-collapse.show {
        transform: translateX(0);
    }

    /* 모바일에서 navbar-nav 내부 항목 정렬 */
    .navbar-nav {
        padding: 0.5rem 0.5rem 0.5rem 1rem;
    }

    .navbar-nav .nav-link {
        color: #fff !important;
    }

    /* 두 번째 navbar-nav (하단 메뉴) 스타일링 */
    .navbar-collapse .navbar-nav:nth-child(2) {
        background-color: #0b5ed7; /* 하단 메뉴 바탕색 */
        margin-top: 0.5rem;
        position: relative;
        border-bottom-left-radius: 8px; /* 왼쪽 아래 모서리 라운드 처리 */
    }

    /* 두 번째 navbar-nav 앞에 구분선 추가 */
    .navbar-collapse .navbar-nav:nth-child(2)::before {
        content: '';
        position: absolute;
        top: -0.5rem;
        left: 0;
        width: 100%;
        height: 1px;
        background-color: rgba(255, 255, 255, 0.2);
    }

    /* 드롭다운 메뉴도 오른쪽 정렬 */
    .navbar-nav .dropdown-menu {
        position: static;
        width: 100%;
        background-color: inherit;
        border: none;
        z-index: 1030;
        padding-left: 1rem;
    }

    .navbar-nav .dropdown-item {
        color: #fff !important;
        padding-left: 1rem;
    }

    .navbar-nav .dropdown-item:hover {
        background-color: #0b5ed7;
    }

    /* 다크 모드에서 스타일 조정 */
    html.dark-mode .navbar-collapse {
        background-color: #1a1a1a;
    }

    html.dark-mode .navbar-collapse .navbar-nav:nth-child(2) {
        background-color: #252525;
        border-bottom-left-radius: 8px; /* 다크 모드에서도 라운드 유지 */
    }

    html.dark-mode .navbar-nav .dropdown-menu {
        background-color: inherit;
    }

    html.dark-mode .navbar-nav .dropdown-item:hover {
        background-color: #2c2c2c;
    }

    html.dark-mode .navbar-collapse .navbar-nav:nth-child(2)::before {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

/* 모바일에서는 텍스트 표시 유지 */
@media (max-width: 767.98px) {
    .navbar-nav .nav-link-icon .nav-text {
        display: inline; /* 접힘 메뉴에서는 텍스트 표시 */
    }
}

/* 데스크톱에서는 텍스트와 아이콘 모두 표시 */
@media (min-width: 992px) {
    .navbar-nav .nav-link-icon .nav-text {
        display: inline;
    }
}

/* 카드 스타일링 */
.card {
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
    transition: background-color 0.3s, border-color 0.3s;
}

.card-header {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    transition: background-color 0.3s, border-color 0.3s;
}

/* 버튼 스타일링 */
.btn {
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
    font-family: 'Nanum Gothic', sans-serif;
}

/* 성경 컨텐츠 스타일링 */
.bible-content {
    font-family: 'Nanum Gothic', sans-serif;
    transition: background-color 0.3s, border-color 0.3s;
}

/* 테이블 스타일링 */
.table-responsive {
    border-radius: 0.25rem;
    overflow: hidden;
}

.table {
    font-family: 'Nanum Gothic', sans-serif;
}

/* 폼 스타일링 */
.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-control {
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
    font-family: 'Nanum Gothic', sans-serif;
}

/* 알림 메시지 스타일링 */
.alert {
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-family: 'Nanum Gothic', sans-serif;
}

/* 페이지네이션 스타일링 */
.pagination {
    justify-content: center;
    margin-top: 1.5rem;
    font-family: 'Nanum Gothic', sans-serif;
}

/* 읽기 캘린더 스타일링 */
.calendar-cell {
    height: 120px;
    overflow-y: auto;
}

.calendar-date {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

/* 반응형 조정 */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    h1, .h1 {
        font-size: 1.75rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
    }
    
    h3, .h3 {
        font-size: 1.25rem;
    }
}

/* 인쇄 스타일 */
@media print {
    .navbar, .btn, footer {
        display: none !important;
    }
    
    .container {
        width: 100%;
        max-width: 100%;
    }
    
    .card {
        border: none;
        box-shadow: none;
    }
}

/* 다크 모드 스타일 */
html.dark-mode {
    background-color: #121212;
    color: #eaeaea;
}

html.dark-mode body {
    background-color: #121212;
    color: #eaeaea;
}

html.dark-mode .card {
    background-color: #1e1e1e;
    border-color: #2c2c2c;
}

html.dark-mode .card-header {
    background-color: #2c2c2c;
    border-bottom-color: #3c3c3c;
}

html.dark-mode .form-control {
    background-color: #2c2c2c;
    border-color: #3c3c3c;
    color: #eaeaea;
}

html.dark-mode .table {
    color: #eaeaea;
}

html.dark-mode .table td,
html.dark-mode .table th {
    border-color: #3c3c3c;
}

html.dark-mode .bible-content {
    background-color: #1e1e1e;
    border-color: #2c2c2c;
}

html.dark-mode .dropdown-menu {
    background-color: #2c2c2c;
    border-color: #3c3c3c;
}

html.dark-mode .dropdown-item {
    color: #eaeaea;
}

html.dark-mode .dropdown-item:hover,
html.dark-mode .dropdown-item:focus {
    background-color: #3c3c3c;
}

html.dark-mode .navbar-dark {
    background-color: #1a1a1a !important;
}

html.dark-mode .bg-light {
    background-color: #1a1a1a !important;
}

html.dark-mode .text-muted {
    color: #aaaaaa !important;
}

html.dark-mode .settings-info {
    background-color: #2c2c2c;
}

/* 테마 토글 버튼 */
.theme-toggle {
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

html.dark-mode .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 헤딩 글꼴 설정 */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: 'Nanum Gothic', sans-serif;
    font-weight: 700;
}

/* 스크롤 버튼 스타일 */
.scroll-buttons {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.scroll-buttons.visible {
    opacity: 0.7;
    visibility: visible;
}

.scroll-buttons:hover {
    opacity: 0.9;
}

.scroll-buttons button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(250, 250, 250, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 다크 모드에서 버튼 스타일 조정 */
html.dark-mode .scroll-buttons button {
    background-color: rgba(50, 50, 50, 0.7);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 모달에 대한 명시적 z-index 및 트랜지션 재정의 */
.modal {
    transition: none !important; /* 다른 트랜지션 효과 제거 */
    z-index: 1060 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
}

.modal-dialog {
    z-index: 1070 !important;
    margin: 1.75rem auto !important;
    transition: transform 0.3s ease-out !important;
}

/* 모달 강제 표시를 위한 유틸리티 클래스 */
.modal-force-show {
    display: block !important;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-x: hidden;
    overflow-y: auto;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.modal-force-show .modal-dialog {
    transform: none !important;
    margin: 1.75rem auto !important;
}

@media (max-width: 768px) {
    /* 글자 크기 조정 */
    body {
        font-size: 16px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h4, h5 {
        font-size: 1.2rem;
    }
    
    /* 버튼 크기 조정 */
    .btn {
        padding: 0.5rem 0.75rem;
    }
    
    .btn-sm {
        padding: 0.4rem 0.6rem;
        font-size: 0.875rem;
    }
    
    /* 카드 여백 조정 */
    .card-body {
        padding: 1rem;
    }
    
    /* 목록 아이템 간격 조정 */
    .list-group-item {
        padding: 0.75rem 1rem;
    }
    
    /* 페이지네이션 크기 조정 */
    .pagination .page-link {
        padding: 0.4rem 0.6rem;
    }
    
    /* 댓글 영역 조정 */
    .comment-item {
        padding: 0.75rem 0;
    }
    
    /* 댓글 작성 폼 조정 */
    textarea.form-control {
        min-height: 100px;
    }
    
    /* 반응 버튼 크기 조정 */
    .reaction-btn {
        min-width: 90px;
        margin: 0.25rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* 모달 크기 조정 */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    /* 공지사항/게시글 상세 내용 영역 가독성 조정 */
    .post-content, .announcement-content, .note-content {
        font-size: 1rem;
        line-height: 1.6;
    }
}

/* 이미지 컨테이너 및 이미지 자동 리사이징 스타일 */
/* 기본 이미지 컨테이너 클래스 */
.img-container {
    width: 100%;
    overflow: hidden;
    margin-bottom: 1rem;
    position: relative;
}

/* 특정 비율의 이미지 컨테이너 */
.img-container-4-3 {
    width: 100%;
    padding-bottom: 75%; /* 4:3 비율 */
    position: relative;
    overflow: hidden;
}

.img-container-16-9 {
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 비율 */
    position: relative;
    overflow: hidden;
}

.img-container-1-1 {
    width: 100%;
    padding-bottom: 100%; /* 1:1 비율 (정사각형) */
    position: relative;
    overflow: hidden;
}

/* 고정 높이 이미지 컨테이너 */
.img-container-h200 {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.img-container-h300 {
    width: 100%;
    height: 300px;
    overflow: hidden;
}

.img-container-h400 {
    width: 100%;
    height: 400px;
    overflow: hidden;
}

/* 특정 너비 이미지 컨테이너 */
.img-container-w70 {
    width: 70%;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
}

.img-container-w50 {
    width: 50%;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
}

/* 이미지 컨테이너 안의 이미지 스타일 */
.img-container img,
.img-container-4-3 img,
.img-container-16-9 img,
.img-container-1-1 img,
.img-container-h200 img,
.img-container-h300 img,
.img-container-h400 img,
.img-container-w70 img,
.img-container-w50 img {
    max-width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

/* 비율 컨테이너 내부의 이미지 크기 조정 */
.img-container-4-3 img,
.img-container-16-9 img,
.img-container-1-1 img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* 비율을 유지하면서 컨테이너를 채움 */
}

/* 고정 높이 컨테이너 내부의 이미지 크기 조정 */
.img-container-h200 img,
.img-container-h300 img,
.img-container-h400 img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 비율을 유지하면서 컨테이너를 채움 */
}

/* 호버 효과 (선택 사항) */
.img-hover-zoom img:hover {
    transform: scale(1.05);
}

/* 이미지 캡션 스타일 */
.img-caption {
    display: block;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
    font-style: italic;
}

/* 에디터 내부 이미지 자동 리사이징 */
.note-editable img,
.note-content img,
.post-content img,
.announcement-content img,
.comment-content img,
.card-body img {
    max-width: 100% !important;
    height: auto !important;
}

/* 다크 모드에서 이미지 캡션 색상 조정 */
html.dark-mode .img-caption {
    color: #aaa;
}

.toast-container {
    z-index: 1050; /* 네비게이션 바 위에 표시 */
}

.notification-item:hover {
    background-color: #f8f9fa; /* 드롭다운 항목 호버 효과 */
}

@media (max-width: 991px) {
    .notification-dropdown-menu {
        display: none !important; /* 모바일에서 드롭다운 강제 숨김 */
    }
}

/* 알림 배지 스타일 */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.6rem;
    padding: 0.2rem 0.4rem;
}

/* 모바일 환경에서 배지 스타일 조정 */
@media (max-width: 991px) {
    .nav-item .position-relative .notification-badge {
        top: 0;
        right: -8px;
    }
}

/* 모바일 메뉴에서 알림 배지 스타일 */
.mobile-notification-badge {
    top: -5px !important;
    right: -5px !important;
    transform: translate(-50%, -50%) !important;
    font-size: 0.55rem !important;
    padding: 0.2rem 0.35rem !important;
}

/* 모바일 메뉴 열릴 때 특수 스타일 */
@media (max-width: 991px) {
    .navbar-nav .position-absolute.badge {
        top: 0 !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        margin-left: 5px !important;
    }
}