/**
 * OMBoxOS 框架样式
 * 包含全局布局、导航栏、侧边栏、底部等"壳"的样式
 * 适用于 PC 端和平板端
 */

/* ==================== CSS 变量 ==================== */
:root {
    /* 设计令牌已迁移至 ombox-tokens.css（全站唯一来源，ShellAsset 最先加载）。
       此处仅保留空 :root 占位，避免误以为令牌定义在本文件。 */
}

/* 护眼模式配色（默认淡绿色） */
body.eye-protection {
    --primary-color: #4f9d69;
    --success-color: #4f9d69;
    --info-color: #5a9f7a;
    --warning-color: #7aa35b;
    --danger-color: #c85a5a;
    --text-primary: #24422f;
    --text-secondary: #52695a;
    --border-color: #cfe3d2;
    --bg-gray: #edf7ee;
    --bg-white: #f7fcf8;
    --bg-card: #fbfefb;
    --focus-ring-color: rgba(63, 127, 88, 0.38);
    --focus-ring-shadow: none;
    --bs-focus-ring-color: rgba(63, 127, 88, 0.18);
    --color-primary: var(--primary-color);
    --color-success: var(--success-color);
    --color-info: var(--info-color);
    --color-warning: var(--warning-color);
    --color-danger: var(--danger-color);
    --color-text-primary: var(--text-primary);
    --color-text-secondary: var(--text-secondary);
    --color-text-muted: var(--text-secondary);
    --color-border: var(--border-color);
    --color-surface: var(--bg-card);
    --color-surface-muted: var(--bg-gray);
    --bs-primary: var(--primary-color);
    --bs-body-bg: var(--bg-gray);
    --bs-body-color: var(--text-primary);
    --bs-border-color: var(--border-color);
}

/* 护眼模式 - 框架组件背景色适配 */
body.eye-protection nav.navbar,
body.eye-protection nav.navbar-fixed {
    background: var(--bg-white) !important;
}

body.eye-protection .ombox-sidebar {
    background: var(--bg-white) !important;
}

body.eye-protection .ombox-page-footer {
    background: var(--bg-white) !important;
}

/* 护眼模式 - 下拉菜单和卡片背景适配 */
body.eye-protection .navbar-dropdown {
    background: var(--bg-card) !important;
}

body.eye-protection .navbar-dropdown-status {
    background: var(--bg-card) !important;
}

/* 护眼模式 - 通用白色背景适配 */
body.eye-protection .card,
body.eye-protection .test-card,
body.eye-protection [style*="background: white"],
body.eye-protection [style*="background:white"],
body.eye-protection [style*="background-color: white"],
body.eye-protection [style*="background-color:white"],
body.eye-protection [style*="background:#fff"],
body.eye-protection [style*="background: #fff"],
body.eye-protection [style*="background-color:#fff"],
body.eye-protection [style*="background-color: #fff"],
body.eye-protection [style*="background:#ffffff"],
body.eye-protection [style*="background: #ffffff"],
body.eye-protection [style*="background-color:#ffffff"],
body.eye-protection [style*="background-color: #ffffff"] {
    background: var(--bg-card) !important;
}

/* 护眼模式 - 浅灰背景适配 */
body.eye-protection [style*="background: #f3f4f6"],
body.eye-protection [style*="background-color: #f3f4f6"],
body.eye-protection [style*="background: #f5f5f5"],
body.eye-protection [style*="background-color: #f5f5f5"],
body.eye-protection [style*="background: #f7fafc"],
body.eye-protection [style*="background-color: #f7fafc"] {
    background: var(--bg-gray) !important;
}

/* 护眼模式 - 登出按钮悬停色适配 */
body.eye-protection .navbar-logout-btn:hover {
    background: #fce8e8 !important;
}

/* 护眼模式 - 按钮图标悬停色适配 */
body.eye-protection .btn-icon:hover {
    background: var(--bg-gray) !important;
}

