/* =================================================================
   header.css — 상단 메뉴바(네비게이션) 스타일
   - 불러오는 곳: includes/header.php → index.php를 뺀 모든 페이지
   - 메인(index.php)은 includes/header_index.php가 header_index.css를 대신 불러옴
   - 주의: header_index.css는 이 파일의 복사본 + 투명 메뉴 규칙이므로
     메뉴·서브메뉴·햄버거·모바일 메뉴·한/영 버튼을 고치면
     header_index.css도 똑같이 고쳐야 함
   - 769px 이상 = PC 메뉴, 768px 이하 = 햄버거(모바일) 메뉴
   - 동작(모바일 메뉴 열기/닫기, 한/영 전환)은 assets/js/header.js
   ================================================================= */

/* ── 글꼴: 롯데마트드림 (웹폰트, 보통/굵게/얇게) ── */
@font-face {
    font-family: 'LotteMartDream';
    src: url('//cdn.jsdelivr.net/korean-webfonts/1/corps/lottemart/LotteMartDream/LotteMartDreamMedium.woff2') format('woff2'),
        url('//cdn.jsdelivr.net/korean-webfonts/1/corps/lottemart/LotteMartDream/LotteMartDreamMedium.woff') format('woff');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'LotteMartDream';
    src: url('//cdn.jsdelivr.net/korean-webfonts/1/corps/lottemart/LotteMartDream/LotteMartDreamBold.woff2') format('woff2'),
        url('//cdn.jsdelivr.net/korean-webfonts/1/corps/lottemart/LotteMartDream/LotteMartDreamBold.woff') format('woff');
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: 'LotteMartDream';
    src: url('//cdn.jsdelivr.net/korean-webfonts/1/corps/lottemart/LotteMartDream/LotteMartDreamLight.woff2') format('woff2'),
        url('//cdn.jsdelivr.net/korean-webfonts/1/corps/lottemart/LotteMartDream/LotteMartDreamLight.woff') format('woff');
    font-weight: 300;
    font-display: swap;
}

body {
    font-family: 'LotteMartDream', sans-serif;
    margin: 0;
    padding: 0;
}

/* ── 네비게이션 공통 베이스 ── */
nav#navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    z-index: 1000;
}

/* ── [PC 브레이크포인트] 데스크톱 대메뉴 및 서브메뉴 스타일 ── */
@media (min-width: 769px) {
    nav#navbar .nav-links {
        margin-left: auto;
        display: flex;
        align-items: center;
        gap: 32px;
        list-style: none;
        padding: 0;
        margin: 0;
    }

    /* 각 대메뉴 리스트 아이템 컴포넌트 */
    nav#navbar .nav-links>li {
        position: relative;
        padding: 10px 0;
    }

    nav#navbar .nav-links>li>a,
    nav#navbar .nav-links>li>span {
        text-decoration: none;
        color: #333;
        font-weight: 500;
        font-size: 1rem;
        cursor: pointer;
        transition: color 0.2s;
    }

    nav#navbar .nav-links>li:hover>a,
    nav#navbar .nav-links>li:hover>span {
        color: #1a6fd4;
    }

    /* PC용 서브메뉴 컨테이너 초기값 */
    nav#navbar .nav-links .pc-sub-menu {
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        background: #ffffff;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        border-radius: 6px;
        padding: 0 16px;
        min-width: 130px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        z-index: 1010;
        border: 1px solid #eaeaea;

        /* 슬라이드 애니메이션 처리 */
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out, opacity 0.2s ease, padding 0.3s ease;
    }

    /* PC 호버 시 세련되게 낙하하며 오픈 */
    nav#navbar .nav-links>li:hover .pc-sub-menu {
        max-height: 250px;
        opacity: 1;
        padding: 12px 16px;
    }

    nav#navbar .pc-sub-menu a {
        text-decoration: none;
        color: #666;
        font-size: 0.9rem;
        font-weight: 400;
        padding: 8px 0;
        white-space: nowrap;
        transition: color 0.2s;
    }

    nav#navbar .pc-sub-menu a:hover {
        color: #1a6fd4;
    }

    /* PC 화면에서는 햄버거 버튼·모바일 메뉴를 항상 숨김 (창을 넓혔을 때 남지 않도록) */
    .hamburger,
    .mobile-menu {
        display: none !important;
    }
}

/* ── 한영 변환 버튼 공통 스타일 ── */
.nav-lang-btn {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1.5px solid #ccc;
    border-radius: 20px;
    overflow: hidden;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    cursor: pointer;
    background: transparent;
    margin-left: 16px;
    flex-shrink: 0;
}

.nav-lang-btn span {
    padding: 5px 12px;
    transition: background 0.2s, color 0.2s;
    color: #999;
}

.nav-lang-btn span.nav-lang-active {
    background: #1a6fd4;
    color: #fff;
}

/* ── 햄버거 버튼 스타일 (모바일 전용, .active가 붙으면 X 모양) ── */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    box-sizing: border-box;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2.5px;
    background-color: #111;
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ── 모바일 전체 메뉴 및 드롭다운 시스템 ──
   .mobile-menu.active = 메뉴 열림, .has-sub.open = 하위 메뉴 펼침 (header.js가 붙임) */
.mobile-menu {
    display: flex !important;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #ffffff;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    padding: 0 20px;
    box-sizing: border-box;
    flex-direction: column;
    z-index: 999;
    border-top: 1px solid #f5f5f5;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-in-out, opacity 0.25s ease-in-out, padding 0.35s ease-in-out;
}

.mobile-menu.active {
    max-height: 800px;
    opacity: 1;
    padding: 20px;
    overflow-y: auto;
}

.mobile-menu-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    border-bottom: 1px solid #fafafa;
}

.mobile-menu-item>a,
.mobile-menu-item>span {
    display: block;
    text-decoration: none;
    color: #333;
    font-size: 1.05rem;
    font-weight: 500;
    padding: 14px 0;
    cursor: pointer;
    position: relative;
}

.mobile-menu-item.has-sub>a::after,
.mobile-menu-item.has-sub>span::after {
    content: '▾';
    position: absolute;
    right: 4px;
    color: #aaa;
    transition: transform 0.2s ease;
}

.mobile-menu-item.has-sub.open>a::after,
.mobile-menu-item.has-sub.open>span::after {
    transform: rotate(180deg);
}

.mobile-menu .sub-menu {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #fcfcfc;
    padding-left: 12px;
    transition: max-height 0.3s ease-in-out, opacity 0.2s ease-in-out, padding 0.3s ease;
}

.mobile-menu-item.has-sub.open .sub-menu {
    max-height: 300px;
    opacity: 1;
    padding-top: 4px;
    padding-bottom: 12px;
}

.mobile-menu .sub-menu a {
    text-decoration: none;
    color: #666;
    font-size: 0.95rem;
    font-weight: 400;
    padding: 10px 0;
}

/* 모바일 메뉴 안의 한/영 버튼 */
.mobile-lang-btn {
    display: flex;
    justify-content: center;
    gap: 0;
    border: 1.5px solid #ccc;
    border-radius: 20px;
    overflow: hidden;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    margin-top: 20px;
    width: fit-content;
    align-self: center;
}

.mobile-lang-btn span {
    padding: 7px 20px;
    color: #999;
    transition: background 0.2s, color 0.2s;
}

.mobile-lang-btn span.nav-lang-active {
    background: #1a6fd4;
    color: #fff;
}

/* ── [모바일 브레이크포인트] 768px 이하 처리 ── */
@media (max-width: 768px) {
    nav#navbar .nav-links {
        display: none !important;
    }

    .hamburger {
        display: flex !important;
    }
}
