/* ===========================================
   Header & Navigation
   헤더, 네비게이션, 언어 선택기 스타일
   =========================================== */

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 메인 페이지에서만 투명 헤더 */
body:has(.main-slider) .header {
    background: rgba(255, 255, 255, 0);
    backdrop-filter: blur(0px);
    box-shadow: 0 0px 0px rgba(0, 0, 0, 0);
}

.header.scrolled {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
}

/* 메인 페이지에서 스크롤 시에도 투명 유지 */
body:has(.main-slider) .header.scrolled {
    background: rgba(255, 255, 255, 0) !important;
    backdrop-filter: blur(0px);
    box-shadow: 0 0px 0px rgba(0, 0, 0, 0);
}

.header:hover {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
}

/* 메인 페이지에서 호버 시 하얀 배경 */
body:has(.main-slider) .header:hover {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 더 강력한 선택자로 강제 적용 */
header#header.header.scrolled,
.header.scrolled,
header.header.scrolled,
#header.header.scrolled {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px) !important;
}

.header-container {
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#site-logo a {
    font-size: 24px;
    font-weight: bold;
    color: var(--theme-accent);
}

.logo-image {
    height: 36px;
    width: auto;
}

/* Language Selector Styles */
.language-selector {
    position: relative;
    z-index: 1001;
}

.language-dropdown {
    position: relative;
    display: inline-block;
}

.language-toggle {
    display: flex;
    height: 40px;
    padding: 10px 12px;
    background: none;
    border: 1px solid #E7E7E7;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: var(--Foundation-Grey-G100, #8C8C8C);
    font-family: "Noto Sans";
    font-size: 20px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    transition: all 0.3s ease;
}

.language-toggle:hover {
    border-color: var(--theme-accent);
    background: rgba(67, 97, 238, 0.05);
}

.language-toggle i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.language-dropdown.active .language-toggle i {
    transform: rotate(180deg);
}

.language-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    list-style: none;
    padding: 4px 0;
    margin: 4px 0 0 0;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.language-dropdown.active .language-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: block;
    padding: 8px 16px;
    color: var(--Foundation-Grey-G100, #8C8C8C);
    font-family: "Noto Sans";
    font-size: 20px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.language-option:hover {
    background: rgba(67, 97, 238, 0.05);
}

.language-option.active {
    background: rgba(67, 97, 238, 0.1);
    color: var(--theme-accent);
    font-weight: 500;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--theme-text);
    margin: 3px 0;
    transition: all 0.3s;
}

/* Navigation */
.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* 데스크탑에서는 모바일 메뉴 종료 버튼 숨기기 */
.main-nav .close-menu-btn {
    display: none;
}

/* 데스크탑에서는 모바일 언어 선택기 숨기기 */
.mobile-language-selector {
    display: none;
}

/* 모바일에서는 데스크탑 언어 선택기 숨기기 */
@media (max-width: 768px) {
    .language-selector {
        display: none !important;
    }
}

/* 모바일에서는 종료 버튼 표시 */
@media (max-width: 768px) {
    .main-nav .close-menu-btn {
        display: flex !important;
    }
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 40px;
}

/* 중간 화면: 메뉴 간격 및 글씨 축소 */
@media (max-width: 1400px) and (min-width: 1025px) {
    .nav-list {
        gap: 24px;
    }

    .menu-item > a {
        font-size: 14px;
    }

    .header-container {
        padding: 0 40px;
    }
}

