/* --- 기본 변수 설정 --- */
:root {
    --color-primary: #4B70C3; 
    --color-secondary: #91C1D4; 
    --color-text-main: #1A1A1A; 
    --color-text-sub: #777777; 
    --color-bg-white: #FFFFFF;
    --font-family-kr: 'Noto Sans KR', sans-serif;
    --header-height: 80px; 
    --container-width: 1200px; 
}

body {margin:0px !important;}

.main-header {
    background-color: var(--color-bg-white);
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
}

.header-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* 로고 스타일 */
.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo-text-group {
    display: flex;
    flex-direction: column;
}
.logo-main-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-main);
    line-height: 1.2;
}
.logo-sub-text {
    font-size: 10px;
    color: var(--color-text-sub);
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.2;
    margin-top: -2px;
}

/* --- PC 네비게이션 및 드롭다운 기본 스타일 --- */
.nav-menu {
    display: flex;
    gap: 30px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    font-family: var(--font-family-kr);
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-main);
    text-decoration: none;
    display: block;
    padding: 28px 0; /* 헤더 높이에 맞춤 */
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--color-primary);
}

/* PC 서브메뉴 디자인 (기본 숨김) */
.sub-menu {
    position: absolute;
    top: var(--header-height);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-bg-white);
    min-width: 160px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border-radius: 0 0 8px 8px;
    list-style: none;
    padding: 10px 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.sub-menu li a {
    display: block;
    padding: 10px 20px;
    font-size: 14px;
    color: var(--color-text-main);
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.sub-menu li a:hover {
    background-color: #f4f7fc;
    color: var(--color-primary);
}

/* PC 마우스 호버 시 서브메뉴 노출 */
.nav-item:hover .sub-menu {
    opacity: 1;
    visibility: visible;
}

/* 유틸리티 영역 */
.utility-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
}
.login-link {
    font-size: 14px;
    color: var(--color-text-sub);
    text-decoration: none;
}
.login-link:hover {
    color: var(--color-primary);
}
.btn-donation {
    background-color: var(--color-primary);
    color: var(--color-bg-white);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.3s ease;
}
.btn-donation:hover {
    background-color: #3d5a9c;
}

/* 햄버거 버튼 */
.hamburger-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}
.hamburger-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: var(--color-text-main);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* --- 반응형 (모바일/태블릿: 768px 이하) --- */
@media (max-width: 768px) {
    
    .nav-wrapper {
        position: fixed;
        top: var(--header-height);
        left: -100%;
        width: 100%;
        height: calc(100vh - var(--header-height));
        background-color: var(--color-bg-white);
        transition: left 0.3s ease-in-out;
        overflow-y: auto; /* 메뉴가 길 경우 스크롤 가능 */
        box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
        padding: 20px 0 50px 0;
    }

    .nav-wrapper.active {
        left: 0;
    }

    .nav-menu {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
    }

    .nav-item {
        border-bottom: 1px solid #f0f0f0;
    }

    .nav-link {
        padding: 15px 25px;
        font-size: 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* 모바일에서 하위 메뉴가 있다는 화살표 표시 */
    .nav-link::after {
        content: '+';
        font-weight: 400;
        font-size: 18px;
        transition: transform 0.3s;
    }

    .nav-item.open .nav-link::after {
        content: '-';
    }

    /* 모바일 서브메뉴 기본 숨김 (아코디언 형태) */
    .sub-menu {
        position: static;
        transform: none;
        box-shadow: none;
        background-color: #fafafa;
        width: 100%;
        display: none; /* JS로 제어 */
        opacity: 1;
        visibility: visible;
        padding: 5px 0;
        border-radius: 0;
    }

    .sub-menu li a {
        padding: 10px 40px;
        font-size: 14px;
        color: #555;
    }

    .hamburger-toggle {
        display: flex;
    }

    .hamburger-toggle.active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .hamburger-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    .hamburger-toggle.active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}

/* --- 모바일 환경에서 유틸리티 영역(로그인, 온라인헌금) 사이즈 축소 --- */
@media (max-width: 768px) {
    .utility-wrapper {
        gap: 10px; /* 요소 간 간격을 좁힘 */
    }

    .login-link {
        font-size: 10px; /* 글자 크기 축소 */
    }

    .btn-donation {
        padding: 5px 12px; /* 버튼 내부 여백을 줄여서 전체 크기를 아담하게 만듦 */
        font-size: 13px;   /* 버튼 글자 크기 축소 */
        border-radius: 15px; /* 둥근 모서리 비율 조정 */
    }
}

/* 화면이 아주 작은 스마트폰(아이폰 SE 등)을 위한 추가 최적화 */
@media (max-width: 480px) {
    .utility-wrapper {
        gap: 8px;
    }
    
    .btn-donation {
        padding: 4px 10px;
        font-size: 12px;
    }
}

/* 유틸리티 영역 정렬 */
.utility-wrapper {
    display: flex;
    align-items: center;
    gap: 9px;
}

/* 관리자 모드 아이콘 버튼 스타일 (평소에 계속 빙글빙글 회전) */
.admin-icon-link {
    color: #3b82f6;
    /* spin 애니메이션을 무한 반복 (3초 동안 1바퀴, 원형 회전) */
    animation: continuous-spin 3s linear infinite;
    transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}


/* 360도 무한 회전 키프레임 애니메이션 */
@keyframes continuous-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* 모바일에서만 좌측 여백을 0으로 강제 조정 */
@media (max-width: 768px) {
    .nav-wrapper{margin-left:0px !important;}
    
}

/* 모바일에서 강제 여백 제거 */
@media (max-width: 767px) {
    body, #wrapper2, #container_wr2, .church-about-wrap {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* 혹시 모를 내부 요소의 패딩도 제거 */
    .church-container {
        padding: 0 !important;
        margin: 0 !important;
    }
}