/* ================================================================
   Header Styles
   ================================================================ */

/* [Navigation Bar] */
#gnb {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 90px;
    background: transparent !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 60px;
    z-index: 1000;
}

.logo {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.logo img {
    height: 70px;
    width: auto;
    object-fit: contain;
}

.nav-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 40px;
    z-index: 1001;
    height: 100%;
    align-items: center;
}

/* [Nav Item & Dropdown] */
.nav-item-group {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-item {
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
    transition: 0.3s;
    text-decoration: none;
    padding: 10px 0;
}

/* [수정] 메뉴 활성화/호버 시 굵기 변경 (500 -> 700) */
.nav-item:hover,
.nav-item.active {
    color: #ff2c2c;
    font-weight: 700;
    text-shadow: none;
}

/* Dropdown Content */
.dropdown-content {
    display: none;
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(15px);
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    z-index: 1002;
    padding: 10px 0;
    flex-direction: column;
}

.nav-item-group:hover .dropdown-content {
    display: flex;
}

.dropdown-item {
    color: rgba(255, 255, 255, 0.7);
    padding: 12px 20px;
    text-decoration: none;
    display: block;
    font-size: 15px;
    white-space: nowrap;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
}

.dropdown-item:hover,
.dropdown-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ff2c2c;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.contact-btn {
    font-size: 17px;
    font-weight: 500;
    text-transform: uppercase;
    color: #fff;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 10px 24px;
    border-radius: 4px;
    transition: all 0.3s ease;
    z-index: 1002;
}

.contact-btn:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* [Mobile Menu] */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    cursor: pointer;
    z-index: 2000;
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #fff;
    transition: 0.3s;
    border-radius: 2px;
}

/* [Local Navigation (Left Sidebar)] */
#local-nav {
    position: fixed;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 30px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

#local-nav.visible {
    opacity: 1;
    pointer-events: auto;
}

.local-nav-item {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    padding-left: 24px;
}

.local-nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: 0.3s;
}

.local-nav-item:hover,
.local-nav-item.active {
    color: #ffffff;
    transform: translateX(5px);
}

.local-nav-item.active::before {
    background: #ffffff;
    box-shadow: 0 0 10px #ffffff;
}

/* ===== 테마 토글 스위치 스타일 ===== */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin-right: 15px;
}

.theme-switch #theme-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2196f3;
    -webkit-transition: 0.4s;
    transition: 0.4s;
    z-index: 0;
    overflow: hidden;
}

.theme-switch .sun-moon {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: yellow;
    -webkit-transition: 0.4s;
    transition: 0.4s;
}

.theme-switch #theme-input:checked + .slider {
    background-color: #1a1a2e;
}

.theme-switch #theme-input:focus + .slider {
    box-shadow: 0 0 1px #2196f3;
}

.theme-switch #theme-input:checked + .slider .sun-moon {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
    background-color: white;
    -webkit-animation: rotate-center 0.6s ease-in-out both;
    animation: rotate-center 0.6s ease-in-out both;
}

@keyframes rotate-center {
    0% { transform: translateX(26px) rotate(0); }
    100% { transform: translateX(26px) rotate(360deg); }
}

.theme-switch .moon-dot {
    opacity: 0;
    transition: 0.4s;
    fill: gray;
}

.theme-switch #theme-input:checked + .slider .sun-moon .moon-dot {
    opacity: 1;
}

.theme-switch .slider.round {
    border-radius: 34px;
}

.theme-switch .slider.round .sun-moon {
    border-radius: 50%;
}

.theme-switch #moon-dot-1 {
    left: 10px;
    top: 3px;
    position: absolute;
    width: 6px;
    height: 6px;
    z-index: 4;
}

.theme-switch #moon-dot-2 {
    left: 2px;
    top: 10px;
    position: absolute;
    width: 10px;
    height: 10px;
    z-index: 4;
}

.theme-switch #moon-dot-3 {
    left: 16px;
    top: 18px;
    position: absolute;
    width: 3px;
    height: 3px;
    z-index: 4;
}

