/* 헤더 컴포넌트 범위 내 사용자 정의 속성으로 한정 (전역 충돌 방지) */
.header, .c-header {
    --primary-color: #4a70aa;
    --accent-color: #6a8fc3;
    --text-color: #27486f;
    --light-bg: #f4f8ff;
    --border-color: rgba(193, 210, 233, 0.72);
    --shadow-sm: 0 6px 16px -14px rgba(58, 84, 122, 0.4);
    --shadow-md: 0 14px 30px -22px rgba(53, 80, 118, 0.44);
    --transition-speed: 0.3s;
}

.header, .c-header {
    background: rgba(255, 255, 255, 0.58);
    backdrop-filter: blur(12px);
    box-shadow: none;
    padding: 0.48rem 0;
    margin-bottom: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(193, 210, 233, 0.6);
}

/* 전역 .container 충돌 회피를 위해 헤더 내부 전용 래퍼 추가 */
.c-header__inner {
    width: min(1280px, 94%);
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 10px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 46px;
}

.logo a {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo h1 {
    font-size: 1.28rem;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
    color: var(--primary-color);
    margin: 0;
    letter-spacing: -0.03em;
    transition: color 0.2s ease;
}

/* 로고 왼쪽 여백 약간 추가 */
.logo {
    margin-left: 8px;
}

.logo h1:hover {
    color: #3c6195;
}

.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.main-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1.8rem;
}

.main-nav a {
    text-decoration: none;
    color: #3b5f8f;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
    padding: 0.36rem 0;
    position: relative;
    transition: color 0.2s ease;
}

.main-nav a:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #4b74ac;
    transition: width 0.3s ease;
}

.main-nav a:hover {
    color: #2f517f;
}

.main-nav a:hover:after {
    width: 100%;
}

.login-container {
    display: flex;
    align-items: center;
}

.google-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    color: #5f6368;
    border: 1px solid #dadce0;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: none;
}

.google-login-btn:hover {
    background-color: #f5f9ff;
    box-shadow: none;
    border-color: #c4d6ee;
}

.google-login-btn:active {
    background-color: #f1f3f4;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.google-login-btn img {
    width: 18px;
    height: 18px;
    margin-right: 8px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 마이페이지 링크 스타일 추가 */
.user-profile-link {
    text-decoration: none; /* 링크 밑줄 제거 */
    color: inherit; /* 부모 요소의 글자색 상속 */
    display: inline-block; /* 이미지가 포함된 div를 올바르게 감싸기 위해 */
}

.user-profile-link:hover .user-profile span {
    /* 예시: 호버 시 이름 색상 변경 */
    color: var(--accent-color);
}

.user-profile img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.user-profile img:hover {
    border-color: var(--accent-color);
}

.user-profile span {
    font-size: 14px;
    color: var(--text-color);
    font-weight: 500;
}

.logout-btn {
    background: none;
    border: none;
    color: #5f6368;
    cursor: pointer;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 999px;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.logout-btn:hover {
    background-color: #f3f8ff;
    color: #42689d;
}

/* 게시글 작성 버튼 스타일 */
.action-buttons {
    margin-right: 15px;
}

.write-post-btn {
    display: flex;
    align-items: center;
    background: linear-gradient(180deg, rgba(103, 137, 184, 0.12), rgba(86, 122, 172, 0.09));
    color: #3f6698;
    border: 1px solid rgba(93, 127, 176, 0.62);
    border-radius: 999px;
    corner-shape: superellipse(1.2);
    padding: 0.42rem 0.86rem;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: none;
    text-decoration: none;
    box-shadow: 0 8px 20px -18px rgba(46, 78, 121, 0.38);
}

.write-post-btn:hover {
    background: linear-gradient(180deg, rgba(103, 137, 184, 0.12), rgba(86, 122, 172, 0.09));
    box-shadow: 0 8px 20px -18px rgba(46, 78, 121, 0.38);
    transform: none;
}

.write-post-btn:active {
    transform: none;
    box-shadow: 0 8px 20px -18px rgba(46, 78, 121, 0.38);
}

/* 모달 스타일 */
.header-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.header-modal .modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-md);
}

