/* ── 헤더 공통 초기화: 페이지 CSS와 상관없이 같은 모양 유지 ── */
header,
header * {
    box-sizing: border-box;
}
header {
    font-family: 'Noto Sans KR', 'Malgun Gothic', -apple-system, sans-serif;
    line-height: 1.5;
}
header ul,
header li,
header h1,
header p,
header form {
    margin: 0;
    padding: 0;
}
header ul {
    list-style: none;
}

header {
    background: #ffffff;
    padding: 16px 10%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 16px 40px;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.logo { 
    font-size: 22px; 
    font-weight: 800; 
    color: #111827; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    white-space: nowrap; 
}
.logo a,
.logo a:visited {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo a:hover {
    text-decoration: none;
    opacity: .85;
}
nav ul { display: flex; flex-wrap: wrap; list-style: none; gap: 12px 24px; }
nav a { font-weight: 700; font-size: 18px; color: #4b5563; text-align: center; display: block; transition: color 0.2s; text-decoration: none; }
nav a:hover { color: #f97316; }
nav a small { font-weight: 500; font-size: 11px; color: #9ca3af; display: block; margin-top: 2px; }
nav li { margin-right: 20px; }

.header-auth {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-auth .user-nickname {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #374151;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 8px 14px;
    border-radius: 20px;
    white-space: nowrap;
}

.header-auth .user-nickname strong {
    color: #f97316;
    font-weight: 800;
}

.header-auth .btn-auth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    white-space: nowrap;
    line-height: 1;
    transition: all 0.2s ease;
}

.header-auth .btn-login {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #ffffff !important;
    border: none;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
}

.header-auth .btn-login:hover {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
    color: #ffffff !important;
}

.header-auth .btn-signup {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff !important;
    border: none;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.header-auth .btn-signup:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    color: #ffffff !important;
}

.header-auth .btn-logout {
    background-color: #f3f4f6;
    color: #4b5563 !important;
    border: 1px solid #e5e7eb;
}

.header-auth .btn-logout:hover {
    background-color: #fee2e2;
    color: #dc2626 !important;
    border-color: #fca5a5;
    transform: translateY(-1px);
}

@media (max-width: 760px) {
    header { padding: 12px 5%; gap: 10px 20px; }
    nav ul { gap: 8px 16px; }
    nav a { font-size: 14px; }
    nav li { margin-right: 0; }
    .header-auth { margin-left: 0; }
}

.header-auth a.user-nickname { text-decoration: none; }

.notif-wrap { position: relative; }

.notif-bell {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    padding: 0;
    font-family: inherit;
}
.notif-bell:hover { background: #f8fafc; }

.notif-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #F0803C;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid #ffffff;
    line-height: 1;
}

.notif-panel {
    display: none;
    position: absolute;
    top: 48px;
    right: 0;
    width: 320px;
    max-width: calc(100vw - 24px);
    background: #ffffff;
    border: 1px solid #E7E7EC;
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(30, 30, 50, .12);
    overflow: hidden;
    z-index: 60;
    text-align: left;
}
.notif-panel.open { display: block; }

.notif-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #E7E7EC;
}
.notif-panel-head h4 { margin: 0; font-size: 14px; font-weight: 800; color: #2B2B33; }

.notif-mark-read {
    font-size: 11.5px;
    color: #5B8DEF;
    font-weight: 700;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.notif-list { max-height: 340px; overflow-y: auto; }

.notif-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 16px;
    border-bottom: 1px solid #E7E7EC;
    cursor: pointer;
    text-decoration: none;
    color: #2B2B33;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #F7F8FC; }
.notif-item.unread { background: #FAFAFE; }

.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #EEF1FB;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.notif-text { flex: 1; min-width: 0; }
.notif-title { font-size: 12.5px; font-weight: 600; line-height: 1.45; word-break: break-all; }
.notif-title b { font-weight: 800; }
.notif-time { font-size: 11px; color: #8A8A97; margin-top: 3px; }
.notif-dot { width: 6px; height: 6px; border-radius: 50%; background: #5B8DEF; flex-shrink: 0; margin-top: 6px; }

.notif-empty { padding: 28px 16px; text-align: center; font-size: 13px; color: #8A8A97; }

.notif-footer {
    display: block;
    text-align: center;
    padding: 12px;
    font-size: 12.5px;
    font-weight: 700;
    color: #5B8DEF;
    border-top: 1px solid #E7E7EC;
    text-decoration: none;
}
.notif-footer:hover { background: #F7F8FC; }

.header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #E7E7EC;
    border-radius: 20px;
    padding: 9px 16px;
    background: #F7F7F9;
    width: 220px;
    box-sizing: border-box;
    margin: 0;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.header-search:focus-within {
    border-color: #5B8DEF;
    box-shadow: 0 0 0 3px rgba(91, 141, 239, .15);
    background: #ffffff;
}
.header-search-icon { font-size: 13px; line-height: 1; }
.header-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    width: 100%;
    font-family: inherit;
    color: #2B2B33;
}

.notif-empty { line-height: 1.6; }
.notif-login {
    display: inline-block;
    margin-top: 10px;
    padding: 7px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #ffffff !important;
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 1100px) {
    .header-search { width: 160px; }
}
@media (max-width: 760px) {
    .header-search { width: 100%; flex: 1 1 100%; order: -1; }
    .header-auth { flex-wrap: wrap; width: 100%; }
}

@media (max-width: 1600px) {
    header { padding-left: 5%; padding-right: 5%; }
    nav li { margin-right: 8px; }
}
@media (max-width: 1440px) {
    .header-search { width: 150px; }
    nav a { font-size: 16px; }
}

/* 모바일 헤더 (760px 이하): 로고 + 알림 + 메뉴 버튼 한 줄,   */
/* 메뉴·검색·로그인 버튼은 ☰ 버튼을 눌렀을 때만 펼쳐짐          */
.nav-toggle { display: none; }

@media (max-width: 760px) {
    header {
        padding: 10px 16px;
        gap: 0;
        flex-wrap: wrap;
        position: sticky;
        top: 0;
        z-index: 1000;
    }
    header .logo { order: 1; flex: 1 1 auto; font-size: 19px; }

    /* .header-auth 안의 요소들을 header의 직접 자식처럼 배치 */
    .header-auth { display: contents; }

    .notif-wrap { order: 2; margin-right: 8px; }
    .notif-bell { width: 40px; height: 40px; }

    .nav-toggle {
        order: 4;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        background: #ffffff;
        font-size: 20px;
        line-height: 1;
        color: #374151;
        cursor: pointer;
    }

    nav,
    .header-search,
    .header-auth .btn-auth,
    .header-auth .user-nickname { display: none; }

    header.menu-open nav {
        display: block;
        order: 4;
        width: 100%;
        margin-top: 10px;
        border-top: 1px solid #f1f5f9;
    }
    header.menu-open nav ul { flex-direction: column; gap: 0; }
    header.menu-open nav li { margin: 0; }
    header.menu-open nav a {
        display: flex;
        align-items: baseline;
        gap: 8px;
        text-align: left;
        padding: 13px 4px;
        font-size: 16px;
        border-bottom: 1px solid #f3f4f6;
    }
    header.menu-open nav a small { display: inline; margin: 0; }

    header.menu-open .header-search {
        display: flex;
        order: 5;
        width: 100%;
        flex: 1 1 100%;
        margin-top: 12px;
    }
    header.menu-open .header-auth .btn-auth,
    header.menu-open .header-auth .user-nickname {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        order: 6;
        flex: 1 1 0;
        margin: 12px 4px 4px;
        padding: 10px 12px;
    }

    .notif-panel { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; max-width: none; }
}

/* 모바일 헤더의 작은 로그인 버튼 (로그아웃 상태에서만 출력됨) */
.btn-mini-login { display: none; }
@media (max-width: 760px) {
    .btn-mini-login {
        display: inline-flex;
        align-items: center;
        order: 3;                 /* 오른쪽: 알림 종(2)과 메뉴 버튼(4) 사이 */
        height: 32px;
        padding: 0 12px;
        margin-right: 8px;
        border-radius: 999px;
        background: #f97316;
        color: #ffffff;
        font-size: 13px;
        font-weight: 700;
        text-decoration: none;
        white-space: nowrap;
    }
    .btn-mini-login:visited { color: #ffffff; }
    /* ☰ 메뉴를 펼치면 큰 로그인/회원가입 버튼이 나오므로 작은 버튼은 숨김 */
    header.menu-open .btn-mini-login { display: none; }
}
