/* 메가메뉴 버튼 스타일 */
.more-menu-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /*  FOUC 방지: background-color transition 제거 */
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    will-change: background-color, box-shadow, transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.more-menu-btn:hover {
    background-color: rgba(255, 255, 255, 1);
}

/* 기존 menu-btn .dots span 스타일 오버라이드 */
.more-menu-btn .dots {
    display: grid !important;
    grid-template-columns: repeat(3, 4px) !important;
    grid-template-rows: repeat(3, 4px) !important;
    gap: 3px !important;
    width: 18px !important;
    height: 18px !important;
}

.more-menu-btn .dots span {
    display: none !important;
}

.more-menu-btn .dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #666;
    display: block !important;
}

/* 메가메뉴 드롭다운 */
.more-menu-dropdown {
    position: fixed;
    top: auto;
    right: auto;
    width: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    z-index: 1001;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translate3d(0, -10px, 0) scale(0.95);
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s ease;
    pointer-events: none;
    display: flex;
    will-change: opacity, transform, width;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.more-menu-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translate3d(0, 0, 0) scale(1);
    pointer-events: auto;
    position: fixed;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    overflow: visible;
    z-index: 99999 !important;
}

/* 언어 드롭다운 메뉴 */
.language-dropdown-menu {
    width: 200px;
    background: #fafafa;
    border-radius: 12px 0 0 12px;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    padding: 20px;
    display: none;
    flex-shrink: 0;
}

.language-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    /*  FOUC 방지: background-color transition 제거 */
    transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    color: #1a1a2e;
    border-radius: 6px;
    margin-bottom: 4px;
    position: relative;
    user-select: none;
}

.language-option:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.language-option.active {
    background-color: rgba(102, 126, 234, 0.1);
    color: #1E3A8A;
    font-weight: 500;
}

.language-option .fa-check {
    color: #1E3A8A;
    font-size: 12px;
}

/* 메가 메뉴 컨텐츠 */
.mega-menu-content {
    display: flex;
    flex: 1;
    padding: 20px;
    gap: 0;
    border-radius: 12px;
    position: relative;
    z-index: 1002;
}

.mega-menu-content.active {
    z-index: 10000;
    position: relative;
}

.more-menu-dropdown.active .mega-menu-content {
    z-index: 10000;
    position: relative;
}

.more-menu-dropdown.active .mega-submenu {
    z-index: 10001;
}

/* 메가메뉴 컬럼 */
.mega-menu-column {
    flex: 1;
    padding: 0 20px;
    border-right: 1px solid #f0f0f0;
}

.mega-menu-column:first-child {
    padding-left: 0;
}

.mega-menu-column:last-child {
    border-right: none;
    padding-right: 0;
}

.mega-menu-column.mega-menu-links {
    flex: 0 0 160px;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-left: none;
    border-right: none;
    padding-left: 20px;
    padding-right: 0;
    position: relative;
    z-index: 1;
}

/* 메가메뉴 섹션 타이틀 */
.mega-menu-section-title {
    font-size: 12px;
    font-weight: 500;
    color: #999;
    margin-bottom: 12px;
    letter-spacing: 0.3px;
}

/* 메가메뉴 아이템 */
.mega-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    /*  FOUC 방지: background-color transition 제거 */
    transition: none;
    text-decoration: none;
    color: inherit;
    margin-bottom: 2px;
}

.mega-menu-item:hover {
    background-color: #f8f9fa;
}

.mega-menu-item-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 16px;
    flex-shrink: 0;
}

.mega-menu-item-text {
    flex: 1;
    min-width: 0;
}

.mega-menu-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.mega-menu-item-desc {
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}

.mega-menu-arrow {
    color: #ccc;
    font-size: 12px;
    flex-shrink: 0;
    align-self: center;
}

.mega-menu-item:hover .mega-menu-arrow {
    color: #666;
}

/* 메가메뉴 링크 */
.mega-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    /*  FOUC 방지: background-color transition 제거 */
    transition: none;
    text-decoration: none;
    color: #1a1a2e;
    font-size: 14px;
    font-weight: 400;
}

.mega-menu-link:hover {
    background-color: #f8f9fa;
}

.mega-menu-link i {
    color: #888;
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.mega-menu-link.has-submenu {
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.mega-menu-link.has-submenu:hover,
.mega-menu-link.has-submenu.active {
    background-color: #f3f4f6;
}

.mega-menu-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 16px 0px;
}

/* 서브메뉴 */
.mega-submenu {
    position: absolute;
    right: 180px;
    top: 0;
    bottom: 0;
    width: 180px;
    background: white;
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    padding: 16px 20px;
    gap: 4px;
    z-index: 10001;
    box-sizing: border-box;
    border: none !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important;
    border-radius: 12px;
}

.mega-submenu.active {
    display: flex;
}

.mega-submenu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    /*  FOUC 방지: background-color transition 제거 */
    transition: none;
    text-decoration: none;
    color: #1a1a2e;
    font-size: 14px;
    font-weight: 400;
}

