/* 헤더 컴포넌트 범위 내 사용자 정의 속성으로 한정 (전역 충돌 방지) */
.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);
}

/* 맥 데스크톱 앱은 제목 표시줄을 숨기고 웹 화면을 창 꼭대기까지 올린다(electron/main.js hiddenInset).
   숨은 제목 표시줄이 헤더 윗부분의 클릭을 가져가 버튼 위쪽이 눌리지 않았다(261001 실측: 꼭대기에서 약 35px).
   헤더를 창 끌기 영역으로 명시하고, 누를 수 있는 것은 끌기에서 뺀다. 1.0.7 다음 판부터는 preload 가 모든 페이지에
   같은 띠를 깔지만, 1.0.7 이하 앱을 위해 남긴다. */
body.electron-mac .c-header { -webkit-app-region: drag; }
body.electron-mac .c-header :is(a, button, input, select, textarea, label, [role="button"], [tabindex]) { -webkit-app-region: no-drag; }

/* 전역 .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;
    gap: 8px;
}

.logo-img {
    height: 24px;
    width: auto;
    display: block;
    position: relative;
    top: 0.5px;
}

.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;
}

.header-notification {
    position: relative;
    margin-right: 10px;
}

.notification-trigger {
    width: auto;
    height: auto;
    border-radius: 0;
    border: none;
    background: transparent;
    color: #3f5f8a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    position: relative;
    padding: 0;
    font-size: 18px;
}

.notification-trigger:hover {
    color: #2f517f;
    transform: translateY(-1px);
}

.notification-trigger i {
    font-weight: 400;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #e11d48;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 0 4px;
    border: 1px solid #fff;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.92);
}

.notification-badge-text {
    display: block;
    line-height: 1;
    transform: translate(0.25px, 0);
    font-variant-numeric: tabular-nums;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-height: 420px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    z-index: 1200;
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(193, 210, 233, 0.5);
    font-size: 13px;
    color: #3f5f8a;
}

.notification-read-all {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 4px 8px;
    background: #f6f9ff;
    color: #466da1;
    font-size: 11px;
    cursor: pointer;
}

.notification-list {
    max-height: 360px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(193, 210, 233, 0.35);
    cursor: pointer;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: #f7faff;
}

.notification-item.is-unread {
    background: #f4f8ff;
}

.notification-title {
    font-size: 13px;
    color: #2f4f78;
    font-weight: 600;
}

.notification-meta {
    font-size: 11px;
    color: #6c7f9a;
}

.notification-empty {
    padding: 24px 12px;
    text-align: center;
    font-size: 12px;
    color: #7a8da8;
}

/* 로그인 페이지로 연결되는 헤더 버튼 */
.header-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    color: #4a6da7;
    border: 1px solid #a8bcd8;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.header-login-btn:hover {
    background-color: #e8f0fb;
    border-color: #4a6da7;
}

[data-theme="dark"] .header-login-btn {
    background-color: transparent;
    color: #8ba9c9;
    border-color: #2f4a6a;
}

[data-theme="dark"] .header-login-btn:hover {
    background-color: #1f2731;
    border-color: #3a6fae;
}

.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 {
    /* 모달은 .header 밖(body 직속)이라 헤더 스코프 변수를 상속받지 못함 →
       여기서 직접 정의하지 않으면 var(--border-color)가 무효가 되어
       border-color가 currentColor(텍스트색)로 떨어져 테두리가 어둡게 보임 */
    --border-color: rgba(193, 210, 233, 0.72);
    --accent-color: #6a8fc3;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(600px 280px at 50% 20%, rgba(100, 140, 196, 0.2) 0%, transparent 70%),
        rgba(5, 12, 22, 0.58);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 1rem;
}

.header-modal .modal-content {
    position: relative;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.98) 100%);
    padding: 1.1rem 1.1rem 1rem;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--border-color) 88%, #fff 12%);
    max-width: 480px;
    width: min(92vw, 480px);
    box-shadow: 0 26px 58px -30px rgba(10, 25, 47, 0.52);
    animation: header-modal-in 180ms ease-out;
}

