/**
 * 菜单浮窗样式
 * 响应式设计，支持桌面端和移动端
 */

/* 浮窗容器 */
.menu-dropdown-container {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    /*transform: translateY(-10px);*/
    /*transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);*/
    pointer-events: none;
}

.menu-dropdown-container.show {
    opacity: 1;
    visibility: visible;
    /*transform: translateY(0);*/
    pointer-events: auto;
}

/* 浮窗内容 */
.menu-dropdown-content {
    background: #ffffff;
    border-radius: 12px;
    /*box-shadow: 0 20px 40px rgb(255, 255, 255);*/
    border: 1px solid rgba(0, 0, 0, 0.91);
    min-width: 800px;
    max-width: 1200px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 32px;
}

/* 加载状态 */
.dropdown-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4ecca3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 两列布局容器 */
.dropdown-two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    min-height: 400px;
}

/* 分类容器 */
.dropdown-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
}

/* 单个分类 */
.dropdown-category {
    position: relative;
    display: flex;
    flex-direction: column;
}

.dropdown-category.left-column {
    border-right: 1px solid #eee;
    padding-right: 20px;
}

.dropdown-category.right-column {
    padding-left: 20px;
}

.category-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #4ecca3;
    position: relative;
}

.category-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 30px;
    height: 2px;
    background: #4ecca3;
}

/* 分类项目容器 */
.category-items {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 400px;
}

/* 分类项目 */
.category-item,
.view-more-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    overflow: hidden;
    margin-bottom: 2px;
}

/* 层级缩进 */
.category-item.level-1 {
    padding-left: 16px;
    font-weight: 600;
    color: #4ecca3;
    font-size: 15px;
}

.category-item.level-2 {
    padding-left: 26px;
    font-weight: 500;
    color: #666;
}

.category-item.level-3 {
    padding-left: 26px;
    color: #666;
}

.category-item.level-4 {
    padding-left: 26px;
    color: #666;
    font-size: 13px;
}

/* 可点击项目的悬浮效果 */
.category-item.clickable:hover {
    cursor: pointer;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #ffffff;
    transform: translateX(4px);
}

/* 不可点击项目的样式 */
.category-item.non-clickable {
    cursor: default;
    background: transparent;
}

.category-item.non-clickable:hover {
    /*background: #f8f9fa;*/
    transform: none;
}

