/* 导航和公告栏综合组件样式 */
/* 包含顶部公告栏和 Mega Menu 导航功能 */

/* CSS变量定义 */
:root {
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --primary-color: #6366f1;
    --accent-color: #8b5cf6;
    --text-primary: #1a1a1a;
    --text-secondary: #6c757d;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-text: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ============================================
   顶部公告栏样式（header-announcement.css）
   ============================================ */
/* Top Bar */
.header-announcement {
    background: linear-gradient(135deg, #8B5CF6 0%, #FFB6C1 100%); /* Gradient background */
    color: #fff;
    padding: 10px 0;
    font-size: 14px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1060;
    transition: transform 0.3s ease;
}

/* Announcement Slider */
.top-announcement-slider {
    height: 24px; /* Fixed height */
    overflow: hidden;
    position: relative;
    text-align: center;
}

/* Announcement Item */
.top-announcement-item {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Active Announcement Item */
.top-announcement-item.active {
    opacity: 1;
    transform: translateY(0);
}

/* Close Button */
.top-announcement-close-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 0 10px;
    cursor: pointer;
    transition: color 0.3s ease;
    font-size: 16px;
    line-height: 1;
    z-index: 10;
}

.top-announcement-close-btn:hover {
    color: #fff;
}

/* Body class when top bar is closed */
body.header-announcement-closed {
    padding-top: 0;
}

/* ============================================
   顶部公告栏样式（nav-megamenu-reference.css）
   ============================================ */
.top-bar-reference {
    background: var(--gradient-primary);
    color: #fff;
    padding: 10px 0;
    font-size: 14px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1060;
    transition: transform 0.3s ease;
}

.announcement-slider-reference {
    height: 24px;
    overflow: hidden;
    position: relative;
    text-align: center;
}

.announcement-item-reference {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.5s ease;
}

.announcement-item-reference.active {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   导航栏样式
   ============================================ */
.navbar {
    background-color: var(--navbar-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 0;
    transition: all 0.3s ease;
    margin-top: 40px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    height: 80px;
}

.navbar.scrolled {
    background-color: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 30px rgba(0,0,0,0.1);
    height: 70px;
}

/* 当顶部公告栏关闭时，导航栏上移到顶部 */
body.header-announcement-closed .navbar,
body.top-bar-closed .navbar {
    margin-top: 0;
}

/* 当顶部公告栏隐藏时，移除空白区域 */
body.header-announcement-closed .header-announcement {
    display: none;
}

.navbar-brand {
    padding: 0;
    display: flex;
    align-items: center;
    height: 100%;
}

.navbar-brand img {
    height: 70px;
    width: auto;
    transition: all 0.3s ease;
}

.navbar.scrolled .navbar-brand img {
    height: 60px;
}

.navbar-brand span {
    color: var(--primary-color) !important;
}

.navbar-nav {
    height: 100%;
}

.navbar-nav .nav-item {
    height: 100%;
    display: flex;
    align-items: center;
}

.navbar-nav .nav-link {
    color: #6633FF !important;
    font-weight: 600;
    padding: 0 12px !important;
    position: relative;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 5px;
    height: 100%;
    white-space: nowrap;
}

.navbar-nav .nav-link::after {
    display: none;
}

.navbar-nav .dropdown-toggle::after {
    display: inline-block;
    margin-left: 0.255em;
    vertical-align: 0.255em;
    content: "";
    border-top: 0.3em solid;
    border-right: 0.3em solid transparent;
    border-bottom: 0;
    border-left: 0.3em solid transparent;
    color: #6633FF;
    border-top-color: #6633FF;
    transition: all 0.3s ease;
}

/* hover 时主菜单文字变成粉色 */
.navbar-nav .nav-link:hover {
    color: #FF69B4 !important;
}

/* 子菜单打开时，主菜单保持原色（优先级高于 hover） */
.navbar-nav .dropdown.show .nav-link,
.navbar-nav .dropdown.show .dropdown-toggle,
.navbar-nav .dropdown.show .nav-link:hover,
.navbar-nav .dropdown.show .dropdown-toggle:hover {
    color: #6633FF !important;
}

/* hover 时小三角也变成粉色 */
.navbar-nav .dropdown:hover .dropdown-toggle::after {
    transform: rotate(180deg);
    color: #FF69B4 !important;
    border-top-color: #FF69B4 !important;
}

/* 子菜单打开时，小三角保持原色（优先级高于 hover） */
.navbar-nav .dropdown.show .dropdown-toggle::after,
.navbar-nav .dropdown.show:hover .dropdown-toggle::after {
    color: #6633FF !important;
    border-top-color: #6633FF !important;
}

/* ============================================
   Mega Menu 样式
   ============================================ */
.navbar .dropdown-menu.megamenu {
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.megamenu-links {
    padding: 10px 15px;
    background: transparent;
}

.megamenu-links h5 {
    display: none;
}

/* Mega Menu 内容样式 */
.megamenu-image {
    background-size: cover;
    background-position: center;
    position: relative;
    min-height: 400px;
}

.megamenu-image-with-video {
    position: relative;
    overflow: hidden;
}

.megamenu-video-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%) translateZ(0);
    z-index: 0;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease;
    will-change: opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.megamenu-video-bg.loaded {
    opacity: 1;
    filter: contrast(1.05) brightness(1.02);
}

.megamenu-image-with-video.video-loaded::after {
    opacity: 0.15;
}

.megamenu-image-with-video.video-loaded .megamenu-image-content {
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(255, 182, 193, 0.3) 100%);
}

.megamenu-image-content {
    position: relative;
    z-index: 2;
    padding: 40px;
    color: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.4) 0%, rgba(255, 182, 193, 0.4) 100%);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-radius: 0;
}

.megamenu-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0.25;
    mix-blend-mode: multiply;
    z-index: 1;
    pointer-events: none;
}