.theme-switch #light-ray-1 {
    left: -8px;
    top: -8px;
    position: absolute;
    width: 43px;
    height: 43px;
    z-index: -1;
    fill: white;
    opacity: 10%;
}

.theme-switch #light-ray-2 {
    left: -50%;
    top: -50%;
    position: absolute;
    width: 55px;
    height: 55px;
    z-index: -1;
    fill: white;
    opacity: 10%;
}

.theme-switch #light-ray-3 {
    left: -18px;
    top: -18px;
    position: absolute;
    width: 60px;
    height: 60px;
    z-index: -1;
    fill: white;
    opacity: 10%;
}

.theme-switch .cloud-light {
    position: absolute;
    fill: #eee;
    animation-name: cloud-move;
    animation-duration: 6s;
    animation-iteration-count: infinite;
}

.theme-switch .cloud-dark {
    position: absolute;
    fill: #ccc;
    animation-name: cloud-move;
    animation-duration: 6s;
    animation-iteration-count: infinite;
    animation-delay: 1s;
}

.theme-switch #cloud-1 { left: 30px; top: 15px; width: 40px; }
.theme-switch #cloud-2 { left: 44px; top: 10px; width: 20px; }
.theme-switch #cloud-3 { left: 18px; top: 24px; width: 30px; }
.theme-switch #cloud-4 { left: 36px; top: 18px; width: 40px; }
.theme-switch #cloud-5 { left: 48px; top: 14px; width: 20px; }
.theme-switch #cloud-6 { left: 22px; top: 26px; width: 30px; }

@keyframes cloud-move {
    0% { transform: translateX(0px); }
    40% { transform: translateX(4px); }
    80% { transform: translateX(-4px); }
    100% { transform: translateX(0px); }
}

.theme-switch .stars {
    transform: translateY(-32px);
    opacity: 0;
    transition: 0.4s;
}

.theme-switch .star {
    fill: white;
    position: absolute;
    -webkit-transition: 0.4s;
    transition: 0.4s;
    animation-name: star-twinkle;
    animation-duration: 2s;
    animation-iteration-count: infinite;
}

.theme-switch #theme-input:checked + .slider .stars {
    -webkit-transform: translateY(0);
    -ms-transform: translateY(0);
    transform: translateY(0);
    opacity: 1;
}

.theme-switch #star-1 { width: 20px; top: 2px; left: 3px; animation-delay: 0.3s; }
.theme-switch #star-2 { width: 6px; top: 16px; left: 3px; }
.theme-switch #star-3 { width: 12px; top: 20px; left: 10px; animation-delay: 0.6s; }
.theme-switch #star-4 { width: 18px; top: 0px; left: 18px; animation-delay: 1.3s; }

@keyframes star-twinkle {
    0% { transform: scale(1); }
    40% { transform: scale(1.2); }
    80% { transform: scale(0.8); }
    100% { transform: scale(1); }
}

/* ===== Light Mode - Header ===== */
body.light-mode #gnb {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: none !important;
}

body.light-mode .nav-item,
body.light-mode .logo {
    color: #1a1a1a !important;
}

body.light-mode .logo img {
    filter: invert(1) !important;
}

/* [수정] 라이트 모드에서도 굵기 700 강제 적용 */
body.light-mode .nav-item:hover,
body.light-mode .nav-item.active {
    color: #ff2c2c !important;
    font-weight: 700 !important;
    text-shadow: none !important;
}

body.light-mode .contact-btn {
    border-color: #1a1a1a !important;
    color: #1a1a1a !important;
    background: rgba(0, 0, 0, 0.05) !important;
}

body.light-mode .contact-btn:hover {
    background: #1a1a1a !important;
    color: #fff !important;
}

body.light-mode .nav-center {
    background: transparent !important;
}

body.light-mode .mobile-menu-toggle span {
    background-color: #1a1a1a !important;
}

body.light-mode .local-nav-item {
    color: rgba(0, 0, 0, 0.4) !important;
}

