/* Header Styles */
/* 2025-01-18: EJS 서버사이드 렌더링용 스타일 추가 */

.site-header {
    position: relative;
    background: white;
}

.header-bg {
    background: white;
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 40px;
}

/* Utility Bar (상단) */
.utility-bar {
    text-align: right;
    padding: 8px 0;
}

.utility-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline-flex;
    gap: 20px;
    font-size: var(--font-sm);
}

.utility-menu li a {
    color: var(--text-tertiary);
    text-decoration: none;
    font-weight: 400;
}

.utility-menu li a:hover {
    color: var(--kjvr-primary);
}

.lang-toggle-item {
    display: flex;
    align-items: center;
}

.lang-toggle {
    display: flex;
    align-items: center;
    font-size: var(--font-sm);
}

.lang-toggle .divider {
    margin: 0 5px;
    color: #999;
}

/* Main Header (로고 + 메뉴 + 검색) */
/* 2025-01-23: 언어 변경 시 높이 변동 방지 - height 고정 */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    height: 80px;
}

.logo {
    margin: 0;
    flex-shrink: 0;
}

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

.logo img {
    display: block;
    width: auto;
}

/* Desktop Navigation */
.main-nav {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0;
}

.nav-list .nav-item > a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 150px;
    padding: 14px 10px 0 10px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-md);
    letter-spacing: 0.3px;
    transition: color 0.2s ease;
    position: relative;
    box-sizing: border-box;
}

.nav-list .nav-item > a:hover {
    color: var(--kjvr-primary);
}

/* Search Box */
.search-box {
    flex-shrink: 0;
    margin-top: 10px;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    overflow: hidden;
    width: 240px;
}

.search-input-wrap input {
    width: 196px;
    padding: 6px 12px;
    border: none;
    outline: none;
    font-size: var(--font-sm);
}

.search-input-wrap button {
    padding: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-right: 10px;
}

.search-input-wrap button svg {
    width: 20px;
    height: 20px;
    color: #374151;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--kjvr-primary);
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

/* Header Line (하단 컬러 바) */
.header-line {
    width: 100%;
    position: relative;
    z-index: 1;
}

/* 2025-01-25: 어드민 설정의 테마 색상 사용 */
.header-line .line-primary {
    background-color: var(--kjvr-primary, #8C0052);
    height: 2px;
}

.header-line .line-secondary {
    background-color: var(--kjvr-secondary, #F5D0E0);
    height: 1px;
}

/* Mega Menu */
.mega-menu {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 20px 0;
}

.mega-menu-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.mega-logo-space {
    width: 200px;
    flex-shrink: 0;
}

.mega-menu-content {
    display: flex;
    gap: 0;
    justify-content: center;
    flex-grow: 1;
}

.mega-menu-column {
    width: 150px;
    padding: 10px;
    box-sizing: border-box;
    text-align: center;
}

/* 2025-01-18: 메가 메뉴 컬럼 사이 수직 구분선 */
.mega-menu-column + .mega-menu-column {
    border-left: 1px solid #e5e5e5;
}

.mega-menu-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-block;
}

.mega-menu-column li {
    margin-bottom: 10px;
}

.mega-menu-column a {
    color: #666;
    text-decoration: none;
    font-size: var(--font-sm);
    text-align: left;
    display: block;
    transition: color 0.2s ease;
    position: relative;
}

.mega-menu-column a:hover {
    color: var(--kjvr-primary);
}

.mega-search-space {
    width: 240px;
    flex-shrink: 0;
}

/* Mobile Navigation */
.mobile-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #8F0050;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 999;
    max-height: 80vh;
    overflow-y: auto;
}

.mobile-nav.hidden {
    display: none;
}

.mobile-nav > a {
    display: block;
    padding: 14px 24px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-md);
}

.mobile-nav > a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.mobile-nav-divider {
    border-top: 1px solid rgba(255,255,255,0.2);
    margin: 10px 0;
}

.mobile-nav-group {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-md);
    cursor: pointer;
}

.mobile-nav-main:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.mobile-nav-main .expand-icon {
    font-size: var(--font-lg);
    transition: transform 0.3s;
}

.mobile-nav-main.expanded .expand-icon {
    transform: rotate(180deg);
}

.mobile-submenu {
    display: none;
    background: rgba(0,0,0,0.1);
}

.mobile-submenu.active {
    display: block;
}

.mobile-submenu a {
    display: block;
    padding: 10px 24px 10px 48px;
    color: white;
    text-decoration: none;
    font-size: var(--font-sm);
}

.mobile-submenu a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Responsive */
@media (max-width: 1023px) {
    .header-container {
        padding: 0 20px;
    }

    .main-nav,
    .search-box {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }
}

@media (max-width: 767px) {
    .utility-bar {
        display: none;
    }
}

/* Language toggle styles - fixed width to prevent flickering */
.lang-link {
    color: var(--text-tertiary);
    font-weight: 400 !important;
    display: inline-block;
    min-width: 50px;
    text-align: center;
}

