/* ===== EMS WASM 全局样式 ===== */

:root {
    --enterprise-primary: #1a365d;
    --enterprise-primary-light: #2d5282;
    --enterprise-primary-lighter: #4299e1;
    --enterprise-gray-50: #f7fafc;
    --enterprise-gray-100: #edf2f7;
    --enterprise-gray-200: #e2e8f0;
    --enterprise-gray-500: #718096;
    --enterprise-gray-800: #1a202c;
    --enterprise-border-color: var(--enterprise-gray-200);
    --enterprise-border-radius: 8px;

    --bb-header-color: #ffffff;
    --bb-header-bg: var(--enterprise-primary);
    --bb-layout-header-background: transparent;
    --bb-layout-sidebar-banner-background: var(--enterprise-gray-50);
    --bb-layout-header-color: var(--bb-header-color);
    --bb-layout-title-color: var(--bb-header-color);
}

/* 确保 html/body 撑满屏幕 */
html, body, #app {
    height: 100%;
    margin: 0;
    padding: 0;
}

html,
body {
    overflow: hidden !important;
}

/* BootstrapBlazor Layout 全屏覆盖 */
.layout-main {
    height: 100vh;
}

.bb-layout,
.bb-layout.layout {
    overflow: hidden !important;
    max-width: 100% !important;
    height: 100vh !important;
}

.bb-layout .layout-header {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.bb-layout .layout-side {
    border-right: 1px solid var(--enterprise-border-color);
    background: white;
}

.bb-layout .layout-footer {
    border-top: 1px solid var(--enterprise-border-color);
    background: var(--enterprise-gray-50);
}

.bb-layout .layout-drawer {
    padding: 8px;
    cursor: pointer;
    border-radius: var(--enterprise-border-radius);
    transition: all 0.2s ease-in-out;
    color: white;
}

.bb-layout .layout-drawer:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-notifications {
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    position: relative;
}

.header-notifications .dropdown-toggle {
    white-space: nowrap;
}

.header-notifications-menu {
    min-width: 240px;
    border: none;
    border-radius: var(--enterprise-border-radius);
    padding: 0.5rem 0;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 1080;
    display: block;
}

.header-notifications-title {
    padding: 0.5rem 1rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--enterprise-gray-800);
    border-bottom: 1px solid var(--enterprise-gray-200);
    margin-bottom: 0.25rem;
}

.header-notifications-menu .dropdown-item {
    padding: 0.65rem 1rem;
    margin: 0;
}

.dropdown-logout {
    --bb-logout-text-color: var(--bb-header-color);
    position: relative;
}

.logout-avatar {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid white;
}

.enterprise-user-info .dropdown-menu {
    border: none;
    border-radius: var(--enterprise-border-radius);
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 1080;
    display: block;
}

.enterprise-user-info {
    display: flex;
    align-items: center;
}

.layout-header .w-100 {
    gap: 0.5rem;
}

.layout-header .layout-drawer {
    margin-left: 0.25rem !important;
}

.logout-user-text {
    min-width: 110px;
    max-width: 160px;
    line-height: 1.1;
}

.logout-display-name,
.logout-login-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-display-name {
    max-width: 100%;
}

.logout-login-name {
    max-width: 100%;
    font-size: 0.72rem;
}

.menu {
    --bb-menu-active-color: var(--enterprise-primary);
    --bb-menu-bar-bg: var(--enterprise-primary);
    --bb-menu-item-hover-bg: var(--enterprise-gray-50);
    --bb-menu-item-hover-color: var(--enterprise-primary);
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    max-height: none !important;
}

.submenu .submenu {
    margin: 0 !important;
    padding-left: 20px !important;
    list-style: none !important;
}

.menu-item {
    border-radius: 4px;
    margin: 0.25rem 0.5rem;
    transition: all 0.2s ease-in-out;
}

.menu-item:hover {
    background: var(--enterprise-gray-50);
}

.menu-item.active {
    background: var(--enterprise-primary);
    color: white;
}

.menu-item.active .wasm-menu-link-inner,
.menu-item.active .wasm-menu-text,
.menu-item.active i,
.wasm-menu-link.active,
.wasm-menu-link.active i,
.wasm-menu-link.active span {
    color: white !important;
}

.menu-item-container {
    display: block;
}

.menu-items {
    padding: 0;
    margin: 0;
}

/* 左侧菜单与右侧内容区分别作为独立纵向滚动区域 */
.enterprise-sidebar,
.enterprise-sidebar-viewport,
.enterprise-sidebar-content,
.wasm-sidebar-menu {
    min-height: 0 !important;
}

.enterprise-sidebar-viewport {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 260px !important;
    overflow-y: scroll !important;
    overflow-x: visible !important;
    scrollbar-gutter: stable !important;
    z-index: 30 !important;
}

.enterprise-sidebar {
    min-height: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    overflow-x: visible !important;
    display: block !important;
}

.enterprise-sidebar-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 2 !important;
}

.enterprise-sidebar-content,
.wasm-sidebar-menu {
    overflow-x: hidden !important;
    scrollbar-gutter: stable;
}

