/**
 * base.html 抽离：全局 reset、导航栏、主内容区（阶段 E）
 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --global-scrollbar-track: rgba(0, 0, 0, 0.06);
    --global-scrollbar-thumb: rgba(255, 255, 255, 0.92);
    --global-scrollbar-thumb-hover: rgba(255, 255, 255, 0.98);
    --global-scrollbar-border: rgba(0, 0, 0, 0.08);
}

html,
body {
    scrollbar-width: thin;
    scrollbar-color: var(--global-scrollbar-thumb) var(--global-scrollbar-track);
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
    background: var(--global-scrollbar-track);
    border-radius: 999px;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
    background: var(--global-scrollbar-thumb);
    border: 1px solid var(--global-scrollbar-border);
    border-radius: 999px;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
    background: var(--global-scrollbar-thumb-hover);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Microsoft YaHei', sans-serif;
    background: #f0f2f5;
    color: #333;
}

/* 全局导航栏：高于实验室工具栏(10005)，避免运维管理等下拉被文件栏挡住 */
.global-nav {
    background: #713eff;
    color: white;
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 10100;
}

.global-nav,
.global-nav * {
    user-select: none;
    -webkit-user-select: none;
}

.nav-logo {
    font-size: 20px;
    font-weight: 600;
    margin-right: 40px;
    color: white;
    text-decoration: none;
    position: relative;
}

/* Logo Tooltip样式 */
.nav-logo::before {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: white;
    color: #333;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    margin-top: 8px;
}

.nav-logo::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid white;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1001;
}

.nav-logo:hover::before,
.nav-logo:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.nav-menu {
    display: flex;
    gap: 8px;
    flex: 1;
}

.nav-item {
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s;
    font-size: 14px;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-item.active {
    background: #1890ff;
    color: white;
}

/* 导航项Tooltip样式 */
.nav-item::before {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: white;
    color: #333;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    margin-top: 8px;
}

.nav-item::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid white;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1001;
}

.nav-item:hover::before,
.nav-item:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 导航下拉分组容器 */
.nav-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

/* 下拉触发器：复用 nav-item 样式，但禁用 tooltip */
.nav-dropdown-trigger::before,
.nav-dropdown-trigger::after {
    display: none !important;
}

/* 下拉菜单（不可见态）：与 global-nav 同层级，高于实验室 toolbar(10005) */
.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    padding-top: 6px; /* 不可见悬停桥，防止鼠标从触发器移到菜单时断开 hover */
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 10101;
}

/* 下拉菜单（悬停展开） */
.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 下拉菜单视觉容器 */
.nav-dropdown-menu-inner {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border: 1px solid #e8e0f0;
    padding: 6px 0;
    min-width: 140px;
}

/* 下拉菜单项 */
.nav-dropdown-item {
    display: block;
    padding: 9px 20px;
    color: #595959;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.nav-dropdown-item:hover {
    background: #f5f0ff;
    color: #713eff;
}

.nav-dropdown-item.active {
    color: #713eff;
    font-weight: 600;
    background: #f5f0ff;
}

.nav-user {
    margin-left: auto;
    color: rgba(255, 255, 255, 0.65);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 2px;
    height: 100%;
}

/* 设置按钮（顶部导航） */
.nav-settings-btn {
    opacity: 0.85;
    transition: all 0.2s;
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    white-space: nowrap;
}
.nav-settings-btn:hover {
    opacity: 1;
    background: rgba(255,255,255,0.12);
}
.nav-settings-btn.active {
    opacity: 1;
    background: rgba(255,255,255,0.18);
}

/* 全局导航响应式 L1：切成上下两层，保留全部入口但不再强挤单行。 */
@media (max-width: 760px) {
    .global-nav {
        height: auto;
        min-height: 64px;
        padding: 10px 12px;
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .nav-logo {
        margin-right: 12px;
        font-size: 18px;
        flex: 1 1 auto;
        min-width: 0;
    }

    .nav-menu {
        order: 3;
        flex: 0 0 100%;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 6px;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .nav-menu::-webkit-scrollbar {
        display: none;
    }

    .nav-item {
        flex: 0 0 auto;
        padding: 7px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    .nav-user {
        margin-left: 0;
        flex: 0 0 auto;
        gap: 4px;
        height: auto;
    }

    #nav-settings-wrap {
        margin-right: 4px !important;
    }
}

/* 全局导航响应式 L2：最窄手机再压一档字号与留白。 */
@media (max-width: 480px) {
    .global-nav {
        padding: 8px 10px;
        row-gap: 6px;
    }

    .nav-logo {
        font-size: 16px;
        margin-right: 8px;
    }

    .nav-item {
        padding: 6px 10px;
        font-size: 12px;
    }

    .nav-user {
        gap: 2px;
    }

    .nav-settings-btn {
        font-size: 12px !important;
    }
}

/* 主内容区 */
.main-content {
    min-height: calc(100vh - 64px);
    padding: 24px;
}