.mega-submenu-item:hover {
    background-color: #f8f9fa;
}

.mega-submenu-item i {
    color: #666;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.mega-submenu-item.language-option {
    justify-content: flex-start;
    flex-direction: row;
    text-decoration: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    gap: 4px;
}

.mega-submenu-item.language-option:hover {
    background-color: #f8f9fa;
    text-decoration: none !important;
    border: none !important;
}

.mega-submenu-item.language-option i.fa-check {
    color: #10b981;
    order: -1;
    margin-right: 10px;
}

/* 블러 효과 */
.mega-menu-content.blurred .mega-menu-column:not(.mega-menu-links) {
    filter: blur(2px);
    opacity: 0.4;
    pointer-events: none;
    transition: filter 0.25s ease, opacity 0.25s ease;
}

.mega-menu-content:not(.blurred) .mega-menu-column {
    filter: none;
    opacity: 1;
    pointer-events: auto;
    transition: filter 0.25s ease, opacity 0.25s ease;
}

.mega-menu-content.blurred .mega-menu-column.mega-menu-links {
    filter: none;
    opacity: 1;
    pointer-events: auto;
}

/* 접근성 */
.more-menu-btn:focus-visible {
    outline: none;
}

.language-option:focus-visible,
.mega-menu-item:focus-visible {
    outline: 2px solid #1E3A8A;
    outline-offset: 2px;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .more-menu-dropdown {
        width: 280px;
        right: 0;
        max-width: calc(100vw - 20px);
    }
    
    .more-menu-btn {
        width: 36px;
        height: 36px;
    }
    
    .more-menu-btn .dots {
        width: 16px;
        height: 16px;
        gap: 2px;
    }
    
    .more-menu-btn .dot {
        width: 3px;
        height: 3px;
    }
    
    .language-dropdown-menu {
        width: 180px;
        padding: 16px;
    }
    
    .mega-menu-content {
        flex-direction: column;
        padding: 16px;
        gap: 20px;
    }
    
    .mega-menu-column {
        padding: 0;
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
        padding-bottom: 16px;
    }
    
    .mega-menu-column:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .mega-menu-column.mega-menu-links {
        flex: none;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .mega-menu-link {
        flex: 0 0 calc(50% - 4px);
    }
    
    .mega-submenu {
        position: static;
        width: 100%;
        right: auto;
        top: auto;
        bottom: auto;
    }
}


/* 다크모드 스타일 */
body.dark-mode .more-menu-btn {
    background: #374151;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .more-menu-btn:hover {
    background-color: rgb(50, 51, 55);
}

body.dark-mode .more-menu-btn .dot,
body.dark-mode .more-menu-btn .dots .dot {
    background: #ffffff !important;
}

body.dark-mode .more-menu-dropdown {
    background: #1e293b;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .more-menu-dropdown.active {
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .language-dropdown-menu {
    background: rgb(42, 42, 45) !important;
    border-right-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .language-option {
    color: #ffffff;
}

body.dark-mode .language-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .language-option.active {
    background-color: rgba(102, 126, 234, 0.2);
    color: #667eea;
}

body.dark-mode .language-option .fa-check {
    color: #667eea;
}

body.dark-mode .mega-menu-content {
    background: rgb(42, 42, 45) !important;
}

body.dark-mode .mega-menu-column {
    border-right-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .mega-menu-section-title {
    color: #ffffff;
}

body.dark-mode .mega-menu-item {
    color: #ffffff;
}

body.dark-mode .mega-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .mega-menu-item-icon {
    color: #ffffff;
}

body.dark-mode .mega-menu-item-title {
    color: #ffffff;
}

body.dark-mode .mega-menu-item-desc {
    color: #ffffff;
}

body.dark-mode .mega-menu-arrow {
    color: #ffffff;
}

body.dark-mode .mega-menu-item:hover .mega-menu-arrow {
    color: #ffffff;
}

body.dark-mode .mega-menu-link {
    color: #ffffff;
}

body.dark-mode .mega-menu-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .mega-menu-link i {
    color: #ffffff;
}

body.dark-mode .mega-menu-link.has-submenu:hover,
body.dark-mode .mega-menu-link.has-submenu.active {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .mega-menu-divider {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .mega-submenu {
    background: rgb(42, 42, 45) !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .mega-submenu-item {
    color: #ffffff;
}

body.dark-mode .mega-submenu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .mega-submenu-item i {
    color: #ffffff;
}

body.dark-mode .mega-submenu-item.language-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 모바일 반응형 다크모드 */
@media (max-width: 768px) {
    body.dark-mode .mega-menu-column {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
}