.enterprise-sidebar-content {
    height: auto !important;
    overflow-y: visible !important;
    padding-bottom: 4rem !important;
}

.wasm-sidebar-menu {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
    padding-bottom: 4rem !important;
}

.bb-layout .layout-main,
.bb-layout .bb-layout-main {
    min-height: 0 !important;
    overflow: hidden !important;
}

.bb-layout .layout-side,
.bb-layout .bb-layout-side {
    z-index: 30 !important;
    overflow: visible !important;
}

.bb-layout .bb-layout-body {
    overflow-y: hidden !important;
    overflow-x: visible !important;
}

.bb-layout .layout-main,
.bb-layout .bb-layout-main,
.bb-layout .bb-main {
    position: relative;
    z-index: 1;
}

.menu .nav .sub-menu,
.menu .nav .dropdown-menu,
.menu .submenu {
    z-index: 1050 !important;
}

.enterprise-main-scroll {
    height: calc(100vh - 50px) !important;
    max-height: calc(100vh - 50px) !important;
    min-height: 0 !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    scrollbar-gutter: stable;
}

.wasm-menu-toggle {
    appearance: none;
    -webkit-appearance: none;
}

.wasm-menu-toggle,
.wasm-menu-link {
    width: calc(100% - 1rem);
}

.layout-drawer-body {
    padding: 1rem;
}

.layout-item {
    --bb-layout-sidebar-bg: #f8f9fa;
    --bb-layout-footer-bg: #e9ecef;
    cursor: pointer;
    border: 2px solid #e9ecef;
    padding: 4px;
    border-radius: 4px;
    height: 80px;
    width: 120px;
    transition: border .3s linear;
}

.layout-item:hover,
.layout-item.active {
    border: 2px solid #28a745;
}

.layout-item .layout-left {
    width: 30%;
    border-right: 1px solid var(--bs-border-color);
}

.layout-item .layout-left .layout-left-header {
    height: 16px;
    background-color: var(--bb-header-bg);
}

.layout-item .layout-left .layout-left-body,
.layout-item .layout-body .layout-left {
    background-color: var(--bb-layout-sidebar-bg);
}

.layout-item .layout-right .layout-right-header,
.layout-item .layout-top {
    background-color: var(--bb-header-bg);
    height: 16px;
}

.layout-item .layout-right .layout-right-footer,
.layout-item .layout-right-footer {
    background-color: var(--bb-layout-footer-bg);
    height: 12px;
}

.layout-item .layout-top,
.layout-item .layout-body,
.layout-item .layout-right-footer {
    width: 100%;
}

/* 侧边栏品牌区：覆盖 BootstrapBlazor 侧边栏默认背景色与文字 */
.layout-side {
    display: flex;
    flex-direction: column;
    min-width: 260px;
    width: 260px;
    background: #fff;
    transition: width .2s ease, min-width .2s ease;
}

.layout .layout-side {
    position: relative;
}

.layout.is-collapsed .layout-side {
    width: 64px !important;
    min-width: 64px !important;
}

.layout.is-collapsed .enterprise-sidebar-header {
    padding: 1rem 0.5rem;
}

.layout.is-collapsed .enterprise-sidebar-brand,
.layout.is-collapsed .enterprise-header-brand {
    justify-content: center;
}

.layout.is-collapsed .enterprise-sidebar-brand-text,
.layout.is-collapsed .enterprise-header-brand-text,
.layout.is-collapsed .wasm-menu-text,
.layout.is-collapsed .wasm-menu-arrow {
    display: none !important;
}

.layout.is-collapsed .enterprise-sidebar-logo,
.layout.is-collapsed .enterprise-header-logo {
    margin-right: 0 !important;
}

.layout.is-collapsed .wasm-sidebar-menu {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.layout.is-collapsed .wasm-menu-link-inner,
.layout.is-collapsed .wasm-menu-toggle {
    justify-content: center;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.layout.is-collapsed .wasm-menu-label {
    justify-content: center;
    width: 100%;
}

.layout.is-collapsed .wasm-menu-icon {
    width: 1.25rem;
    min-width: 1.25rem;
    font-size: 1rem;
}

.layout.is-collapsed .header-notifications,
.layout.is-collapsed .enterprise-user-info {
    margin-right: 0.5rem;
}

/* 顶栏链接 hover 效果 */
.layout-header .btn-link:hover {
    color: #ffd700 !important;
    text-decoration: none;
}

/* ===== 内容区内边距 ===== */
.layout-main-content {
    padding: 1rem 1.25rem;
}

/* ===== 底部栏 ===== */
.layout-footer {
    font-size: 0.8rem;
}

/* ===== 加载进度覆盖 ===== */
.loading-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.loading-progress circle {
    fill: none;
    stroke: #1a2a6c;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #b21f1f;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: fixed;
    top: calc(50% + 5rem);
    left: 50%;
    transform: translate(-50%, -50%);
    color: #555;
    font-size: 0.9rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "加载中...");
}

/* ===== 错误 UI ===== */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none;
    left: 0;
    padding: .6rem 1.25rem .7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: .75rem;
    top: .5rem;
}
