/* 移动端底部导航栏 */
.ombox-mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    display: none; /* 默认隐藏 */
}

.ombox-mobile-batch-actions {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 8px);
    z-index: 1090;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
}

.ombox-mobile-batch-actions[hidden] {
    display: none;
}

.ombox-mobile-batch-count {
    flex: 0 0 auto;
    font-size: 13px;
    color: #495057;
}

.ombox-mobile-batch-buttons {
    display: flex;
    gap: 6px;
    overflow-x: auto;
}

.ombox-mobile-batch-buttons .btn {
    min-height: 44px;
    white-space: nowrap;
}

.ombox-mobile-action-feedback {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    z-index: 2200;
    padding: 12px 16px;
    border-radius: 8px;
    background: #1f2937;
    color: #fff;
    text-align: center;
    pointer-events: none;
    display: none;
}

@media (max-width: 767.98px) {
    .ombox-mobile-batch-actions:not([hidden]) {
        display: flex;
    }

    .ombox-mobile-action-feedback:not([hidden]) {
        display: block;
    }

    .ombox-mobile-menu-overlay:not([hidden]),
    .ombox-mobile-more-overlay:not([hidden]) {
        display: block;
    }

    .ombox-mobile-menu-drawer:not([hidden]),
    .ombox-mobile-more-drawer:not([hidden]) {
        display: flex;
    }

    .ombox-modal.ombox-h5-action-confirm {
        place-items: end center;
        padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .ombox-h5-action-confirm .ombox-modal-panel {
        width: 100%;
    }

    .ombox-h5-action-confirm .ombox-modal-close,
    .ombox-h5-action-confirm .ombox-modal-footer .btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* 现代手机横屏宽度可超过 768px；以已解析的 device-mobile + 短视口收口。 */
@media (min-width: 768px) and (max-width: 1023.98px) and (max-height: 599.98px) and (orientation: landscape) {
    body.device-mobile .ombox-mobile-batch-actions:not([hidden]) {
        display: flex;
    }

    body.device-mobile .ombox-mobile-action-feedback:not([hidden]),
    body.device-mobile .ombox-mobile-menu-overlay:not([hidden]),
    body.device-mobile .ombox-mobile-more-overlay:not([hidden]) {
        display: block;
    }

    body.device-mobile .ombox-mobile-menu-drawer:not([hidden]),
    body.device-mobile .ombox-mobile-more-drawer:not([hidden]) {
        display: flex;
    }

    body.device-mobile.has-mobile-bottom-nav .ombox-page-content,
    body.device-mobile.has-mobile-bottom-nav .ombox-dynamic-create {
        padding-bottom: 72px;
    }
}

/* 移动端显示底部导航栏（<768px） */
@media (max-width: 767.98px) {
    .ombox-mobile-bottom-nav {
        display: block;
    }
}

/* 桌面端隐藏底部导航栏（>=768px） */
@media (min-width: 768px) {
    .ombox-mobile-bottom-nav {
        display: none !important;
    }
}

.ombox-mobile-bottom-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    min-height: 60px;
    padding: 0 8px env(safe-area-inset-bottom, 0);
    max-width: 100%;
}

.ombox-mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 8px;
    border: none;
    background: transparent;
    color: #6c757d;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
}

.ombox-mobile-nav-item:hover,
.ombox-mobile-nav-item:active {
    color: #0087f7;
    background: rgba(0, 135, 247, 0.05);
    border-radius: 8px;
}

.ombox-mobile-nav-item i {
    font-size: 20px;
}

.ombox-mobile-nav-label {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.ombox-mobile-nav-create {
    color: #0087f7;
}

.ombox-mobile-nav-create i {
    font-size: 28px;
}

.ombox-mobile-nav-create .ombox-mobile-nav-label {
    font-weight: 600;
}

.ombox-mobile-nav-placeholder {
    cursor: not-allowed;
}

/* 移动端菜单抽屉 - 左侧 */
.ombox-mobile-menu-overlay,
.ombox-mobile-more-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    animation: fadeIn 0.3s;
    display: none;
}

.ombox-mobile-menu-overlay[hidden],
.ombox-mobile-more-overlay[hidden],
.ombox-mobile-menu-drawer[hidden],
.ombox-mobile-more-drawer[hidden] {
    display: none;
}

.ombox-mobile-menu-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 80%;
    background: #ffffff;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    z-index: 1110;
    display: none;
    flex-direction: column;
    animation: slideInLeft 0.3s;
    overflow: hidden; /* 防止内容溢出 */
}

/* 移动端更多菜单抽屉 - 右侧 */
.ombox-mobile-more-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 80%;
    background: #ffffff;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    z-index: 1110;
    display: none;
    flex-direction: column;
    animation: slideInRight 0.3s;
}

.ombox-mobile-menu-header,
.ombox-mobile-more-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0; /* 防止被压缩 */
}

.ombox-mobile-menu-title,
.ombox-mobile-more-title {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
}