.header-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.header-modal .modal-header h3 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.2rem;
}

.header-modal .modal-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

.header-modal .modal-close-btn:hover {
    color: var(--accent-color);
}

.header-modal .modal-body {
    margin-bottom: 20px;
}

.header-modal .modal-body p {
    margin: 10px 0;
    line-height: 1.5;
    color: var(--text-color);
}

.header-modal .close-btn {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-top: 10px;
    width: 100%;
}

.header-modal .close-btn:hover {
    background-color: var(--accent-color);
}

/* 햄버거 메뉴 버튼 스타일 */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    min-width: 44px; /* 터치 영역 확대 (최소 44x44px 권장) */
    min-height: 44px; /* 터치 영역 확대 */
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    position: relative;
    z-index: 10001; /* 헤더보다 위에 표시되도록 */
    pointer-events: auto; /* 클릭 가능하도록 명시 */
    -webkit-tap-highlight-color: transparent; /* 모바일에서 탭 하이라이트 제거 */
}

.hamburger-btn:hover {
    background-color: var(--light-bg);
}

.hamburger-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-color);
    margin: 3px 0;
    transition: background-color 0.2s ease;
    border-radius: 1px;
}

/* 햄버거 버튼 활성화 시 시각적 피드백만 제공 (X 변환 제거) */
.hamburger-btn.active {
    background-color: var(--light-bg);
}

.hamburger-btn.active span {
    background-color: var(--primary-color);
}

/* 모바일 사이드바 스타일 */
.mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.mobile-sidebar.active {
    visibility: visible;
    opacity: 1;
}

.mobile-sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.mobile-sidebar-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 280px;
    height: 100%;
    background-color: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.mobile-sidebar.active .mobile-sidebar-content {
    transform: translateX(0);
}

.mobile-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--light-bg);
}

.mobile-sidebar-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.mobile-sidebar-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-color);
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mobile-sidebar-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--accent-color);
}

.mobile-sidebar-body {
    padding: 1rem;
}

/* 모바일 사용자 프로필 */
.mobile-user-profile {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--light-bg);
    border-radius: 8px;
}

.mobile-profile-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-profile-info img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

.mobile-profile-text {
    flex: 1;
}