body.light-mode .local-nav-item::before {
    background: rgba(0, 0, 0, 0.3) !important;
}

body.light-mode .local-nav-item:hover,
body.light-mode .local-nav-item.active {
    color: #ff2c2c !important;
}

body.light-mode .local-nav-item.active::before {
    background: #ff2c2c !important;
    box-shadow: 0 0 10px rgba(255, 44, 44, 0.5) !important;
}

/* ===== Light Mode - Mobile Menu ===== */
body.light-mode .nav-center.active {
    background: rgba(255, 255, 255, 0.98) !important;
}

/* 라이트모드 기본 메뉴 텍스트 - 우선순위 강화 */
body.light-mode .nav-center.active > .nav-item,
body.light-mode .nav-center.active .nav-item-group > .nav-item {
    color: #000000 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.15) !important;
    font-weight: 600 !important;
    text-shadow: none !important;
}

/* 라이트모드에서 모든 메뉴 링크 강제 검정색 - 최고 우선순위 */
body.light-mode .nav-center.active a.nav-item,
body.light-mode .nav-center.active .nav-item-group a.nav-item {
    color: #000000 !important;
    font-weight: 600 !important;
}

/* 라이트모드 호버/활성 상태 */
body.light-mode .nav-center.active > .nav-item:hover,
body.light-mode .nav-center.active > .nav-item.active,
body.light-mode .nav-center.active .nav-item-group > .nav-item:hover,
body.light-mode .nav-center.active .nav-item-group > .nav-item.active,
body.light-mode .nav-center.active a.nav-item:hover,
body.light-mode .nav-center.active a.nav-item.active {
    color: #ff2c2c !important;
    font-weight: 700 !important;
}

/* 라이트모드 드롭다운 */
body.light-mode .nav-center.active .dropdown-item {
    color: #000000 !important;
    font-weight: 500 !important;
}

body.light-mode .nav-center.active .dropdown-item:hover,
body.light-mode .nav-center.active .dropdown-item.active {
    background-color: rgba(0, 0, 0, 0.1) !important;
    color: #ff2c2c !important;
    font-weight: 600 !important;
}