.view-more-item:hover {
    background: linear-gradient(135deg, #4ecca3 0%, #44b89d 100%);
    color: #ffffff;
    transform: translateX(4px);
}

.category-item.leaf-item:hover {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

/* 项目名称 */
.item-name {
    flex: 1;
    font-weight: 500;
}

/* 子项目容器 */
.sub-items {
    margin-left: 0;
    margin-top: 2px;
    margin-bottom: 4px;
}

.sub-items.level-2 {
    /*border-left: 2px solid #e9ecef;*/
    margin-left: 8px;
}

.sub-items.level-3 {
    /*border-left: 2px solid #dee2e6;*/
    margin-left: 16px;
}

.sub-items.level-4 {
    /*border-left: 1px solid #dee2e6;*/
    margin-left: 24px;
}

/* 新闻菜单专用样式 */
.dropdown-news-content {
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

/* 新闻菜单浮窗宽度调整 */
.menu-dropdown-content.news-menu {
    min-width: 400px;
    max-width: 500px;
}

.dropdown-news-content .dropdown-category {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.dropdown-news-content .category-items {
    max-height: 200px;
    overflow-y: auto;
}

.category-item.news-item {
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    background: #f8f9fa;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.category-item.news-item:hover {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #ffffff;
    border-left-color: #ffffff;
    transform: translateX(4px);
}

/* About Us菜单专用样式 */
.dropdown-aboutus-content {
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

/* About Us菜单浮窗宽度调整 */
.menu-dropdown-content.aboutus-menu {
    min-width: 350px;
    max-width: 450px;
}

.dropdown-aboutus-content .dropdown-category {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.dropdown-aboutus-content .category-items {
    max-height: 250px;
    overflow-y: auto;
}

.category-item.aboutus-item {
    padding: 14px 18px;
    margin-bottom: 6px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    background: #f8f9fa;
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.category-item.aboutus-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    /*background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%);*/
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-item.aboutus-item:hover {
    /*background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%);*/
    /*color: #ffffff;*/
    /*transform: translateX(6px);*/
    /*box-shadow: 0 4px 12px rgba(111, 66, 193, 0.3);*/
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #ffffff;
    border-left-color: #ffffff;
    transform: translateX(4px);
}

.category-item.aboutus-item:hover::before {
    opacity: 1;
}

/* 箭头图标 - 仅用于查看更多按钮 */
.arrow-icon {
    font-size: 12px;
    opacity: 0.7;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.view-more-item:hover .arrow-icon {
    opacity: 1;
    transform: translateX(2px);
}

/* 查看更多项目 */
.view-more-item {
    margin-top: 8px;
    border-top: 1px solid #eee;
    padding-top: 12px;
    font-weight: 600;
    color: #4ecca3;
}

.view-more-item:hover {
    background: linear-gradient(135deg, #4ecca3 0%, #44b89d 100%);
    color: #ffffff;
}

/* 父级项目样式 */
.parent-item {
    font-weight: 500;
}

.parent-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #4ecca3;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.parent-item:hover::before {
    opacity: 1;
}

/* 叶子项目样式 */
.leaf-item {
    position: relative;
}

.leaf-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #007bff;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.leaf-item:hover::before {
    opacity: 1;
}

/* 滚动条样式 */
.menu-dropdown-content::-webkit-scrollbar {
    width: 6px;
}

.menu-dropdown-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.menu-dropdown-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.menu-dropdown-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .menu-dropdown-content {
        min-width: 600px;
        max-width: 800px;
        padding: 24px;
    }

    /* 平板端单列菜单宽度调整 */
    .menu-dropdown-content.news-menu {
        min-width: 350px;
        max-width: 450px;
    }

    .menu-dropdown-content.aboutus-menu {
        min-width: 300px;
        max-width: 400px;
    }

    .dropdown-two-columns {
        gap: 30px;
    }

    .dropdown-categories {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 24px;
    }
}

/* 移动端和小屏幕设备完全隐藏菜单浮窗 */
@media (max-width: 768px),
       (max-device-width: 768px),
       (orientation: portrait) and (max-width: 1024px),
       (pointer: coarse) {
    .menu-dropdown-container {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

@media (max-width: 768px) {

    /* 以下样式保留用于调试，但实际不会显示 */
    .menu-dropdown-content {
        min-width: 320px;
        max-width: 90vw;
        padding: 16px;
        max-height: 70vh;
    }

    .dropdown-two-columns {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .dropdown-category.left-column {
        border-right: none;
        border-bottom: 1px solid #eee;
        padding-right: 0;
        padding-bottom: 20px;
    }

    .dropdown-category.right-column {
        padding-left: 0;
        padding-top: 20px;
    }

    .dropdown-categories {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .category-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .category-item,
    .view-more-item {
        padding: 12px;
        font-size: 15px;
    }

    .category-items {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .menu-dropdown-content {
        min-width: 280px;
        padding: 12px;
        border-radius: 8px;
    }

    .category-title {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .category-item,
    .view-more-item {
        padding: 10px;
        font-size: 14px;
    }

    .dropdown-categories {
        gap: 16px;
    }
}

/* 深色主题支持 */
@media (prefers-color-scheme: dark) {
    .menu-dropdown-content {
        background: #ffffff;
        border-color: rgb(255, 255, 255);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    }

    .category-title {
        color: #000000;
    }

    .category-item,
    .view-more-item {
        /*color: #e0e0e0;*/
    }

    .category-item:hover,
    .view-more-item:hover {
        /*color: #ffffff;*/
    }

    .view-more-item {
        border-top-color: #444;
    }

    .dropdown-loading {
        color: #ccc;
    }
}

/* 动画增强 */
.category-item {
    position: relative;
    overflow: hidden;
}

.category-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.category-item:hover::after {
    left: 100%;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .menu-dropdown-content {
        border: 2px solid #000;
    }

    .category-item,
    .view-more-item {
        border: 1px solid #ccc;
        margin-bottom: 2px;
    }

    .category-item:hover,
    .view-more-item:hover {
        border-color: #000;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .menu-dropdown-container,
    .category-item,
    .view-more-item,
    .arrow-icon,
    .loading-spinner {
        transition: none;
        animation: none;
    }

    .category-item:hover,
    .view-more-item:hover {
        transform: none;
    }
}

/* 浏览器兼容性优化 */
.menu-dropdown-content {
    /* 确保在所有浏览器中正确显示 */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

/* 确保层级显示在所有浏览器中一致 */
.category-item {
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
}

/* 修复某些浏览器中的文字选择问题 */
.category-item.non-clickable {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 确保可点击项目的指针样式 */
.category-item.clickable {
    cursor: pointer;
}

.category-item.clickable:hover {
    cursor: pointer;
}

/* 修复IE11兼容性问题 */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .dropdown-two-columns {
        display: -ms-grid;
        -ms-grid-columns: 1fr 1fr;
        -ms-grid-column-gap: 40px;
    }

    .dropdown-category:nth-child(1) {
        -ms-grid-column: 1;
    }

    .dropdown-category:nth-child(2) {
        -ms-grid-column: 2;
    }
}