.mobile-profile-name {
    display: block;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.mobile-mypage-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.mobile-mypage-link:hover {
    color: var(--accent-color);
}

/* 모바일 로그인 섹션 */
.mobile-login-section {
    margin-bottom: 1.5rem;
}

.mobile-google-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background-color: white;
    color: #5f6368;
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.mobile-google-login-btn:hover {
    background-color: #f8f9fa;
    box-shadow: var(--shadow-md);
}

.mobile-google-login-btn img {
    width: 18px;
    height: 18px;
    margin-right: 8px;
}

/* 모바일 네비게이션 */
.mobile-nav {
    margin-bottom: 1.5rem;
}

.mobile-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav li {
    margin-bottom: 8px;
}

.mobile-nav-link {
    display: block;
    padding: 12px 16px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.mobile-nav-link:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
}

/* 모바일 액션 버튼들 */
.mobile-actions {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.mobile-write-post-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    margin-bottom: 12px;
}

.mobile-write-post-btn:hover {
    background-color: var(--accent-color);
}

/* 아이콘과 텍스트 간격 */
.mobile-write-post-btn i { margin-right: 8px; }

.mobile-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.mobile-logout-btn:hover {
    background-color: #f8f9fa;
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* 아이콘과 텍스트 간격 */
.mobile-logout-btn i { margin-right: 8px; }

/* 데스크톱/모바일 표시 제어 */
.mobile-only {
    display: none;
}

/* 다크 모드: 헤더 모바일/태블릿 사이드바 + 햄버거 */
[data-theme="dark"] .hamburger-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .hamburger-btn span {
    background-color: #e6ebf2;
}

[data-theme="dark"] .hamburger-btn.active {
    background-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .hamburger-btn.active span {
    background-color: #ffffff;
}

[data-theme="dark"] .mobile-sidebar-overlay {
    background-color: rgba(0, 0, 0, 0.64);
}

[data-theme="dark"] .mobile-sidebar-content {
    background-color: #171717;
    box-shadow: -2px 0 16px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .mobile-sidebar-header {
    background-color: #1f1f1f;
    border-bottom-color: #2f2f2f;
}

[data-theme="dark"] .mobile-sidebar-header h3,
[data-theme="dark"] .mobile-profile-name,
[data-theme="dark"] .mobile-nav-link,
[data-theme="dark"] .mobile-logout-btn {
    color: #edf0f3;
}

[data-theme="dark"] .mobile-sidebar-close {
    color: #d4dae3;
}

[data-theme="dark"] .mobile-sidebar-close:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

[data-theme="dark"] .mobile-user-profile {
    background-color: #202020;
}

[data-theme="dark"] .mobile-profile-info img {
    border-color: #3a3a3a;
}

[data-theme="dark"] .mobile-mypage-link {
    color: #a9bfdc;
}

[data-theme="dark"] .mobile-mypage-link:hover {
    color: #c2d5ef;
}

[data-theme="dark"] .mobile-google-login-btn {
    background-color: #222;
    color: #e5e9ee;
    border-color: #3a3a3a;
    box-shadow: none;
}

[data-theme="dark"] .mobile-google-login-btn:hover {
    background-color: #2a2a2a;
    box-shadow: none;
}

[data-theme="dark"] .mobile-nav-link:hover {
    background-color: #242424;
    color: #ffffff;
}

[data-theme="dark"] .mobile-actions {
    border-top-color: #2f2f2f;
}

[data-theme="dark"] .logout-btn {
    color: #edf0f3;
    background-color: transparent;
}

[data-theme="dark"] .logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

[data-theme="dark"] .mobile-write-post-btn {
    background-color: #4a70aa;
    color: #ffffff;
}

[data-theme="dark"] .mobile-write-post-btn:hover {
    background-color: #5e83ba;
}

[data-theme="dark"] .mobile-logout-btn {
    border-color: #3a3a3a;
    background-color: #1b1b1b;
}

[data-theme="dark"] .mobile-logout-btn:hover {
    background-color: #252525;
    border-color: #5a6a7f;
    color: #ffffff;
}

/* 반응형 스타일 */
@media (max-width: 1024px) {
    .header, .c-header {
        padding: 0.42rem 0;
        background: #f8fbff;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: none;
    }

    .c-header__inner {
        width: min(1280px, 96%);
        padding: 0 0.5rem;
    }
    
    .header-content {
        flex-direction: row;
        height: 46px;
        padding: 0;
        justify-content: space-between;
        align-items: center;
    }
    
    /* 데스크톱 요소들 숨기기 */
    .desktop-nav,
    .desktop-actions,
    .desktop-login {
        display: none;
    }
    
    /* 모바일 요소들 표시 */
    .mobile-only {
        display: flex;
    }
    
    /* 모바일에서 햄버거 버튼 터치 영역 확보 */
    .hamburger-btn {
        min-width: 44px;
        min-height: 44px;
        z-index: 10001;
    }
}

@media (max-width: 1024px) {
    [data-theme="dark"] .header,
    [data-theme="dark"] .c-header {
        background: #121212;
        border-bottom: 1px solid #2a2a2a;
    }

    [data-theme="dark"] .logo h1 {
        color: #edf0f3;
    }
}

@media (max-width: 480px) {
    .header, .c-header {
        padding: 0.38rem 0;
    }

    .c-header__inner {
        width: 98%;
        padding: 0 0.25rem;
    }
    
    .header-content {
        padding: 0;
    }
    
    .main-nav ul {
        gap: 0.75rem;
        padding: 0 0.25rem;
    }
    
    .action-buttons {
        padding: 0 0.25rem;
    }
    
    .login-container {
        padding: 0 0.25rem;
    }
    
    .user-profile img {
        width: 28px;
        height: 28px;
    }
    
    .user-profile span {
        font-size: 12px;
    }
    
    .write-post-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .google-login-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
} 