.lang-link.active {
    color: #8C0052 !important;
}

/* Ensure dropdown icons are always visible */
.material-symbols-outlined {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-family: 'Material Symbols Outlined' !important;
    font-weight: normal !important;
    font-style: normal !important;
    font-size: var(--font-lg) !important;
    line-height: 1 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    white-space: nowrap !important;
    word-wrap: normal !important;
    direction: ltr !important;
    -webkit-font-smoothing: antialiased !important;
    text-rendering: optimizeLegibility !important;
    -moz-osx-font-smoothing: grayscale !important;
    font-feature-settings: 'liga' !important;
}

.dropdown-icon {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Hide desktop utility items on mobile */
@media (max-width: 767px) {
    .desktop-only-item {
        display: none !important;
    }
}

.container-desktop {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .container-desktop {
        padding: 0 40px;
    }
}

/* Navigation Styles */
.nav-item {
    position: relative;
}

.nav-item > a:hover {
    color: #8C0052;
}

/* Mega Menu Styles */
.mega-menu-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-top: 1px solid #f0f0f0;
    z-index: 1000;
}

/* Dropdown Menu (for mobile) */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 4px;
    min-width: 200px;
    padding: 8px 0;
    z-index: 1000;
    list-style: none;
    margin: 0;
}

/* Desktop only: hover to show dropdown */
@media (min-width: 768px) {
    .nav-item:hover .dropdown-menu:not(.active) {
        display: block;
    }
}

/* Mobile: click to show dropdown */
.dropdown-menu.active {
    display: block;
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
    font-size: var(--font-sm);
    transition: all 0.3s;
}

.dropdown-menu a:hover {
    background-color: #f5f5f5;
    color: #8C0052;
}

/* Mobile Menu Styles */
#mobileNav.mobile-menu-open {
    display: block !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #8F0050;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 999;
    max-height: 80vh;
    overflow-y: auto;
}

.mobile-nav-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav-item > a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Mobile submenu styles */
.mobile-submenu {
    display: none !important;
}

.mobile-submenu.active {
    display: block !important;
}

.mobile-submenu a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

@media (min-width: 1024px) {
    /* Hide mobile nav on desktop */
    #mobileNav {
        display: none !important;
    }
}

@media (max-width: 1023px) {
    /* Hide desktop nav on mobile/tablet */
    #desktopNav {
        display: none !important;
    }
    
    .nav-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-item > a {
        padding: 12px 20px !important;
    }
    
    /* Completely disable hover on mobile for desktop menu items */
    .nav-item:hover .dropdown-menu {
        display: none !important;
    }
    
    .dropdown-menu {
        position: static;
        display: none !important;
        background: rgba(0, 0, 0, 0.1);
        box-shadow: none;
        border-radius: 0;
        padding: 0;
    }
    
    .dropdown-menu a {
        color: white;
        padding-left: 40px;
    }
}

/* Search form override */
#searchForm input[type="text"] {
    border: none !important;
    outline: none !important;
    background: transparent;
}

#searchForm button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0 20px 0 8px;
}

/* Tailwind-like utility classes for header */
.bg-kjvr-dark { background-color: #8F0050; }
.border-kjvr-primary { border-color: #8C0052; }
.border-t-4 { border-top-width: 4px; }
.bg-kjvr-primary { background-color: #8C0052; }
.hover\\:bg-kjvr-dark:hover { background-color: #8F0050; }
.max-w-container { max-width: 1440px; box-sizing: border-box; }
.mx-auto { margin-left: auto; margin-right: auto; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.flex { display: flex; }
.hidden { display: none; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.relative { position: relative; }
.text-white { color: white; }
.rounded-2xl { border-radius: 1rem; }
.border { border-width: 1px; }
.border-gray-300 { border-color: #d1d5db; }
.overflow-hidden { overflow: hidden; }
.flex-1 { flex: 1; }
.outline-none { outline: none; }
.border-none { border: none; }
.text-gray-700 { color: #374151; }
.transition-colors { transition-property: background-color, border-color, color; }

@media (min-width: 768px) {
    .md\\:px-10 { padding-left: 2.5rem; padding-right: 2.5rem; }
    .md\\:h-auto { height: auto; }
}

@media (min-width: 1024px) {
    .lg\\:w-80 { width: 20rem; }
    .lg\\:block { display: block; }
    .lg\\:flex { display: flex; }
    .lg\\:hidden { display: none; }
}

.w-72 { width: 18rem; }
.h-12 { height: 3rem; }
.h-6 { height: 1.5rem; }
.w-6 { width: 1.5rem; }
.h-5 { height: 1.25rem; }
.w-5 { width: 1.25rem; }
.p-2 { padding: 0.5rem; }
.z-50 { z-index: 50; }
.gap-0 { gap: 0; }
.list-none { list-style: none; }
.m-0 { margin: 0; }
.p-0 { padding: 0; }