/* 태블릿/작은 화면: 햄버거 메뉴로 전환 */
@media (max-width: 860px) {
    .main-nav {
        position: fixed;
        top: 0;
        right: -200px;
        width: 200px;
        height: 100vh;
        background: #fff;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
        z-index: 1002;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .main-nav.active {
        right: 0;
    }

    .nav-list {
        flex-direction: column;
        gap: 0;
        padding: 60px 20px 0 20px;
        flex-shrink: 0;
    }

    .menu-item {
        text-align: center;
        padding: 0;
    }

    /* 태블릿에서 언어 선택기 숨기기 */
    .language-selector {
        display: none !important;
    }

    /* 태블릿에서 모바일 언어 선택기 표시 */
    .mobile-language-selector {
        display: flex;
        justify-content: center;
        align-items: flex-start;
        padding: 15px 20px 150px 20px;
        margin-top: 15px;
        border-top: 1px solid #eee;
    }

    .mobile-language-dropdown {
        position: relative;
        width: 100%;
        max-width: 160px;
    }

    .mobile-language-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 12px 16px;
        background: #f5f5f5;
        border: 1px solid #ddd;
        border-radius: 8px;
        cursor: pointer;
        font-family: "Noto Sans KR";
        font-size: 14px;
        font-weight: 500;
        color: #333;
    }

    .mobile-dropdown-arrow {
        font-size: 10px;
        transition: transform 0.2s ease;
    }

    .mobile-language-dropdown.open .mobile-dropdown-arrow {
        transform: rotate(180deg);
    }

    .mobile-language-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        margin-top: 4px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        list-style: none;
        padding: 0;
        overflow: hidden;
        z-index: 100;
    }

    .mobile-language-dropdown.open .mobile-language-menu {
        display: block;
    }

    .mobile-language-menu li {
        border-bottom: 1px solid #eee;
    }

    .mobile-language-menu li:last-child {
        border-bottom: none;
    }

    .mobile-lang-option {
        display: block;
        padding: 12px 16px;
        color: #333;
        font-family: "Noto Sans KR";
        font-size: 14px;
        text-decoration: none;
    }

    .mobile-lang-option:hover {
        background: #f5f5f5;
    }

    .mobile-lang-option.active {
        color: #00358E;
        font-weight: 600;
        background: #f0f4ff;
    }

    .menu-item > a {
        display: block;
        padding: 15px 20px;
        font-size: 15px;
        text-align: center;
        border-bottom: 1px solid #eee;
    }

    .mobile-menu-toggle {
        display: flex !important;
        order: 3;
        margin-left: auto;
    }

    .main-nav .close-menu-btn {
        display: flex !important;
        position: absolute;
        top: 15px;
        right: 15px;
        width: 28px;
        height: 28px;
        padding: 0;
        background: transparent;
        border: none;
        cursor: pointer;
    }

    .main-nav .close-menu-btn svg {
        width: 24px;
        height: 24px;
    }

    /* 햄버거 메뉴 모드에서 언어선택기, 소셜링크 숨기기 */
    .language-selector,
    .social-links {
        display: none !important;
    }

    /* 서브메뉴 스타일 (태블릿/햄버거 메뉴 모드) */
    .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        background: #f9f9f9;
    }

    .menu-item.active .sub-menu {
        max-height: 500px;
    }

    .sub-menu li {
        border-bottom: 1px solid #eee;
    }

    .sub-menu li:last-child {
        border-bottom: none;
    }

    .sub-menu a {
        display: block;
        padding: 12px 20px 12px 40px;
        color: #333;
        font-size: 14px;
    }

    .sub-menu a:hover {
        background: #f0f0f0;
        color: #00358E;
    }
}

.menu-item {
    position: relative;
}

.menu-item > a {
    padding: 10px 0;
    color: var(--theme-text);
    text-transform: uppercase;
    font-size: 18px;
    color: #000;
    font-family: "Noto Sans KR";
    font-style: normal;
    font-weight: 400;
    line-height: normal;
}

.menu-item > a:hover {
    color: var(--theme-accent);
}

/* Sub Menu */
.sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: transparent;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    list-style: none;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
    z-index: 100;
}

.menu-item:hover .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sub-menu li {
    border-bottom: 1px solid var(--theme-border);
}

.sub-menu li:last-child {
    border-bottom: none;
}

.sub-menu a {
    display: block;
    padding: 12px 20px;
    color: var(--theme-text);
}

.sub-menu a:hover {
    background: var(--theme-light-gray);
    color: var(--theme-accent);
}

/* Social Links */
.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    font-size: 20px;
    color: var(--theme-text);
}

.social-links a:hover {
    color: var(--theme-accent);
}
