/* SINCAR Header Styles */

.home-header {
    position: sticky;
    top: 0;
    z-index: 12000; /* 모바일 GNB가 항상 콘텐츠 위로 올라오도록 z-index 강화 */
    background: #ffffff;
    border-bottom: 1px solid #dddddd;
}

.home-header__inner {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    height: 72px;
    padding: 0 24px;
}

/* 브랜드 로고 */
.home-header .brand a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: -0.2px;
    font-size: 28px;
}

/* 헤더 왼쪽 영역 */
.header-left {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 100%;
}

.header-left nav.gnb {
    height: 100%;
}

/* GNB 메뉴 */
.home-header .gnb ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 4px;
    height: 100%;
}

.home-header .gnb ul li {
    height: 100%;
}

.home-header .gnb a {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 16px;
    height: 100%;
    border-radius: 8px;
}

.home-header .gnb a:hover {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.05);
}

.home-header .gnb a.is-active {
    color: #2563eb;
    font-weight: 700;
    border-bottom: 3px solid #2563eb;
    border-radius: 0;
}

.home-header .gnb a.highlight {
    font-weight: 700;
    color: #2563eb;
}

/* 모바일 헤더 래퍼 */
.mobile-header-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 사용자 영역 */
.home-header .user-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-logged-out {
    display: flex;
    gap: 8px;
}

/* 카카오 로그인 버튼 */
.kakao-auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #3C1E1E;
    background: #FEE500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.kakao-auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(254, 229, 0, 0.4);
}

/* 로그인 상태 */
.home-header .welcome-msg {
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.home-header .user-name {
    color: #2563eb;
    font-weight: 600;
}

.home-header .logout-btn {
    padding: 8px 16px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.home-header .logout-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* 모바일 메뉴 토글 */
.home-header .menu-toggle {
    display: none;
    border: none;
    background: #2563eb;
    color: white;
    border-radius: 8px;
    height: 44px;
    width: 44px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 20px;
    align-items: center;
    justify-content: center;
}

.home-header .menu-toggle:hover {
    background: #1d4ed8;
}

/* 햄버거 아이콘 */
.menu-toggle .menu-icon {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 20px;
}

.menu-toggle .menu-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* 메뉴 열렸을 때 X 아이콘으로 변환 */
.home-header.is-open .menu-toggle .menu-icon span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.home-header.is-open .menu-toggle .menu-icon span:nth-child(2) {
    opacity: 0;
}

.home-header.is-open .menu-toggle .menu-icon span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ===== 태블릿 크기 ===== */
@media (max-width: 1024px) {
    .home-header__inner {
        height: 68px;
        padding: 0 20px;
    }

    .home-header .gnb ul {
        gap: 2px;
    }

    .home-header .gnb a {
        padding: 8px 10px;
        font-size: 15px;
    }
    
    .header-left {
        gap: 24px;
    }
}

/* ===== 모바일 크기 ===== */
@media (max-width: 768px) {
    .home-header__inner {
        height: 60px;
        padding: 0 16px;
    }

    .home-header .brand a {
        font-size: 24px;
    }

    .home-header .user-area {
        gap: 12px;
    }

    .kakao-auth-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .home-header .welcome-msg {
        display: none;
    }

    .home-header .logout-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* 모바일 메뉴 토글 표시 */
    .home-header .menu-toggle {
        display: flex;
    }

    /* 모바일 드롭다운 메뉴 */
    .home-header .gnb {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        display: none;
        background: #ffffff;
        border-bottom: 1px solid #e5e7eb;
        box-shadow: 0 15px 30px rgba(15, 23, 42, 0.15);
        z-index: 15000; /* 콘텐츠보다 항상 위 */
        border-radius: 0 0 16px 16px;
        overflow: hidden;
        animation: none;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }

    .home-header.is-open .gnb {
        display: block;
        animation: mobileDropdown 0.3s ease forwards;
    }

    @keyframes mobileDropdown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .home-header .gnb ul {
        margin: 0;
        padding: 16px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .home-header.is-open .gnb li {
        height: auto;
    }

    .home-header.is-open .gnb a {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 18px 20px;
        border-radius: 12px;
        font-size: 17px;
        font-weight: 600;
        color: #374151;
        background: #f8fafc;
        border: 1px solid #e5e7eb;
        text-decoration: none;
        transition: all 0.2s ease;
    }

    .home-header.is-open .gnb a:hover,
    .home-header.is-open .gnb a:active {
        background: #e0e7ff;
        color: #2563eb;
        border-color: #c7d2fe;
    }

    /* 현재 선택된 메뉴만 파란색 활성화 */
    .home-header.is-open .gnb a.is-active {
        background: #2563eb;
        color: #ffffff;
        border-color: #2563eb;
    }

    /* highlight 클래스는 모바일에서 일반 스타일 유지 */
    .home-header.is-open .gnb a.highlight {
        color: #374151;
        background: #f8fafc;
        border-color: #e5e7eb;
    }

    .home-header.is-open .gnb a.highlight:hover {
        background: #e0e7ff;
        color: #2563eb;
        border-color: #c7d2fe;
    }

    .home-header.is-open .gnb a.highlight.is-active {
        background: #2563eb;
        color: #ffffff;
        border-color: #2563eb;
    }
}

/* ===== 작은 모바일 ===== */
@media (max-width: 480px) {
    .home-header__inner {
        height: 56px;
        padding: 0 12px;
    }

    .home-header .brand a {
        font-size: 20px;
    }

    .mobile-header-wrap {
        gap: 8px;
    }

    .kakao-auth-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .home-header .logout-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .home-header .menu-toggle {
        height: 40px;
        width: 40px;
    }

    .menu-toggle .menu-icon {
        width: 18px;
        gap: 4px;
    }

    /* 작은 모바일 메뉴 위치 조정 */
    .home-header .gnb {
        padding-top: 56px;
    }

    .home-header .gnb ul {
        height: calc(100vh - 56px);
        max-width: 320px;
        border-radius: 12px 0 0 12px;
    }

    .home-header.is-open .gnb a {
        padding: 16px 18px;
        font-size: 16px;
    }
}