/* ==================== 色盲友好护眼模式（棕黄色） ==================== */
body.eye-protection-sepia {
    --primary-color: #B8860B;      /* 暗金色替代蓝（色盲友好） */
    --success-color: #B8860B;
    --info-color: #B8860B;
    --warning-color: #B8860B;
    --danger-color: #CD5C5C;        /* 印第安红（色盲可识别） */
    --text-primary: #4a3f2e;        /* 深棕色文字 */
    --text-secondary: #6b5d4f;      /* 中棕色 */
    --border-color: #d4c4a8;        /* 浅棕色边框 */
    --bg-gray: #F5F1E8;             /* 米黄背景（护眼且色盲友好） */
    --bg-white: #FAF8F3;            /* 白色背景的米黄替代 */
    --bg-card: #FEFDFB;             /* 卡片背景的米黄替代 */
    --focus-ring-color: rgba(139, 107, 63, 0.42);
    --focus-ring-shadow: none;
    --bs-focus-ring-color: rgba(139, 107, 63, 0.2);
    --color-primary: var(--primary-color);
    --color-success: var(--success-color);
    --color-info: var(--info-color);
    --color-warning: var(--warning-color);
    --color-danger: var(--danger-color);
    --color-text-primary: var(--text-primary);
    --color-text-secondary: var(--text-secondary);
    --color-text-muted: var(--text-secondary);
    --color-border: var(--border-color);
    --color-surface: var(--bg-card);
    --color-surface-muted: var(--bg-gray);
    --bs-primary: var(--primary-color);
    --bs-body-bg: var(--bg-gray);
    --bs-body-color: var(--text-primary);
    --bs-border-color: var(--border-color);
}

/* 色盲友好模式 - 框架组件背景色适配 */
body.eye-protection-sepia nav.navbar,
body.eye-protection-sepia nav.navbar-fixed {
    background: var(--bg-white) !important;
}

body.eye-protection-sepia .ombox-sidebar {
    background: var(--bg-white) !important;
}

body.eye-protection-sepia .ombox-page-footer {
    background: var(--bg-white) !important;
}

/* 色盲友好模式 - 下拉菜单和卡片背景适配 */
body.eye-protection-sepia .navbar-dropdown {
    background: var(--bg-card) !important;
}

body.eye-protection-sepia .navbar-dropdown-status {
    background: var(--bg-card) !important;
}

/* 色盲友好模式 - 通用白色背景适配 */
body.eye-protection-sepia .card,
body.eye-protection-sepia .test-card,
body.eye-protection-sepia [style*="background: white"],
body.eye-protection-sepia [style*="background:white"],
body.eye-protection-sepia [style*="background-color: white"],
body.eye-protection-sepia [style*="background-color:white"],
body.eye-protection-sepia [style*="background:#fff"],
body.eye-protection-sepia [style*="background: #fff"],
body.eye-protection-sepia [style*="background-color:#fff"],
body.eye-protection-sepia [style*="background-color: #fff"],
body.eye-protection-sepia [style*="background:#ffffff"],
body.eye-protection-sepia [style*="background: #ffffff"],
body.eye-protection-sepia [style*="background-color:#ffffff"],
body.eye-protection-sepia [style*="background-color: #ffffff"] {
    background: var(--bg-card) !important;
}

/* 色盲友好模式 - 浅灰背景适配 */
body.eye-protection-sepia [style*="background: #f3f4f6"],
body.eye-protection-sepia [style*="background-color: #f3f4f6"],
body.eye-protection-sepia [style*="background: #f5f5f5"],
body.eye-protection-sepia [style*="background-color: #f5f5f5"],
body.eye-protection-sepia [style*="background: #f7fafc"],
body.eye-protection-sepia [style*="background-color: #f7fafc"] {
    background: var(--bg-gray) !important;
}

/* 色盲友好模式 - 登出按钮悬停色适配 */
body.eye-protection-sepia .navbar-logout-btn:hover {
    background: #f5e6e6 !important;
}

/* 色盲友好模式 - 按钮图标悬停色适配 */
body.eye-protection-sepia .btn-icon:hover {
    background: var(--bg-gray) !important;
}