.header-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.45rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 82%, #fff 18%);
}

.header-modal .modal-header h3 {
    color: #27486f;
    margin: 0;
    font-size: 1.04rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-modal .modal-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--border-color) 78%, #fff 22%);
    background: rgba(255, 255, 255, 0.74);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #4a6588;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.header-modal .modal-close-btn:hover {
    color: #2f517f;
    border-color: color-mix(in srgb, var(--accent-color) 38%, #fff 62%);
    background: #f4f8ff;
}

.header-modal .modal-body {
    margin-bottom: 0.8rem;
}

.header-modal .modal-body p {
    margin: 0.42rem 0;
    line-height: 1.56;
    color: #3f5f8a;
    font-size: 0.92rem;
}

.header-modal .modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.header-modal .modal-actions .btn,
.header-modal .close-btn {
    height: 36px;
    border-radius: 10px;
    border: 1px solid transparent;
    padding: 0 0.88rem;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.header-modal .modal-actions .btn {
    width: auto;
    margin-top: 0;
}

.header-modal .modal-actions .btn:not(.btn-primary) {
    background: #f6f9ff;
    color: #3f5f8a;
    border-color: color-mix(in srgb, var(--border-color) 84%, #fff 16%);
}

.header-modal .modal-actions .btn:not(.btn-primary):hover {
    background: #edf3fc;
    color: #2f517f;
    transform: none;
}

/* 주요 액션 — soft accent (solid blue fill 지양: 버튼 스타일 규칙) */
.header-modal .modal-actions .btn-primary {
    background: #e6f1fb;
    color: #185fa5;
    border-color: color-mix(in srgb, #185fa5 28%, #fff 72%);
}

.header-modal .modal-actions .btn-primary:hover {
    background: #d8e8f8;
    border-color: color-mix(in srgb, #185fa5 42%, #fff 58%);
    transform: none;
}

/* 닫기 — 중립 secondary */
.header-modal .close-btn {
    margin-top: 0.25rem;
    width: 100%;
    background: #f6f9ff;
    color: #3f5f8a;
    border-color: color-mix(in srgb, var(--border-color) 84%, #fff 16%);
}

.header-modal .close-btn:hover {
    background: #edf3fc;
    color: #2f517f;
    transform: none;
}

@keyframes header-modal-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 햄버거 메뉴 버튼 스타일 */
.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;
    overflow: hidden;
    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: #6a8fc3;
}

/* 모바일 로그인 섹션 */
.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: #6a8fc3;
}

/* 아이콘과 텍스트 간격 */
.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: #6a8fc3;
    color: #6a8fc3;
}

/* 아이콘과 텍스트 간격 */
.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;
}

[data-theme="dark"] .notification-trigger {
    color: #c8c8c8;
}

[data-theme="dark"] .notification-dropdown {
    background: var(--dark-surface, #171717);
    border-color: var(--dark-border, #2a2a2a);
}

[data-theme="dark"] .notification-header {
    color: var(--dark-text, #edf0f3);
    border-bottom-color: var(--dark-border, #2a2a2a);
}

[data-theme="dark"] .notification-read-all {
    background: var(--dark-surface-2, #1d1d1d);
    border-color: var(--dark-border-2, #303030);
    color: var(--dark-text-muted, #c2c8d0);
}

[data-theme="dark"] .notification-item {
    border-bottom-color: var(--dark-border, #2a2a2a);
}

[data-theme="dark"] .notification-item:hover {
    background: #202020;
}

[data-theme="dark"] .notification-item.is-unread {
    background: #1f1f1f;
}

[data-theme="dark"] .notification-badge {
    border-color: #121212;
    box-shadow: 0 0 0 1px rgba(18, 18, 18, 0.94);
}

[data-theme="dark"] .notification-title {
    color: var(--dark-text, #edf0f3);
}

[data-theme="dark"] .notification-meta,
[data-theme="dark"] .notification-empty {
    color: var(--dark-text-soft, #aeb6c1);
}

[data-theme="dark"] .header-modal {
    background:
        radial-gradient(620px 320px at 50% 15%, rgba(77, 112, 165, 0.18) 0%, transparent 68%),
        rgba(0, 0, 0, 0.66);
}

[data-theme="dark"] .header-modal .modal-content {
    background: linear-gradient(180deg, #161d28 0%, #131a24 100%);
    border-color: #2d3f55;
    box-shadow: 0 24px 56px -30px rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .header-modal .modal-header {
    border-bottom-color: #2a3a4e;
}

[data-theme="dark"] .header-modal .modal-header h3 {
    color: #dde8f6;
}

[data-theme="dark"] .header-modal .modal-body p {
    color: #b7c7da;
}

[data-theme="dark"] .header-modal .modal-close-btn {
    background: #1d2735;
    border-color: #31445d;
    color: #c5d4e8;
}

[data-theme="dark"] .header-modal .modal-close-btn:hover {
    background: #223247;
    border-color: #3f5f87;
    color: #e4edf8;
}

[data-theme="dark"] .header-modal .modal-actions .btn:not(.btn-primary) {
    background: #1c2736;
    border-color: #31455f;
    color: #c5d4e8;
}

[data-theme="dark"] .header-modal .modal-actions .btn:not(.btn-primary):hover {
    background: #223248;
    color: #e5eefb;
    transform: none;
}

[data-theme="dark"] .header-modal .modal-actions .btn-primary {
    background: #15263e;
    border-color: #2f5479;
    color: #7fb4ea;
}

[data-theme="dark"] .header-modal .modal-actions .btn-primary:hover {
    background: #1b3050;
    border-color: #3a6391;
    color: #9cc8f3;
    transform: none;
}

[data-theme="dark"] .header-modal .close-btn {
    background: #1c2736;
    border-color: #31455f;
    color: #c5d4e8;
}

[data-theme="dark"] .header-modal .close-btn:hover {
    background: #223248;
    color: #e5eefb;
    transform: none;
}

/* 반응형 스타일 */
@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: flex-start;
        align-items: center;
    }

    .header-notification {
        margin-left: auto;
        margin-right: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
    }

    /* 🔴 채팅 버튼(#header-chat)도 같은 `.header-notification` 클래스를 달고 들어온다
       (chatPanel.js 가 알림 앞에 끼운다). 둘 다 `margin-left: auto` 를 받으면 남은 공간을
       반씩 나눠 가져 메시지 버튼이 화면 한가운데로 간다 — 260826 실측: 900px 폭에서
       둘 다 296.453px, 사이가 296px 벌어졌다.
       auto 여백은 앞의 하나만 갖고, 뒤따르는 형제는 벨 옆에 붙인다. */
    .header-notification ~ .header-notification {
        margin-left: 0;
    }

    .notification-trigger {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        line-height: 44px;
        align-items: center;
        justify-content: center;
    }

    .notification-trigger i {
        font-size: 18px;
        line-height: 1;
        transform: translateY(0.5px);
    }

    /* 44px 터치 영역이 아니라 중앙의 벨 아이콘 우상단에 숫자 배지를 고정한다. */
    .notification-badge {
        top: 4px;
        right: 4px;
    }

    .notification-dropdown {
        right: 0;
        left: auto;
        width: min(320px, calc(100vw - 16px));
        max-width: calc(100vw - 16px);
    }
    
    /* 데스크톱 요소들 숨기기 */
    .desktop-nav,
    .desktop-actions,
    .desktop-login {
        display: none;
    }
    
    /* 모바일 요소들 표시 */
    .mobile-only {
        display: flex;
    }
    
    /* 모바일에서 햄버거 버튼 터치 영역 확보 */
    .hamburger-btn {
        min-width: 44px;
        min-height: 44px;
        margin-left: 0.25rem;
        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;
    }

    .header-notification {
        margin-right: 0;
    }

    .notification-trigger {
        min-width: 34px;
        min-height: 34px;
        font-size: 17px;
    }

    .notification-badge {
        top: 8px;
        right: 8px;
        min-width: 6px;
        width: 6px;
        height: 6px;
        line-height: 0;
        padding: 0;
        font-size: 0;
        color: transparent;
    }
    
    .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;
    }
} 

@media (max-width: 768px) and (min-width: 481px) {
    .notification-badge {
        top: 8px;
        right: 8px;
        min-width: 6px;
        width: 6px;
        height: 6px;
        line-height: 0;
        padding: 0;
        font-size: 0;
        color: transparent;
    }
}

/* ── 근무 확인 모달 (PLAN 260803 진료의 근무 상태) ──
   .header-modal 의 배경·카드·헤더 스타일을 그대로 물려받고, 여기서는 선택지 줄만 정의한다.
   닫기 버튼이 없는 모달이라 선택지가 유일한 출구다 — 셋 다 눈에 잘 띄어야 한다.
   전역 `.btn` 이 끼어들 수 있어 배경·테두리·정렬을 전부 명시한다. */
.header-modal .duty-prompt-choices {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.9rem;
}

.header-modal .duty-prompt-choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    margin: 0;
    padding: 0.62rem 0.85rem;
    border-radius: 10px;
    /* 색은 아래 `[data-duty-status]` 가 상태별로 채운다 — 여기서는 뼈대만. */
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-primary, #1f2f46);
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.header-modal .duty-prompt-choice:hover:not(:disabled) {
    transform: none;
}

/* ── 상태별 색 (260804 요청) ──
   근무 상태 알약(`.today-flow-my-status-toggle.is-*`, dashboard-workflow-home.css)과
   같은 값이다. 선택 결과가 그대로 저 알약이 되므로 두 곳의 색이 어긋나면 안 된다.
   ⚠️ 저쪽 값을 바꾸면 여기도 같이 바꿀 것 — 토큰이 아니라 리터럴로 물려 있다. */
.header-modal .duty-prompt-choice[data-duty-status="waiting"] {
    background: #fff6e8;
    border-color: #f4dcb2;
    color: #8a5b14;
}

.header-modal .duty-prompt-choice[data-duty-status="off_duty"] {
    background: #f4f6fa;
    border-color: #e4e9f1;
    color: #7a8799;
}

.header-modal .duty-prompt-choice[data-duty-status="waiting"]:hover:not(:disabled) {
    background: #ffefd6;
    border-color: #eaca92;
}

.header-modal .duty-prompt-choice[data-duty-status="off_duty"]:hover:not(:disabled) {
    background: #eceff5;
    border-color: #d5dce7;
}

.header-modal .duty-prompt-choice:disabled {
    opacity: 0.55;
    cursor: progress;
}

.header-modal .duty-prompt-choice-label {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.header-modal .duty-prompt-choice-sub {
    font-size: 0.76rem;
    font-weight: 500;
    opacity: 0.72;
}

.header-modal .duty-prompt-hint {
    font-size: 0.8rem;
    opacity: 0.75;
}

.header-modal .duty-prompt-error {
    margin-top: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    background: #fdecec;
    border: 1px solid #f2c3c3;
    color: #a33a3a;
    font-size: 0.8rem;
}

/* 다크도 같은 짝 — `body[data-theme="dark"].workflow-home-page .today-flow-my-status-toggle.is-*`
   (dashboard-workflow-home.css:1385~) 와 같은 값이다.
   비근무는 무채색이다(260929 원장 「푸른끼가 별로」). 진료의 필터 표시(dashboard-provider-status.css)·
   센터 근무 상태(center.css)도 같은 값이라 네 곳을 함께 바꾼다. */
[data-theme="dark"] .header-modal .duty-prompt-choice[data-duty-status="waiting"] {
    background: #33280f;
    border-color: #7a5a26;
    color: #f0c98a;
}

[data-theme="dark"] .header-modal .duty-prompt-choice[data-duty-status="off_duty"] {
    background: #202020;
    border-color: #363636;
    color: #a3a3a3;
}

[data-theme="dark"] .header-modal .duty-prompt-choice[data-duty-status="waiting"]:hover:not(:disabled) {
    background: #3f3114;
    border-color: #96702f;
}

[data-theme="dark"] .header-modal .duty-prompt-choice[data-duty-status="off_duty"]:hover:not(:disabled) {
    background: #262626;
    border-color: #444444;
}

[data-theme="dark"] .header-modal .duty-prompt-error {
    background: #33191b;
    border-color: #5c2b2e;
    color: #f0a9a9;
}

/* ── 근무 확인 모달 다크 보정 (260804 사용자 지적: "너무 푸릇푸릇") ──
   `.header-modal` 공용 다크값은 채도 29~32% 의 파랑이다(카드 #161d28, 선택지 #1c2736,
   테두리 #2d3f55, 본문 #b7c7da). 뒤에 깔린 페이지는 토큰 기준 #10100f·#171717 로
   사실상 무채색이라 이 모달만 파랗게 떠 보인다. 여기서만 토큰 회색으로 맞춘다.
   공용 규칙을 그대로 둔 건 다른 헤더 모달(알림·로그아웃)도 같은 파랑을 쓰기 때문이다 —
   그쪽까지 바꾸려면 별도 요청으로 다룬다. */
[data-theme="dark"] #duty-prompt-modal {
    /* 파란 발광(radial-gradient rgba(77,112,165,.18)) 제거 — 무채 오버레이만 남긴다 */
    background: rgba(0, 0, 0, 0.66);
}

[data-theme="dark"] #duty-prompt-modal .modal-content {
    background: var(--color-surface, #171717);
    border-color: var(--color-border-default, #2a2a2a);
}

[data-theme="dark"] #duty-prompt-modal .modal-header {
    border-bottom-color: var(--color-border-default, #2a2a2a);
}

[data-theme="dark"] #duty-prompt-modal .modal-header h3 {
    color: var(--color-text-primary, #edf0f3);
}

[data-theme="dark"] #duty-prompt-modal .modal-body p {
    color: var(--color-text-muted, #c2c8d0);
}

/* 선택지 자체 색은 위 `.duty-prompt-choice` 규칙이 드롭다운과 맞춰 둔다 — 여기서 다시 덮지 않는다. */

/* ── 사이트 헤더 접기 (260826 사용자 요청) ────────────────────────────────
   병원 화면은 세로 공간이 곧 진료 정보다. 기본을 접힌 상태로 두고 화면 우측 상단에
   [열기][메시지][알림][이름] 만 남긴다. 접히면 헤더가 `position: fixed` 로 흐름에서
   빠지므로 그 높이만큼 본문이 위로 올라온다 — 이게 이 기능의 목적이다.

   ⚠️ 데스크톱(1025px 이상) 전용이다. 그 아래에서는 햄버거가 유일한 네비게이션이라
      접으면 메뉴로 가는 길이 없어진다.
   ⚠️ 토글은 `body.header-collapsible` 일 때만 보인다 — 커뮤니티·위키 같은 일반 페이지에는
      헤더가 곧 네비게이션이라 접을 것이 아니다. 그 클래스는 header.js 가 병원 경로에서만 건다. */
.header-collapse-toggle,
.header-drag-grip {
    display: none;
}

/* 접힘/펼침을 오갈 때 짧게 한 번 페이드한다. 두 상태의 이름이 달라야 다시 튄다 —
   같은 `animation-name` 이면 클래스를 토글해도 CSS 애니메이션은 재시작하지 않는다. */
@keyframes header-swap-collapsed {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: none; }
}

@keyframes header-swap-expanded {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: none; }
}

@media (min-width: 1025px) {
    /* 🔴 `.header, .c-header` 의 `transition: all 0.3s ease` 를 여기서 좁힌다.
       접고 펼칠 때 폭이 1440px ↔ auto 로, `position` 이 sticky ↔ fixed 로 바뀌는데
       `all` 이 그 중간값을 그리려 들어 좌우가 팍 튄다. 게다가 `left` 까지 걸려 있어
       끌 때 막대가 손가락을 0.3초 뒤에 따라왔다(260826 실측 — 놓는 순간 rect 가
       인라인 좌표와 300px 어긋났다).
       기하는 즉시 바꾸고, 상태가 바뀐 느낌은 아래 짧은 페이드로 낸다. */
    body.header-collapsible .header,
    body.header-collapsible .c-header {
        transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    }

    /* 🔴 접힌 막대는 **자리가 정해진 뒤에** 나타난다(header.js `header-settled`).
       막대의 x 가 폭에서 나오는데 폭을 만드는 조각(이름·채팅 단추·알림 단추)이 다
       늦게 오기 때문이다 — 먼저 그리면 자리를 네 번 옮긴다(260827 실측:
       1274 → 1103.8 → 1075.8 → 1050.1, 마지막이 356ms).
       `display` 가 아니라 `visibility` 다 — 폭을 재는 쪽(measureHeaderMetrics)이
       숨은 동안에도 그대로 재야 한다. */
    body.header-collapsible.header-collapsed:not(.header-settled) .header,
    body.header-collapsible.header-collapsed:not(.header-settled) .c-header {
        visibility: hidden;
    }

    /* 페이드는 접힘 클래스가 아니라 `header-settled` 에 건다 — 접힘은 HTML 이 꽂히기
       전에 이미 붙어 있어서, 거기 걸면 막대가 보이기 시작할 땐 이미 끝나 있다. */
    body.header-collapsible.header-collapsed.header-settled .header,
    body.header-collapsible.header-collapsed.header-settled .c-header {
        animation: header-swap-collapsed 0.16s ease-out;
    }

    body.header-collapsible:not(.header-collapsed) .header,
    body.header-collapsible:not(.header-collapsed) .c-header {
        animation: header-swap-expanded 0.16s ease-out;
    }

    /* 자석 기준점을 잴 때만 켜진다(header.js measureExpandedToggleLeft).
       접힌 배치를 한 프레임 안에서 펼쳤다 되돌리므로, 그동안 페이드와 색 전환을 끊는다.
       끄는 도중에는 쓰지 않는다 — 클래스가 붙었다 떨어지면 페이드가 다시 걸린다. */
    body.header-measuring .header,
    body.header-measuring .c-header {
        animation: none !important;
        transition: none !important;
    }

    /* 끄는 동안 페이드를 `animation: none` 으로 끊지 말 것 — 손을 뗄 때 이름이
       none → header-swap-collapsed 로 돌아오며 페이드가 한 번 더 튄다.
       페이드는 세로(translateY)만 건드리므로 좌우 추적에는 영향이 없다. */

    body.header-collapsible .header-collapse-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        margin-right: 10px;
        padding: 0;
        border: 1px solid var(--border-color, rgba(193, 210, 233, 0.72));
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.7);
        color: #3f5f8a;
        font-size: 13px;
        cursor: pointer;
        transition: color 0.2s ease, background-color 0.2s ease;
    }

    body.header-collapsible .header-collapse-toggle:hover {
        color: #2f517f;
        background: #eef4ff;
    }

    body.header-collapsed .header,
    body.header-collapsed .c-header {
        position: fixed;
        top: 0;
        /* 좌우 대칭이라 화면 끝에 붙이지 않는다 — 붙이면 한쪽 둥근 모서리가 잘린다.
           끌어서 옮길 때도 같은 여백(HEADER_EDGE_GAP)을 남긴다. */
        right: 8px;
        left: auto;
        width: auto;
        margin: 0;
        padding: 0;
        border: 1px solid var(--border-color);
        border-top: none;
        border-radius: 0 0 14px 14px;
        /* 접힌 막대는 본문 위에 뜬다 — 배경을 페이지와 같은 값으로 두면 아이콘만 떠 보인다.
           불투명하게 깔고 그림자로 띄운다 (다크는 아래에서 다시 준다). */
        background: rgba(255, 255, 255, 0.94);
        box-shadow: 0 6px 18px -10px rgba(53, 80, 118, 0.45);
    }

    body.header-collapsed .c-header__inner {
        width: auto;
        max-width: none;
        margin: 0;
        /* 좌우 같은 값 — 대칭의 절반은 여기서 난다. */
        padding: 0 12px;
        overflow: visible;
    }

    body.header-collapsed .header-content {
        height: 38px;
        gap: 4px;
        justify-content: flex-end;
    }

    /* 로고·네비·글쓰기·햄버거는 접힌 막대에 들어가지 않는다.
       로그아웃도 뺀다 — 펼치면 바로 나오고, 막대는 좁을수록 본문을 덜 가린다. */
    body.header-collapsed .logo,
    body.header-collapsed .main-nav,
    body.header-collapsed .desktop-actions,
    body.header-collapsed .hamburger-btn,
    body.header-collapsed .logout-btn {
        display: none;
    }

    body.header-collapsed .user-profile {
        gap: 6px;
    }

    body.header-collapsed .user-profile img {
        width: 24px;
        height: 24px;
        border-width: 1px;
    }

    /* 접힌 막대에서 이름은 3글자까지만, 줄임표 없이 자른다.
       `white-space: nowrap` 이 핵심이다 — 기본값 `normal` 이면 막대가 좁은 자리로
       밀렸을 때 이름이 줄바꿈되며 막대가 두 줄이 된다(260826 실측). */
    body.header-collapsed .user-profile span {
        display: inline-block;
        /* 폭은 header.js 가 실제 글자 진행폭을 재서 넘긴다 — `3em` 은 한글 3글자보다
           넓어 네 번째 글자가 삐져나온다(260826 실측: 42px vs 36.33px). */
        max-width: var(--header-name-clip, 3em);
        overflow: hidden;
        white-space: nowrap;
        text-overflow: clip;
        vertical-align: middle;
    }

    body.header-collapsed .header-notification {
        margin-right: 6px;
    }
}

/* 끌개, 그리고 다크 보정.
   다크는 같은 미디어 쿼리 안에, 라이트보다 높은 특이도로 적어야 한다 —
   `[data-theme="dark"] .header-collapse-toggle` 만으로는 위의
   `body.header-collapsible .header-collapse-toggle` 에 진다.
   `data-theme` 는 body 에 붙으므로(theme.dark.css 도 `body[data-theme="dark"]` 을 쓴다)
   후손 결합자가 아니라 body 자신에 붙여 적는다. */
@media (min-width: 1025px) {
    body[data-theme="dark"].header-collapsible .header-collapse-toggle {
        border-color: var(--dark-border, #2a2a2a);
        background: var(--dark-surface-2, #1d1d1d);
        color: #c8c8c8;
    }

    body[data-theme="dark"].header-collapsible .header-collapse-toggle:hover {
        background: var(--dark-surface, #171717);
        color: #ffffff;
    }

    /* 끌개 — 점 격자 사각형. 접혔을 때만 보인다(펼친 헤더는 옮길 것이 아니다). */
    body.header-collapsed .header-drag-grip {
        display: block;
        flex: none;
        /* 세로로 긴 점 격자 — 가로:세로 = 3:5, 3열 × 5행. */
        width: 9px;
        height: 15px;
        margin-right: 10px;
        color: #9fb2cc;
        background-image: radial-gradient(currentColor 0.9px, transparent 1.2px);
        background-size: 3px 3px;
        background-position: 0.5px 0.5px;
        background-repeat: repeat;
        cursor: grab;
        touch-action: none;
    }

    body.header-collapsed .header-drag-grip:hover {
        color: #6b86a8;
    }

    body.header-dragging .header-drag-grip {
        cursor: grabbing;
    }

    /* 끄는 동안 본문 글자가 잡혀 파랗게 물드는 것을 막는다. */
    body.header-dragging {
        user-select: none;
    }

    body[data-theme="dark"].header-collapsed .header-drag-grip {
        color: #6b6b6b;
    }

    body[data-theme="dark"].header-collapsed .header-drag-grip:hover {
        color: #9a9a9a;
    }

    body[data-theme="dark"].header-collapsed .header,
    body[data-theme="dark"].header-collapsed .c-header {
        border-color: var(--dark-border, #2a2a2a);
        background: var(--dark-surface, #171717);
        box-shadow: 0 6px 18px -10px rgba(0, 0, 0, 0.7);
    }
}