.megamenu-image-content h4 {
    font-weight: 700;
    margin-bottom: 15px;
}

.megamenu-links {
    padding: 40px;
    background-color: #f8f9fa;
}

.megamenu-links h5 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 20px;
    padding-left: 20px;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.menu-link:hover,
.menu-link.active {
    background-color: rgba(99, 102, 241, 0.08);
    color: var(--primary-color);
    padding-left: 25px;
}

.menu-link i {
    font-size: 12px;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s ease;
}

.menu-link:hover i,
.menu-link.active i {
    opacity: 1;
    transform: translateX(0);
}

.megamenu-details {
    padding: 40px;
    background: #fff;
}

.menu-desc {
    display: none;
    animation: fadeIn 0.3s ease;
}

.menu-desc.active {
    display: block;
}

.menu-desc h4 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 15px;
}

.menu-desc p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.menu-desc .btn-link {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.menu-desc .btn-link:hover {
    color: var(--accent-color);
}

/* 语言切换下拉菜单 */
.language-dropdown {
    display: flex;
    align-items: center;
    position: relative;
}

.language-dropdown .nav-link {
    display: flex !important;
    align-items: center !important;
    padding: 0 !important;
    height: auto !important;
    cursor: pointer;
    position: relative;
}

.language-dropdown .nav-link img {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    object-fit: cover;
    display: block;
}

.language-dropdown .dropdown-menu {
    min-width: 150px;
    display: none;
    visibility: visible;
    opacity: 1;
    transition: all 0.2s ease;
    position: absolute;
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
    transform: translateX(0);
    z-index: 1050;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    margin-top: 0 !important;
}

.language-dropdown.show .dropdown-menu,
.language-dropdown .dropdown-menu.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.language-dropdown .dropdown-item {
    transition: background-color 0.2s ease;
}

.language-dropdown .dropdown-item img {
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    object-fit: cover;
}

.language-dropdown .dropdown-item:hover {
    background-color: #f8f9fa;
}

.language-dropdown .dropdown-item.active {
    background-color: rgba(99, 102, 241, 0.1);
}

/* ============================================
   标准下拉菜单样式（用于AI资讯等简单下拉菜单）
   ============================================ */
.navbar-nav .dropdown-menu:not(.megamenu) {
    min-width: 180px;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    animation: fadeIn 0.3s ease;
}

.navbar-nav .dropdown-item {
    padding: 0.5rem 1.25rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.navbar-nav .dropdown-item:hover,
.navbar-nav .dropdown-item:focus {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--accent-color);
}

.navbar-nav .dropdown-item.active {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--accent-color);
}