/* ==================== 全局重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==================== 键盘焦点与无鼠标操作 ==================== */
.ombox-skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: calc(var(--z-toast, 1070) + 10);
    transform: translateY(-140%);
    padding: 8px 12px;
    border: 1px solid var(--focus-ring-color, #0b74de);
    border-radius: var(--radius-md, 8px);
    color: #ffffff;
    background: var(--focus-ring-color, #0b74de);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--focus-ring-shadow, 0 0 0 4px rgba(11, 116, 222, 0.18));
    transition: transform 0.16s ease;
}

.ombox-skip-link:focus,
.ombox-skip-link:focus-visible {
    transform: translateY(0);
    color: #ffffff;
    outline: var(--focus-ring-outline, 1px solid rgba(11, 116, 222, 0.36));
    outline-offset: var(--focus-ring-offset, 2px);
}

:where(a, button, input, select, textarea, summary, [role="button"], [role="link"], [role="menuitem"], [tabindex]):focus {
    outline: none;
}

:where(a, button, input, select, textarea, summary, [role="button"], [role="link"], [role="menuitem"], [tabindex]):focus-visible {
    outline: var(--focus-ring-outline, 1px solid rgba(11, 116, 222, 0.36)) !important;
    outline-offset: var(--focus-ring-offset, 2px);
    box-shadow: none !important;
}

input:focus,
input:focus-visible,
select:focus,
select:focus-visible,
textarea:focus,
textarea:focus-visible,
.form-control:focus,
.form-control:focus-visible,
.form-select:focus,
.form-select:focus-visible,
.form-check-input:focus,
.form-check-input:focus-visible {
    border: 1px solid var(--color-primary, #0087f7) !important;
    outline: none !important;
    box-shadow: none !important;
}

body.eye-protection :where(input, select, textarea, .form-control, .form-select, .form-check-input):focus,
body.eye-protection :where(input, select, textarea, .form-control, .form-select, .form-check-input):focus-visible {
    border-color: var(--success-color, #4f9d69) !important;
}

body.eye-protection-sepia :where(input, select, textarea, .form-control, .form-select, .form-check-input):focus,
body.eye-protection-sepia :where(input, select, textarea, .form-control, .form-select, .form-check-input):focus-visible {
    border-color: var(--primary-color, #B8860B) !important;
}

:where(.btn, .form-control, .form-select, .form-check-input, .dropdown-item, .nav-link, .page-link):focus-visible {
    border-color: var(--focus-ring-color, rgba(11, 116, 222, 0.36)) !important;
    box-shadow: none !important;
}

:where(.btn-danger, .btn-outline-danger):focus-visible {
    box-shadow: none !important;
}

[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

body:not(.is-keyboard-navigation) :where(a, button, input, select, textarea, summary, [role="button"], [role="link"], [role="menuitem"], [tabindex]):focus:not(:focus-visible) {
    outline: none !important;
    box-shadow: none !important;
}

body.dashboard-layout {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg-gray);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.btn-primary,
.btn-secondary,
.btn-success,
.btn-info,
.btn-warning,
.btn-light,
.btn-dark,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-info,
.btn-outline-warning,
.btn-outline-light,
.btn-outline-dark {
    background-color: #0087F7 !important;
    border-color: #0087F7 !important;
    color: #ffffff !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-secondary:hover,
.btn-secondary:focus,
.btn-success:hover,
.btn-success:focus,
.btn-info:hover,
.btn-info:focus,
.btn-warning:hover,
.btn-warning:focus,
.btn-light:hover,
.btn-light:focus,
.btn-dark:hover,
.btn-dark:focus,
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-success:hover,
.btn-outline-success:focus,
.btn-outline-info:hover,
.btn-outline-info:focus,
.btn-outline-warning:hover,
.btn-outline-warning:focus,
.btn-outline-light:hover,
.btn-outline-light:focus,
.btn-outline-dark:hover,
.btn-outline-dark:focus {
    background-color: #0087F7 !important;
    border-color: #0087F7 !important;
    color: #ffffff !important;
}

.btn-danger,
.btn-outline-danger {
    background-color: #FF0000 !important;
    border-color: #FF0000 !important;
    color: #ffffff !important;
}

.btn-danger:hover,
.btn-danger:focus,
.btn-outline-danger:hover,
.btn-outline-danger:focus {
    background-color: #FF0000 !important;
    border-color: #FF0000 !important;
    color: #ffffff !important;
}

/* ==================== 顶部导航栏 ==================== */
nav.navbar,
nav.navbar-fixed {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    z-index: 900; /* 低于 sidebar */
}

.program-main-layout > nav.program-navbar-content-toolbar.navbar {
    position: static !important;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    height: auto;
    min-height: 0;
    background: transparent;
    border: 0;
    z-index: auto;
}

/* 桌面端 (≥768px) */
@media (min-width: 768px) {
    body.ombox-shell > .container {
        max-width: none;
        width: 100%;
        margin-right: 0;
        margin-left: 0;
        padding-right: 0;
        padding-left: 0;
    }

    body.program-shell-layout > .container {
        padding-top: 8px;
    }

    body.admin-page > nav.navbar.navbar-fixed:not(.ombox-page-toolbar),
    body.admin-widget-page > nav.navbar.navbar-fixed:not(.ombox-page-toolbar) {
        display: none !important;
    }

    body.program-shell-layout nav.navbar-fixed {
        left: var(--sidebar-width);
        width: auto;
        transition: left 0.3s ease;
    }

    body.program-shell-layout.sidebar-collapsed nav.navbar-fixed {
        left: var(--sidebar-collapsed-width);
    }
}

nav.navbar .navbar-container {
    height: 100% !important;
    max-width: none !important;
    width: 100% !important;
    padding: 0 20px !important;
    margin: 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important; /* 左右分布 */
    flex-wrap: nowrap !important;
    flex-direction: row !important;
}

@media (max-width: 767.98px) {
    body.program-shell-layout .ombox-toolbar.ombox-page-toolbar {
        display: none !important;
    }
}

/* 左侧区域：侧边栏切换按钮（仅在桌面端应用）*/
@media (min-width: 768px) {
    nav.navbar .navbar-left {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        flex-shrink: 0 !important;
    }
}

/* 移动端强制隐藏 navbar-left */
@media (max-width: 767.98px) {
    nav.navbar .navbar-left {
        display: none !important;
    }
}

nav.navbar .navbar-page-left,
nav.navbar .navbar-page-right {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    min-width: 0 !important;
}

nav.navbar .navbar-page-right > [data-page-navbar-owner] + [data-page-navbar-owner],
nav.navbar .navbar-page-right > [data-page-navbar-owner] + .ombox-dynamic-action-menu,
nav.navbar .navbar-page-right > .ombox-dynamic-action-menu + [data-page-navbar-owner] {
    margin-left: 10px !important;
}

nav.navbar .navbar-page-left:empty,
nav.navbar .navbar-page-right:empty {
    display: none !important;
}

.ombox-page-share-qr-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    margin-right: 2px !important;
    color: #64748b !important;
    text-decoration: none !important;
    border-radius: 6px !important;
    flex: 0 0 auto !important;
    transition: background-color .15s ease, color .15s ease;
}

.ombox-page-share-qr-link:hover,
.ombox-page-share-qr-link:focus-visible {
    color: var(--primary-color, #0d6efd) !important;
    background: rgba(13, 110, 253, .08) !important;
    outline: none !important;
}

.ombox-page-share-qr-modal .modal-content {
    border-radius: 12px;
}

.ombox-page-share-qr-modal .modal-body {
    display: grid;
    gap: 1rem;
}

.ombox-page-share-qr-canvas-wrap {
    display: flex;
    justify-content: center;
    padding: 1rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    background: #f8fafc;
}

.ombox-page-share-qr-canvas-wrap canvas {
    width: min(100%, 320px);
    height: auto;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 16px 38px rgba(15, 23, 42, .12);
}

.ombox-page-share-qr-url-field {
    display: grid;
    gap: .375rem;
    margin: 0;
}

.ombox-page-share-qr-url-field span {
    font-size: .82rem;
    font-weight: 600;
    color: #475569;
}

.ombox-page-share-qr-status {
    min-height: 1.25rem;
    margin: 0;
    font-size: .84rem;
    color: #64748b;
}

/* 全局壳 navbar 无注入操作（两个 page 槽都空）且侧栏展开时：整条隐藏并回收顶部 56px。
   侧栏折叠时保留（用于显示展开按钮）；任何注入了 page-left/right 的页面不受影响。
   内容高度的回收已由 page-toolbar 隐藏规则 / page-toolbar 显示时自身占位共同满足。 */
@media (min-width: 768px) {
    body.ombox-shell.program-shell-layout:not(.sidebar-collapsed):has(.navbar-page-left:empty):has(.navbar-page-right:empty) nav.navbar-fixed {
        display: none !important;
    }

    body.ombox-shell.program-shell-layout:not(.sidebar-collapsed):has(.navbar-page-left:empty):has(.navbar-page-right:empty) > .container {
        padding-top: 0 !important;
    }
}

nav.navbar .navbar-collapsed-brand {
    height: 40px;
    max-width: var(--sidebar-logo-width);
    padding: 0 4px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

nav.navbar .navbar-collapsed-brand:hover {
    background: var(--bg-gray);
}

nav.navbar .navbar-collapsed-brand .sidebar-brand-logo {
    display: block;
    width: var(--sidebar-logo-width);
    max-width: 100%;
    height: var(--sidebar-logo-height);
    object-fit: contain;
}

body:not(.sidebar-collapsed) nav.navbar #sidebarOpenBtn {
    display: none !important;
}

body.sidebar-collapsed nav.navbar #sidebarOpenBtn {
    display: flex !important;
}

/* 右侧区域：用户信息和操作（仅在桌面端应用）*/
@media (min-width: 768px) {
    nav.navbar .navbar-right {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 12px !important;
        flex-shrink: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* 移动端强制隐藏 navbar-right */
@media (max-width: 767.98px) {
    nav.navbar .navbar-right {
        display: none !important;
    }
}

/* 移动端菜单下拉按钮 */
.navbar-mobile-menu {
    position: relative;
}

.navbar-mobile-menu-toggle {
    padding: 8px 12px !important;
    color: var(--text-secondary) !important;
    font-size: 18px;
    border: none !important;
    background: none !important;
    min-height: 44px; /* 触摸友好 */
}

.navbar-mobile-menu-toggle:hover,
.navbar-mobile-menu-toggle:focus {
    color: var(--text-primary) !important;
    background: var(--bg-gray) !important;
    border-radius: 8px;
}

.navbar-mobile-menu .dropdown-menu {
    min-width: 180px;
    margin-top: 8px;
}

.navbar-mobile-menu .dropdown-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    min-height: 44px; /* 触摸友好 */
}

.navbar-mobile-menu .dropdown-item i {
    width: 18px;
    text-align: center;
}

/* 桌面端菜单栏 */
.navbar-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-topbar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
}

.navbar-topbar-item:hover {
    background: var(--bg-gray);
    color: var(--text-primary);
    text-decoration: none;
}

.navbar-topbar-item svg {
    flex-shrink: 0;
}

.navbar-topbar-label {
    white-space: nowrap;
}

/* 护眼模式适配 */
body.eye-protection .navbar-mobile-menu-toggle:hover,
body.eye-protection .navbar-topbar-item:hover {
    background: var(--bg-gray) !important;
}

body.eye-protection-sepia .navbar-mobile-menu-toggle:hover,
body.eye-protection-sepia .navbar-topbar-item:hover {
    background: var(--bg-gray) !important;
}

nav.navbar .navbar-item {
    display: flex !important;
    align-items: center !important;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-gray);
    color: var(--text-primary);
    text-decoration: none;
}

.navbar-logout-btn:hover {
    background: #fef2f2;
    color: var(--danger-color);
}

/* 护眼模式按钮激活状态 */
#eyeProtectionToggle[data-active="true"] {
    background: var(--primary-color);
    color: #ffffff;
}

#eyeProtectionToggle[data-active="true"]:hover {
    background: var(--primary-color);
    color: #ffffff;
    opacity: 0.9;
}

/* 用户信息区域 */
.navbar-user {
    padding-left: 16px;
    border-left: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.user-info .user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.user-info .user-stats {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.user-info .user-stats strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Navbar 下拉菜单 */
.navbar-dropdown-wrapper {
    position: relative;
}

.navbar-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 8px;
    z-index: 1001;
}

.navbar-dropdown[hidden] {
    display: none;
}

.navbar-dropdown-btn {
    width: 100%;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #0087F7;
    border-radius: 6px;
    background: #0087F7;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 6px;
}

.navbar-dropdown-btn:last-child {
    margin-bottom: 0;
}

.navbar-dropdown-btn:hover {
    background: #0087F7;
    color: #ffffff;
}

.navbar-dropdown-btn-primary {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.navbar-dropdown-btn-primary:hover {
    background: #5568d3;
}

.navbar-dropdown-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.navbar-dropdown-status {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 6px;
}

.navbar-dropdown-status[data-state="working"],
.navbar-dropdown-status[data-state="recording"] {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.navbar-dropdown-status[data-state="break"] {
    border-color: #a7f3d0;
    background: #d1fae5;
    color: #047857;
}

.navbar-dropdown-status[data-state="paused"] {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.navbar-dropdown-info {
    width: 100%;
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
    margin-top: 6px;
}

.navbar-dropdown-link {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 14px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 6px;
}

.navbar-dropdown-link:hover {
    background: var(--bg-gray);
}

.navbar-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu-toggle:hover {
    background: var(--bg-gray);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-name {
    font-size: 14px;
    color: var(--text-primary);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 1001;
}

.user-menu:hover .user-menu-dropdown {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    text-align: left;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-gray);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* ==================== 主容器 ==================== */
body.dashboard-layout .container {
    margin-top: var(--navbar-height) !important;
    display: flex !important;
    min-height: calc(100vh - var(--navbar-height)) !important;
    padding-bottom: var(--footer-height) !important;
    max-width: none !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* ==================== 侧边栏 ==================== */
.ombox-sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0; /* 从屏幕顶部开始，覆盖 navbar */
    bottom: 0;
    overflow: hidden;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: var(--z-navbar); /* 最高优先级，覆盖 navbar */
}

/* 侧边栏头部：Logo 和折叠按钮 */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Logo 左，按钮右 */
    justify-content: center;
    gap: 0;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border-color);
    background: white;
    height: var(--navbar-height); /* 与 navbar 同高 */
}

/* 品牌样式 */
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #2d3748;
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 0;
    width: 100%;
    max-width: var(--sidebar-logo-width);
    height: 40px;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
}

.sidebar-brand-logo {
    display: block;
    width: var(--sidebar-logo-width);
    max-width: 100%;
    height: var(--sidebar-logo-height);
    object-fit: contain;
}

.sidebar-brand:hover {
    background: var(--bg-gray);
    color: #0087F7;
}

/* 折叠按钮 */
.sidebar-toggle {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    color: #2f3a4a;
    transition: all 0.2s ease;
}

    .sidebar-toggle:hover {
        background: rgba(0, 135, 247, 0.1);
        color: #0087F7;
    }

    .sidebar-collapsed-toggle {
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
        color: inherit;
        cursor: pointer;
        border-radius: 8px;
        appearance: none;
        -webkit-appearance: none;
    }

    .sidebar-collapsed-toggle:hover,
    .sidebar-collapsed-toggle:focus-visible {
        background: var(--bg-gray);
        outline: none;
    }

    .ombox-sidebar .sidebar-toggle {
        display: none !important;
    }

.sidebar-toggle-mark {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 12px;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
}

.sidebar-toggle-mark::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    border-top: 2px solid currentColor;
    transform: translateY(-50%);
}

/* 菜单列表 */
.sidebar-menu {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.menu-item {
    margin-bottom: 4px;
}

/* 菜单链接 */
    .menu-link {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 20px;
    color: #4a5568;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    border-radius: 8px;
    margin: 2px 8px;
}

.menu-link:hover {
    background: rgba(0, 135, 247, 0.08);
    color: #2d3748;
}

.menu-item.active > .menu-link {
    background: rgba(0, 135, 247, 0.15);
    color: #0087F7;
    font-weight: 500;
}

.menu-text {
    flex: 1;
}

/* 箭头图标 */
.menu-arrow {
    margin-left: auto;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transition: transform 0.3s ease;
    opacity: 0.6;
    transform: rotate(45deg);
}

.menu-item.has-active-child > .menu-link .menu-arrow,
.menu-item.open > .menu-link .menu-arrow {
    transform: rotate(225deg);
}

/* 左侧指示线 */
.menu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: #0087F7;
    border-radius: 0 3px 3px 0;
    transition: height 0.2s ease;
}

.menu-link:hover::before {
    height: 60%;
}

.menu-item.active > .menu-link::before {
    height: 80%;
}

/* 子菜单 */
.submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.submenu.show {
    max-height: 600px;
}

.submenu-item {
    margin: 0;
}

    .submenu-link {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 20px 10px 40px;
    color: #3f4b5f;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 2px 8px;
}

.submenu-link:hover {
    background: rgba(0, 135, 247, 0.06);
    color: #4a5568;
}

    .submenu-item.active > .submenu-link {
        background: rgba(0, 135, 247, 0.12);
        color: #0087F7;
        font-weight: 500;
        border-left: 3px solid #0087F7;
        padding-left: 37px;
    }

/* 侧边栏底部 */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #718096;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #95a5a6;
}

.status-dot.status-running {
    background: #2ecc71;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
}

/* 侧边栏折叠状态 */
.ombox-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    transform: none;
}

/* Content 区域在侧边栏折叠时的样式 */
.content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width) !important;
}