.ombox-mobile-menu-close,
.ombox-mobile-more-close {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #6c757d;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.ombox-mobile-menu-close:hover,
.ombox-mobile-more-close:hover {
    background: #f8f9fa;
    color: #212529;
}

.ombox-mobile-menu-content,
.ombox-mobile-more-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* 移动端菜单克隆样式适配 */
.ombox-mobile-menu-content .sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ombox-mobile-menu-content .menu-item {
    list-style: none;
}

.ombox-mobile-menu-content .menu-link {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    color: #212529;
    text-decoration: none;
    transition: background 0.2s;
}

.ombox-mobile-menu-content .menu-link:hover,
.ombox-mobile-menu-content .menu-link:active {
    background: #f8f9fa;
}

.ombox-mobile-menu-content .menu-item.active > .menu-link {
    background: #e7f5ff;
    color: #0087f7;
    font-weight: 500;
}

.ombox-mobile-menu-content .menu-icon {
    width: 20px;
    margin-right: 12px;
    text-align: center;
    font-size: 16px;
}

.ombox-mobile-menu-content .menu-text {
    flex: 1;
}

.ombox-mobile-menu-content .menu-arrow {
    margin-left: 8px;
    opacity: 0.5;
}

/* 子菜单 */
.ombox-mobile-menu-content .submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f8f9fa;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.ombox-mobile-menu-content .submenu.show {
    max-height: 1000px; /* 足够大以容纳所有子菜单项 */
}

.ombox-mobile-menu-content .submenu-item {
    list-style: none;
}

.ombox-mobile-menu-content .submenu-link {
    display: flex;
    align-items: center;
    padding: 12px 16px 12px 48px;
    color: #495057;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.ombox-mobile-menu-content .submenu-link:hover,
.ombox-mobile-menu-content .submenu-link:active {
    background: #e9ecef;
}

.ombox-mobile-menu-content .submenu-item.active > .submenu-link {
    background: #d0ebff;
    color: #0087f7;
    font-weight: 500;
}

.ombox-mobile-menu-content .submenu-text {
    flex: 1;
}

/* 子菜单箭头旋转动画 */
.ombox-mobile-menu-content .menu-item .menu-arrow,
.ombox-mobile-menu-content .submenu-item .menu-arrow {
    transition: transform 0.3s ease;
}

.ombox-mobile-menu-content .menu-item.open > .menu-link .menu-arrow,
.ombox-mobile-menu-content .submenu-item.open > .submenu-link .menu-arrow {
    transform: rotate(180deg);
}

/* 移动端菜单底部固定项 */
.ombox-mobile-menu-footer {
    border-top: 1px solid #dee2e6;
    padding: 12px 8px;
    background: #f8f9fa;
    flex-shrink: 0; /* 防止被压缩 */
    min-height: 120px; /* 确保有足够高度 */
    width: 100%;
}

.ombox-mobile-menu-footer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #212529;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.ombox-mobile-menu-footer-item:last-child {
    margin-bottom: 0;
}

.ombox-mobile-menu-footer-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.ombox-mobile-menu-footer-item span {
    flex: 1;
    font-size: 15px;
}

.ombox-mobile-menu-footer-item:hover,
.ombox-mobile-menu-footer-item:active {
    background: #e9ecef;
}

.ombox-mobile-menu-footer-item--logout {
    color: #dc3545;
}

.ombox-mobile-menu-footer-item--logout:hover,
.ombox-mobile-menu-footer-item--logout:active {
    background: #fff5f5;
    color: #c92a2a;
}

/* 空状态 */
.ombox-mobile-menu-content .sidebar-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #868e96;
}

.ombox-mobile-menu-content .sidebar-empty-kicker {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.ombox-mobile-menu-content .sidebar-empty-state strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
    color: #495057;
}

.ombox-mobile-menu-content .sidebar-empty-state small {
    display: block;
    font-size: 13px;
}

/* 更多菜单项样式 */
.ombox-mobile-more-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: #212529;
    text-decoration: none;
    border-bottom: 1px solid #f8f9fa;
    transition: background 0.2s;
    min-height: 44px;
}

.ombox-mobile-more-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.ombox-mobile-more-item span {
    flex: 1;
}

.ombox-mobile-more-item:hover,
.ombox-mobile-more-item:active {
    background: #f8f9fa;
    color: #0087f7;
}

/* "返回列表"特殊样式（主要操作） */
.ombox-mobile-more-item-primary {
    color: #0087f7;
    font-weight: 500;
}

.ombox-mobile-more-item-primary:hover,
.ombox-mobile-more-item-primary:active {
    background: #e7f5ff;
}

/* 分隔线 */
.ombox-mobile-more-divider {
    height: 8px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

.ombox-mobile-more-empty {
    padding: 32px 16px;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* 确保页面内容不被底部导航遮挡 */
@media (max-width: 767.98px) {
    body.has-mobile-bottom-nav .ombox-page-content {
        padding-bottom: 80px;
    }

    body.has-mobile-bottom-nav .ombox-dynamic-create {
        padding-bottom: 80px;
    }
}

/* 护眼模式适配 */
body.eye-protection .ombox-mobile-bottom-nav {
    background: #f5f1e8;
    border-top-color: #d9cbb8;
}

body.eye-protection .ombox-mobile-nav-item {
    color: #6b5d4f;
}

body.eye-protection .ombox-mobile-nav-item:hover,
body.eye-protection .ombox-mobile-nav-item:active {
    background: rgba(107, 93, 79, 0.08);
}

body.eye-protection .ombox-mobile-menu-drawer,
body.eye-protection .ombox-mobile-more-drawer {
    background: #f5f1e8;
    border-color: #d9cbb8;
}

body.eye-protection .ombox-mobile-batch-actions {
    background: #f5f1e8;
    border-color: #d9cbb8;
}

body.eye-protection .ombox-mobile-menu-header,
body.eye-protection .ombox-mobile-more-header {
    border-bottom-color: #d9cbb8;
}

body.eye-protection .ombox-mobile-menu-footer {
    background: #ebe7dc;
    border-top-color: #d9cbb8;
}

body.eye-protection .ombox-mobile-menu-footer-item {
    color: #4a3c28;
}

body.eye-protection .ombox-mobile-menu-footer-item:hover,
body.eye-protection .ombox-mobile-menu-footer-item:active {
    background: #e0dcd0;
}