/* ===== 강제 색상 적용 - 모든 메뉴 항목 ===== */
/* 다크모드에서 모든 메뉴 강제 흰색 (선택되지 않은 상태) */
body:not(.light-mode) .nav-center.active a.nav-item:not(.active) {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* 다크모드에서 선택된 메뉴 강제 빨간색 */
body:not(.light-mode) .nav-center.active a.nav-item.active {
    color: #ff2c2c !important;
    font-weight: 700 !important;
}

/* ===== Mobile Responsive - Header ===== */
@media (max-width: 600px) {
    #gnb {
        height: auto;
        padding: 0 16px;
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-center {
        position: static;
        transform: none;
        flex-direction: column;
        gap: 0;
        width: 100%;
        height: auto;
        align-items: flex-start;
    }

    .nav-item-group {
        flex-direction: column;
        width: 100%;
        align-items: flex-start;
    }

    .nav-item {
        font-size: 16px;
        padding: 12px 0;
        width: 100%;
        word-break: keep-all;
        white-space: normal;
        text-align: left;
    }
}

@media (max-width: 1024px) {
    #gnb {
        padding: 0 20px;
        height: 70px;
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
    }

    #gnb .mobile-menu-toggle {
        justify-self: start;
    }

    #gnb .logo {
        justify-self: center;
        grid-column: 2;
        grid-row: 1;
    }

    #gnb .nav-right {
        display: flex;
        justify-self: end;
    }

    #gnb .nav-right .contact-btn {
        font-size: 12px;
        padding: 6px 12px;
    }

    .logo img {
        height: 50px;
    }

    .nav-center {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .nav-center.active {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(5, 5, 5, 0.98);
        flex-direction: column;
        justify-content: flex-start; 
        align-items: center;
        gap: 0;
        z-index: 1999;
        padding: 130px 20px 60px 20px; 
        overflow-y: auto;
    }

    .nav-center.active .nav-item-group {
        display: contents !important;
    }

    .nav-center.active > .nav-item,
    .nav-center.active .nav-item-group > .nav-item {
        font-size: 28px;
        padding: 25px 0; 
        text-align: center;
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin: 0;
        color: rgba(255, 255, 255, 0.8) !important;
    }

    /* 라이트모드에서 기본 모바일 스타일 오버라이드 */
    body.light-mode .nav-center.active > .nav-item,
    body.light-mode .nav-center.active .nav-item-group > .nav-item {
        color: #000000 !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.15) !important;
    }

    .nav-center.active > .nav-item:last-child {
        border-bottom: none;
    }

    .nav-center.active .dropdown-content {
        display: flex;
        position: static;
        transform: none;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        margin-top: 10px;
    }

    .nav-center.active .dropdown-item {
        font-size: 20px;
        padding: 12px 0;
        color: rgba(255, 255, 255, 0.7) !important;
    }

    /* 라이트모드에서 드롭다운 스타일 오버라이드 */
    body.light-mode .nav-center.active .dropdown-item {
        color: #000000 !important;
    }

    /* 다크모드 기본 호버 상태 */
    .nav-center.active > .nav-item:hover,
    .nav-center.active .nav-item-group > .nav-item:hover,
    .nav-center.active .dropdown-item:hover {
        color: #ff2c2c !important;
    }

    /* 다크모드 선택된 메뉴 (.active) 상태 */
    .nav-center.active > .nav-item.active,
    .nav-center.active .nav-item-group > .nav-item.active {
        color: #ff2c2c !important;
        font-weight: 700 !important;
    }

    /* 다크모드에서 기본 모바일 스타일의 선택된 메뉴 오버라이드 */
    body:not(.light-mode) .nav-center.active > .nav-item.active,
    body:not(.light-mode) .nav-center.active .nav-item-group > .nav-item.active {
        color: #ff2c2c !important;
        font-weight: 700 !important;
    }

    #local-nav {
        display: none !important;
    }
}

.theme-switch {
    margin-right: 0 !important; 
    transform: scale(0.85); 
    transform-origin: right center;
}

/* ===== Auth Buttons ===== */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 16px;
}

.nav-auth-btn {
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
}
.nav-auth-btn--active { color: rgba(255, 255, 255, 1) !important; }
.nav-auth-btn:hover { color: rgba(255, 255, 255, 1); }

.nav-auth-sep {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.2);
}

body.light-mode .nav-auth-btn { color: rgba(0, 0, 0, 0.4); }
body.light-mode .nav-auth-btn:hover { color: rgba(0, 0, 0, 1); }
body.light-mode .nav-auth-sep { color: rgba(0, 0, 0, 0.2); }

/* 모바일에서 데스크탑 auth 숨김 */
@media (max-width: 1024px) {
    .nav-auth { display: none; }
}

/* 모바일 전용 auth - 기본 숨김 (nav-center 안에서만 표시) */
.nav-auth-mobile { display: none; }

.nav-auth-mobile-btn {
    font-size: 22px !important;
    color: rgba(255, 255, 255, 0.5) !important;
    font-weight: 500 !important;
}
.nav-auth-mobile-btn:hover { color: rgba(255, 255, 255, 1) !important; }

body.light-mode .nav-auth-mobile-btn { color: rgba(0, 0, 0, 0.4) !important; }
body.light-mode .nav-auth-mobile-btn:hover { color: rgba(0, 0, 0, 1) !important; }

@media (max-width: 1024px) {
    .nav-center.active .nav-auth-mobile {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: 0;
        margin-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    body.light-mode .nav-center.active .nav-auth-mobile {
        border-top-color: rgba(0, 0, 0, 0.1);
    }
    .nav-auth-mobile-btn {
        padding: 20px 0 !important;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    }
    body.light-mode .nav-auth-mobile-btn {
        border-bottom-color: rgba(0, 0, 0, 0.1) !important;
    }
    .nav-auth-mobile-btn:last-child {
        border-bottom: none !important;
    }
}