.ombox-sidebar.collapsed .sidebar-brand,
.ombox-sidebar.collapsed .sidebar-brand-copy,
.ombox-sidebar.collapsed .sidebar-empty-state,
.ombox-sidebar.collapsed .sidebar-brand-text {
    display: none;
}

.ombox-sidebar.collapsed .menu-text {
    display: none;
}

.ombox-sidebar.collapsed .menu-arrow {
    display: none;
}

.ombox-sidebar.collapsed .submenu {
    display: none;
}

.ombox-sidebar.collapsed .sidebar-footer {
    display: none;
}

.ombox-sidebar.collapsed .status-text {
    display: none;
}

.ombox-sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 12px 8px;
}

.ombox-sidebar.collapsed .sidebar-collapsed-toggle {
    display: inline-flex !important;
}

.ombox-sidebar.collapsed .menu-link,
.ombox-sidebar.collapsed .submenu-link {
    justify-content: center;
    padding-right: 8px;
    padding-left: 8px;
    margin-right: 8px;
    margin-left: 8px;
}

/* ==================== 主内容区 ==================== */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 0 24px 24px;
    min-height: 0;
    transition: margin-left 0.3s ease;
    position: relative;
    z-index: var(--z-content); /* 最底层 */
    background: var(--bg-gray); /* 确保有背景色 */
}

