/* 大型下拉菜单样式 - 阿里云风格 */

/* 主题色RGB变量（用于半透明背景） */
:root {
    --accent-color1-rgb: 13, 110, 253;
    --accent-color2-rgb: 111, 66, 193;
}

/* 导航栏基础样式 */
.navbar-moonglade {
    background: linear-gradient(135deg, var(--accent-color1) 0%, var(--accent-color2) 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 0;
}

.navbar-moonglade .container-xl {
    position: relative;
}

/* Logo样式 */
.moonglade-logo {
    font-size: 2rem;
    font-weight: 700;
    color: white !important;
    text-decoration: none;
    padding: 0.75rem 0;
    line-height: 1.2;
}

.moonglade-logo:hover {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* 导航菜单容器 */
.mega-menu-nav {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    position: relative;
    margin-left: 10px; /* PC端导航距离站点名称间隔10px */
}

/* 一级菜单项 */
.mega-menu-item {
    position: static;
}

.mega-menu-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 1rem 1.25rem;
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mega-menu-link:hover,
.mega-menu-item.active .mega-menu-link {
    color: white;
    background-color: rgba(255, 255, 255, 0.15);
    border-bottom-color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.mega-menu-link i {
    font-size: 1rem;
}

/* 下拉箭头 */
.mega-menu-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.mega-menu-item.active .mega-menu-arrow {
    transform: rotate(180deg);
}

/* 大型下拉面板 */
.mega-dropdown {
    position: fixed;
    top: auto;
    left: 0; /* 从左边缘开始 */
    transform: none; /* 移除居中变换 */
    width: 100vw; /* 等于浏览器宽度 */
    max-width: none; /* 移除最大宽度限制 */
    background: var(--accent-color2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border-top: 2px solid rgba(255, 255, 255, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0s linear 0.15s;
    z-index: 1000;
    max-height: 50vh;
    overflow-y: auto;
    pointer-events: none;
}

.mega-menu-item.active .mega-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.2s ease, visibility 0s linear 0s;
}

/* 下拉内容淡入效果 */
.mega-dropdown-inner {
    padding: 1.5rem 1rem;
    opacity: 0;
    transition: opacity 0.15s ease;
    max-width: 1320px; /* 内容区域最大宽度 */
    margin: 0 auto; /* 内容居中 */
}

.mega-menu-item.active .mega-dropdown-inner {
    opacity: 1;
    transition: opacity 0.2s ease 0.05s;
}

/* 滚动条样式 */
.mega-dropdown::-webkit-scrollbar {
    width: 8px;
}

.mega-dropdown::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.mega-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.mega-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.mega-dropdown-inner {
    padding: 1.5rem 1rem;
    max-width: 1320px; /* 内容区域最大宽度 */
    margin: 0 auto; /* 内容居中 */
}

/* 下拉内容网格布局 */
.mega-dropdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem 1rem;
}

/* 紧凑网格 - 用于文档和工具 */
.mega-dropdown-grid:has(.mega-dropdown-item-compact) {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.35rem 0.75rem;
}

/* 下拉项 */
.mega-dropdown-item {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #ffffff;
    text-decoration: none;
    border-radius: 0.25rem;
    transition: all 0.15s ease;
    background: transparent;
    font-size: 0.875rem;
}

.mega-dropdown-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
}

.mega-dropdown-item i {
    display: none;
}

.mega-dropdown-item-text {
    width: 100%;
}

.mega-dropdown-item-title {
    font-weight: 400;
    font-size: 0.875rem;
    margin-bottom: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.mega-dropdown-item-desc {
    display: none;
}

/* 紧凑样式 - 用于文档和工具 */
.mega-dropdown-item-compact {
    padding: 0.3rem 0.6rem;
}

.mega-dropdown-item-compact .mega-dropdown-item-title {
    font-size: 0.8rem;
}

/* 无图标样式 - 用于文档和工具 */
.mega-dropdown-item-no-icon {
    padding: 0.3rem 0.6rem;
}

.mega-dropdown-item-no-icon .mega-dropdown-item-title {
    font-size: 0.8rem;
    font-weight: 400;
}

/* 搜索栏样式 */
.mega-search-form {
    display: flex;
    align-items: center;
    margin-left: auto;
    padding: 0.5rem 0;
}

.mega-search-input {
    width: 200px;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 2rem 0 0 2rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.mega-search-input::placeholder {
    color: rgba(255, 255, 255, 0.85);
}

.mega-search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    width: 250px;
}

.mega-search-btn {
    padding: 0.5rem 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-left: none;
    border-radius: 0 2rem 2rem 0;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.mega-search-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 移动端样式 */
@media (max-width: 991.98px) {
    .navbar-moonglade {
        min-height: 52px;
    }
    
    .navbar-moonglade .container-xl {
        padding: 0;
        min-height: 52px;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
    }
    
    .moonglade-logo-heading {
        flex: 1;
    }
    
    .moonglade-logo {
        padding: 1rem 1rem;
        font-size: 1.6rem;
        display: inline-block;
    }
    
    .navbar-toggler {
        margin-right: 1rem;
        padding: 0.4rem 0.5rem;
        font-size: 0.9rem;
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.15rem rgba(255, 255, 255, 0.25);
    }
    
    .navbar-toggler-icon {
        width: 1.1em;
        height: 1.1em;
    }
    
    #blog-navbar-content {
        width: 100%;
        flex-basis: 100%;
    }
    
    #blog-navbar-content {
        background: linear-gradient(135deg, var(--accent-color1) 0%, var(--accent-color2) 100%);
        margin-top: 0;
    }
    
    .mega-menu-nav {
        flex-direction: column;
        width: 100%;
        margin-left: 0; /* 移动端移除左边距 */
    }
    
    .mega-menu-item {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mega-menu-link {
        width: 100%;
        justify-content: space-between;
        padding: 0.875rem 1rem;
    }
    
    .mega-dropdown {
        position: static;
        width: 100%;
        max-width: none;
        box-shadow: none;
        border-top: none;
        border-left: 3px solid rgba(255, 255, 255, 0.3);
        background: rgba(255, 255, 255, 0.05);
        transform: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease;
    }
    
    .mega-menu-item.active .mega-dropdown {
        transform: none;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .mega-dropdown-inner {
        padding: 1rem;
    }
    
    .mega-dropdown-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .mega-dropdown-group {
        margin-bottom: 1rem;
    }
    
    .mega-dropdown-group-title {
        font-size: 0.85rem;
        padding: 0 0.6rem;
        margin-bottom: 0.5rem;
    }
    
    .mega-dropdown-group-items {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    .mega-dropdown-item {
        padding: 0.625rem 0.875rem;
        font-size: 0.9rem;
    }
    
    .mega-dropdown-item-compact {
        padding: 0.5rem 0.75rem;
    }
    
    .mega-dropdown-item-no-icon {
        padding: 0.45rem 0.75rem;
    }
    
    .mega-dropdown-footer {
        margin-top: 1rem;
        padding-top: 1rem;
    }
    
    .mega-search-form {
        width: 100%;
        padding: 0.75rem 1rem;
        margin: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mega-search-input {
        flex: 1;
        width: auto;
    }
    
    .mega-search-input:focus {
        width: auto;
    }
}

/* 平板端优化 */
@media (max-width: 1199.98px) and (min-width: 992px) {
    .mega-menu-link {
        padding: 1rem 1rem;
        font-size: 0.9rem;
    }
    
    .mega-dropdown-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    
    .mega-search-input {
        width: 180px;
    }
    
    .mega-search-input:focus {
        width: 220px;
    }
}

/* 暗色主题适配 */
[data-bs-theme="dark"] .mega-dropdown {
    background: var(--accent-color2);
    border-top-color: rgba(255, 255, 255, 0.4);
}

[data-bs-theme="dark"] .mega-dropdown-item {
    color: #ffffff;
}

[data-bs-theme="dark"] .mega-dropdown-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.25);
}

/* 暗色主题下的一级菜单增强对比度 */
[data-bs-theme="dark"] .mega-menu-link {
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .mega-menu-link:hover,
[data-bs-theme="dark"] .mega-menu-item.active .mega-menu-link {
    background-color: rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* 加载动画 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 移除动画延迟，让内容立即显示 */
.mega-dropdown-item {
    animation: none;
}

/* 分类数量徽章 */
.mega-dropdown-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 0.75rem;
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 0.35rem;
    color: #ffffff;
}

.mega-dropdown-item:hover .mega-dropdown-badge {
    background: rgba(255, 255, 255, 0.4);
}

/* 分组标题 */
.mega-dropdown-group {
    margin-bottom: 1.25rem;
}

.mega-dropdown-group:last-child {
    margin-bottom: 0;
}

.mega-dropdown-group-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.6rem;
    padding: 0 0.6rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.mega-dropdown-group-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.25rem 0.5rem;
}

/* 空状态 */
.mega-dropdown-empty {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* 查看全部按钮 */
.mega-dropdown-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.mega-dropdown-view-all {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-color1) 0%, var(--accent-color2) 100%);
    color: white;
    text-decoration: none;
    border-radius: 2rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.mega-dropdown-view-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: white;
}

[data-bs-theme="dark"] .mega-dropdown-footer {
    border-top-color: #495057;
}

/* 暗色主题移动端优化 */
@media (max-width: 991.98px) {
    [data-bs-theme="dark"] .mega-dropdown {
        background: rgba(255, 255, 255, 0.05);
        border-left-color: rgba(255, 255, 255, 0.3);
    }
    
    [data-bs-theme="dark"] .mega-menu-item {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
}