/* ============================================
   桌面端 Mega Menu
   ============================================ */
@media (min-width: 1200px) {
    .navbar .dropdown-menu.megamenu {
        width: 100%;
        margin-top: 0;
        border: none;
        border-radius: 0 0 10px 10px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.1);
        padding: 0;
        background: #fff;
        overflow: hidden;
        animation: fadeIn 0.3s ease;
        left: 50%;
        transform: translateX(-50%);
        min-height: 400px;
        top: 100%;
        border-top: 1px solid rgba(0,0,0,0.05);
        position: absolute;
        display: block;
        visibility: hidden;
        opacity: 0;
        transition: all 0.2s ease;
    }

    .navbar-nav .dropdown {
        position: static;
    }
    
    .navbar .dropdown-menu.megamenu {
        width: 1140px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
    
    .navbar .dropdown:hover .dropdown-menu.megamenu {
        visibility: visible;
        opacity: 1;
        transform: translateX(-50%);
    }

    .megamenu-links {
        padding: 40px;
        background-color: #f8f9fa;
    }

    .megamenu-links h5 {
        display: block;
    }
}

@media (min-width: 1400px) {
    .navbar .dropdown-menu.megamenu {
        width: 1320px;
    }
}

/* ============================================
   响应式设计
   ============================================ */
/* 顶部公告栏响应式设计 */
@media (max-width: 768px) {
    .header-announcement {
        height: auto;
        padding: 8px 0;
    }
    
    .top-announcement-slider {
        height: auto;
        min-height: 24px;
    }
    
    .top-announcement-item {
        position: relative; /* Change from absolute to relative for mobile auto-height */
        height: auto;
        padding: 0 30px; /* Space for close button */
        line-height: 1.4;
        display: none; /* Hide all by default */
    }
    
    .top-announcement-item.active {
        display: block; /* Show active one */
        transform: none;
        opacity: 1;
    }
}

/* 移动端样式 */
@media (max-width: 1199.98px) {
    .top-bar-reference {
        height: auto;
        padding: 8px 0;
    }
    
    .announcement-slider-reference {
        height: auto;
        min-height: 24px;
    }
    
    .announcement-item-reference {
        position: relative;
        height: auto;
        padding: 0 30px;
        line-height: 1.4;
        display: none;
    }
    
    .announcement-item-reference.active {
        display: block;
        transform: none;
        opacity: 1;
    }

    .navbar-collapse {
        background: #fff;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        padding: 20px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        border-top: 1px solid rgba(0,0,0,0.05);
        max-height: 80vh;
        overflow-y: auto;
    }

    .navbar-nav .nav-link {
        padding: 12px 0 !important;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        justify-content: space-between;
        display: flex;
        width: 100%;
        font-size: 18px !important;
        color: #6633FF !important;
    }

    .navbar-nav .dropdown-menu,
    .navbar .dropdown-menu.megamenu {
        position: static !important;
        float: none !important;
        transform: none !important;
        inset: auto !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        padding: 5px 0 5px 20px !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
        display: none;
        opacity: 1 !important;
        visibility: visible !important;
        animation: none !important;
    }

    .navbar-nav .dropdown-menu.show,
    .navbar .dropdown-menu.megamenu.show {
        display: block !important;
    }

    .menu-link {
        padding: 10px 0;
        border-bottom: 1px solid rgba(0,0,0,0.03);
        display: flex;
        align-items: center;
        color: var(--text-secondary);
    }
    
    .menu-link:hover, .menu-link.active {
        background: transparent;
        padding-left: 5px;
        color: var(--accent-color);
    }

    .megamenu-links {
        padding: 0;
        background: transparent;
    }

    /* 移动端语言下拉菜单样式 */
    .language-dropdown {
        margin-top: 10px;
        margin-bottom: 10px;
        border-left: none !important;
        padding-left: 0 !important;
    }

    .language-dropdown .dropdown-menu {
        position: static !important;
        display: none !important;
        margin-top: 5px !important;
        width: 100% !important;
        right: auto !important;
        left: auto !important;
    }

    .language-dropdown.show .dropdown-menu,
    .language-dropdown .dropdown-menu.show {
        display: block !important;
    }
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