.content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

/* ==================== 底部 ==================== */
.ombox-page-footer {
    position: static;
    height: var(--footer-height);
    flex-shrink: 0;
    background: white;
    border-top: 1px solid var(--border-color);
    z-index: var(--z-footer); /* 中间层：高于 content，低于 sidebar */
}

.footer-container {
    height: 100%;
    padding: 0 20px;
    margin-left: var(--sidebar-width); /* 为侧边栏留出空间 */
    display: flex;
    align-items: center;
    justify-content: flex-end; /* 右对齐 */
    transition: margin-left 0.3s ease;
}

.footer-left {
    display: flex;
    align-items: center;
}

/* 侧边栏折叠时，footer 也要调整 */
body.sidebar-collapsed .footer-container {
    margin-left: var(--sidebar-collapsed-width);
}

.footer-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.footer-version-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
}

.footer-version-link:hover,
.footer-version-link:focus {
    color: var(--primary-color);
}

.footer-version-dot {
    position: absolute;
    top: 1px;
    right: -7px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #dc3545;
    box-shadow: 0 0 0 2px #fff;
    opacity: 0;
    transform: scale(.7);
    transition: opacity .18s ease, transform .18s ease;
}

.footer-version-link.has-update .footer-version-dot {
    opacity: 1;
    transform: scale(1);
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer-link {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--primary-color);
}

/* ==================== OMBox Shell Layout ==================== */
body.ombox-shell {
    min-height: 100vh;
    background: var(--bg-gray);
    color: var(--text-primary);
}

body.ombox-shell .btn-primary,
body.ombox-shell .btn-secondary,
body.ombox-shell .btn-success,
body.ombox-shell .btn-info,
body.ombox-shell .btn-warning,
body.ombox-shell .btn-light,
body.ombox-shell .btn-dark,
body.ombox-shell .btn-outline-primary,
body.ombox-shell .btn-outline-secondary,
body.ombox-shell .btn-outline-success,
body.ombox-shell .btn-outline-info,
body.ombox-shell .btn-outline-warning,
body.ombox-shell .btn-outline-light,
body.ombox-shell .btn-outline-dark {
    background-color: #0087f7 !important;
    border-color: #0087f7 !important;
    color: #ffffff !important;
}

body.ombox-shell .btn-primary:hover,
body.ombox-shell .btn-primary:focus,
body.ombox-shell .btn-secondary:hover,
body.ombox-shell .btn-secondary:focus,
body.ombox-shell .btn-success:hover,
body.ombox-shell .btn-success:focus,
body.ombox-shell .btn-info:hover,
body.ombox-shell .btn-info:focus,
body.ombox-shell .btn-warning:hover,
body.ombox-shell .btn-warning:focus,
body.ombox-shell .btn-light:hover,
body.ombox-shell .btn-light:focus,
body.ombox-shell .btn-dark:hover,
body.ombox-shell .btn-dark:focus,
body.ombox-shell .btn-outline-primary:hover,
body.ombox-shell .btn-outline-primary:focus,
body.ombox-shell .btn-outline-secondary:hover,
body.ombox-shell .btn-outline-secondary:focus,
body.ombox-shell .btn-outline-success:hover,
body.ombox-shell .btn-outline-success:focus,
body.ombox-shell .btn-outline-info:hover,
body.ombox-shell .btn-outline-info:focus,
body.ombox-shell .btn-outline-warning:hover,
body.ombox-shell .btn-outline-warning:focus,
body.ombox-shell .btn-outline-light:hover,
body.ombox-shell .btn-outline-light:focus,
body.ombox-shell .btn-outline-dark:hover,
body.ombox-shell .btn-outline-dark:focus {
    background-color: #0087f7 !important;
    border-color: #0087f7 !important;
    color: #ffffff !important;
}

body.ombox-shell .btn-danger,
body.ombox-shell .btn-outline-danger {
    background-color: #ff0000 !important;
    border-color: #ff0000 !important;
    color: #ffffff !important;
}

body.ombox-shell .btn-danger:hover,
body.ombox-shell .btn-danger:focus,
body.ombox-shell .btn-outline-danger:hover,
body.ombox-shell .btn-outline-danger:focus {
    background-color: #ff0000 !important;
    border-color: #ff0000 !important;
    color: #ffffff !important;
}

body.ombox-shell .ombox-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-navbar);
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    overflow: hidden;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    transition: width .3s ease, transform .3s ease;
}






























body.ombox-shell .ombox-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}







body.ombox-shell > .container > .admin-content,
body.ombox-shell > .container > .ombox-main {
    box-sizing: border-box;
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    padding: 0 24px 24px;
    margin-left: var(--sidebar-width);
    background: var(--bg-gray);
    transition: margin-left .3s ease, width .3s ease;
}

body.ombox-shell > .container > .admin-content .ombox-page-toolbar,
body.ombox-shell > .container > .ombox-main .ombox-page-toolbar {
    padding-left: 0;
}

body.ombox-shell .ombox-page-footer {
    position: static;
    inset: auto;
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 100%;
    min-height: var(--footer-height, 48px);
    padding: 0;
    margin: auto 0 0;
}

body.ombox-shell.ombox-sidebar-collapsed > .container > .ombox-main {
    width: calc(100% - var(--sidebar-collapsed-width));
    margin-left: var(--sidebar-collapsed-width);
}

body.ombox-shell.ombox-sidebar-collapsed .ombox-page-footer {
    width: 100%;
    margin-left: 0;
}

/* ==================== 响应式 ==================== */
/* 移动端 (<768px) - 使用 767.98px 避免断点边界问题 */
@media (max-width: 767.98px) {
    .ombox-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .ombox-sidebar.active {
        transform: translateX(0);
    }

    .content {
        margin-left: 0;
    }

    body.ombox-shell .ombox-sidebar {
        transform: translateX(-100%);
    }


    body.ombox-shell > .container > .admin-content,
    body.ombox-shell > .container > .ombox-main {
        width: 100%;
        margin-left: 0;
    }

    body.ombox-shell .ombox-page-footer {
        width: 100%;
        margin-left: 0;
    }

    /* 移动端：content 无间距 */
    body.ombox-shell > .container > .ombox-page-content,
    body.ombox-shell > .container > .content {
        padding: 0;
    }

    /* 移动端：缩小 navbar 和 content 之间的间距 */
    body.program-shell-layout > .container,
    body.ombox-shell > .container {
        padding-top: 0;
        margin-top: var(--navbar-height, 56px);
    }
}

/* ==================== 护眼模式通知动画 ==================== */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ==================== 全局按钮形状 ==================== */
.btn {
    --bs-btn-border-radius: 3px;
}

.btn-sm {
    --bs-btn-border-radius: 3px;
    border-radius: 3px;
}

/* ==================== 全局标签形状 ==================== */
.badge {
    --bs-badge-border-radius: 3px;
    border-radius: 3px;
}
