/**
 * Pear Admin 风格样式 (参照 https://gitee.com/lunarlanding/pear-admin)
 * 在 layui 原生布局基础上, 还原 pear-admin 的配色、尺寸与交互观感:
 *  - 侧边栏 230px 深色 #28333E, 菜单项 56px / 子项 48px
 *  - 顶部 60px 白底, 内容区 whitesmoke
 *  - 多标签页白底 + 圆点激活指示器
 *  - 主色 --global-primary-color (默认 #36b368)
 */

/* ========== 主题变量 ==========
 * 统一使用 layui 默认主题主色 #009688 (墨绿/青绿)
 */
:root {
    --global-primary-color: #009688;
}

/* ========== 基础 ========== */
html, body, .layui-layout {
    height: 100%;
}

/* ========== 侧边栏 (深色) ========== */
.pear-admin .layui-side {
    top: 0;
    width: 230px;
    z-index: 9999;
    box-shadow: 2px 0 6px rgba(0, 21, 41, .20);
    overflow: hidden;
}

.pear-admin .layui-side-scroll {
    height: calc(100% - 60px) !important;
    background-color: #393D49;
    width: 247px;
    overflow-x: hidden;
    overflow-y: auto;
}

.pear-admin .layui-side-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* ========== Logo 区 ========== */
/* 覆盖 layui 原生 .layui-layout-admin .layui-logo 的绝对定位
   (原生为 position:absolute; top:0; height:100%, 会使 logo 脱离侧边栏并覆盖到顶部) */
.pear-admin .layui-side .layui-logo,
.pear-admin.layui-layout-admin .layui-logo {
    position: relative;
    left: auto;
    top: auto;
    height: 60px;
    line-height: 60px;
    width: 230px;
    background-color: #393D49;
    border-bottom: 1px solid rgba(0, 0, 0, .12);
    box-shadow: none;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pear-admin .layui-side .layui-logo .title {
    font-size: 21px;
    font-weight: 550;
    color: var(--global-primary-color);
    letter-spacing: 2px;
}

/* ========== 顶部栏 ========== */
/* 覆盖 layui 原生的 position:fixed + left:0, 改为在 .pear-admin(relative) 内绝对定位,
   并让出 230px 侧边栏宽度 */
.pear-admin .layui-header {
    position: absolute;
    top: 0;
    left: 230px;
    right: 0;
    width: auto;
    height: 60px;
    background-color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
}

.pear-admin .layui-header .layui-nav .layui-nav-item > a {
    color: #333;
    font-size: 15px;
}

/* 顶部导航下划线指示器 */
.pear-admin .layui-header .layui-nav .layui-nav-bar {
    top: 0 !important;
    background-color: var(--global-primary-color);
    height: 2px !important;
}

.pear-admin .layui-header .layui-nav .layui-this:after {
    display: none;
}

.pear-admin .layui-header .layui-nav-more {
    display: none;
}

/* 覆盖 layui 原生 .layui-layout-left{left:200px}, 改为紧贴 header 左侧(即侧边栏右边缘) */
.pear-admin .layui-header .layui-layout-left {
    position: absolute !important;
    left: 0;
    top: 0;
    padding: 0;
}

/* 收缩按钮尺寸与 hover 效果 */
.pear-admin .layui-header .layui-layout-left .layui-nav-item > a {
    padding: 0 18px;
    height: 60px;
    line-height: 60px;
    font-size: 18px;
    color: #5f5f5f;
}

.pear-admin .layui-header .layui-layout-left .layui-nav-item > a:hover {
    color: var(--global-primary-color);
}

.pear-admin .layui-layout-right .layui-nav-child {
    border: 1px solid whitesmoke;
    border-radius: 4px;
    width: auto;
    left: auto;
    right: -23px;
}

/* ========== 内容区 ========== */
/* 必须保持 layui 原生的 absolute 定位, 否则高度会塌陷为 0,
   导致内部 .pear-tab-page(height:100%) 与 iframe 高度归零、页面看似无数据 */
.pear-admin .layui-body {
    position: absolute;
    bottom: 0;
    left: 230px;
    right: 0;
    top: 60px;
    padding: 0;
    background-color: #f2f2f2;
    overflow: hidden;
}

/* ========== 菜单树 ========== */
.pear-nav-tree {
    width: 230px !important;
    border-radius: 0;
    background-color: #393D49;
}

.pear-nav-tree .layui-nav-item > a {
    height: 56px;
    line-height: 56px;
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 20px;
    padding-right: 20px;
}

.pear-nav-tree .layui-nav-item dd a {
    height: 48px;
    line-height: 48px;
    padding-left: 20px;
    padding-right: 20px;
}

/* 图标固定宽度并居中: 不同 glyph 字宽不同, 若不固定会导致各菜单项文字起始位置不齐;
   同时为无 icon 的菜单项提供等宽占位, 保证缩进一致 */
.pear-nav-tree .layui-nav-item a > i {
    display: inline-block;
    width: 22px;
    text-align: center;
    margin-right: 8px;
    font-size: 16px;
    vertical-align: baseline;
}

/* 无图标时的占位元素 (与图标等宽) */
.pear-nav-tree .layui-nav-item a > i.menu-icon-empty {
    visibility: hidden;
}

.pear-nav-tree .layui-nav-item a span {
    letter-spacing: 2px;
    font-size: 13.5px;
    display: inline-block;
    vertical-align: middle;
}

.pear-nav-tree .layui-nav-item a:hover {
    background-color: transparent;
}

/* 选中态: 主色背景 */
.pear-nav-tree .layui-nav-child dd.layui-this,
.pear-nav-tree .layui-nav-child dd.layui-this a,
.pear-nav-tree .layui-this,
.pear-nav-tree .layui-this > a,
.pear-nav-tree .layui-this > a:hover {
    background-color: var(--global-primary-color);
}

.pear-nav-tree .layui-nav-bar {
    display: none;
}

.pear-nav-tree .layui-nav-more {
    margin-right: 5px;
}

.pear-nav-tree dl {
    padding-top: 0;
    padding-bottom: 0;
}

/* 下拉箭头: 用 layui 图标字体替代原生三角形, 并明确定位以兼容 56px/48px 两种行高 */
.pear-nav-tree.arrow .layui-nav-more {
    position: absolute;
    top: 50%;
    right: 18px;
    left: auto !important;
    width: 12px;
    height: 12px;
    line-height: 12px;
    text-align: center;
    margin: 0;
    padding: 0;
    border: none;
    font-family: layui-icon !important;
    font-size: 12px;
    font-style: normal;
    color: rgba(255, 255, 255, .7);
    -webkit-font-smoothing: antialiased;
    overflow: visible;
    transform: translateY(-50%);
    transition: all .2s;
}

.pear-nav-tree.arrow .layui-nav-more:before {
    content: "\e61a";
}

/* 展开态: 箭头旋转 180 度 (需保留垂直居中的 translateY) */
.pear-nav-tree.arrow .layui-nav-itemed > a > .layui-nav-more {
    transform: translateY(-50%) rotate(180deg);
}

.pear-nav-tree.arrow .layui-nav-item > a:hover .layui-nav-more {
    color: #fff;
}

/* ========== 多标签页 ========== */
.pear-tab-page {
    margin: 0;
    overflow: hidden;
    height: 100% !important;
    display: flex;
    flex-direction: column;
}

.pear-tab-page > .layui-tab-title {
    border: 1px solid whitesmoke;
    background-color: #fff;
    height: 40px;
}

.pear-tab-page > .layui-tab-title li {
    border-right: 1px solid whitesmoke;
    color: dimgray;
    font-size: 13.5px;
    height: 40px;
    line-height: 40px;
}

/* 激活标签的圆点指示器 */
.pear-tab-page > .layui-tab-title .pear-tab-page-active {
    display: inline-block;
    background-color: lightgray;
    border-radius: 30px;
    margin-right: 12px;
    height: 8px;
    width: 8px;
}

.pear-tab-page > .layui-tab-title .layui-this .pear-tab-page-active {
    background-color: var(--global-primary-color) !important;
}

.pear-tab-page > .layui-tab-title .layui-this:after,
.pear-tab-page .layui-tab-title:after,
.pear-tab-page > .layui-tab-title .layui-tab-bar {
    display: none;
}

.pear-tab-page > .layui-tab-title .layui-tab-close:hover {
    background-color: #fff;
    color: gray;
}

.pear-tab-page .layui-tab-close {
    font-size: 13px;
}

/* 内容区: 由 flex 分配剩余空间, 并相对定位作为 item 的包含块 */
.pear-tab-page .layui-tab-content {
    flex: 1;
    position: relative;
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

/* item 绝对填满内容区: 既避免 flex 百分比基准塌陷, 又保证 iframe 高度链确定 */
.pear-tab-page .layui-tab-content .layui-tab-item {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    overflow: hidden;
}

/* 标签页内 iframe 容器 */
.pear-tab-page .tab-pane-wrap {
    position: relative;
    width: 100%;
    height: 100%;
}

.pear-tab-page iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* ========== 加载动画 ========== */
/* 首屏加载: 方块翻转 (pear 风格) */
.pear-loader-wrapper {
    position: fixed;
    width: 100%;
    height: 100%;
    background-color: #f2f2f2;
    z-index: 9999999;
}

.pear-loader {
    width: 50px;
    height: 50px;
    margin: 30px auto 40px;
    margin-top: 20%;
    position: relative;
    z-index: 999999;
    background-color: #f2f2f2;
}

.pear-loader:before {
    content: "";
    width: 50px;
    height: 7px;
    border-radius: 50%;
    background: #000;
    opacity: .1;
    position: absolute;
    top: 59px;
    left: 0;
    animation: pear-shadow .5s linear infinite;
}

.pear-loader:after {
    content: "";
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background-color: var(--global-primary-color);
    position: absolute;
    top: 0;
    left: 0;
    animation: pear-loading .5s linear infinite;
}

@keyframes pear-loading {
    17% { border-bottom-right-radius: 3px; }
    25% { transform: translateY(9px) rotate(22.5deg); }
    50% { transform: translateY(18px) scale(1, .9) rotate(45deg); border-bottom-right-radius: 40px; }
    75% { transform: translateY(9px) rotate(67.5deg); }
    100% { transform: translateY(0) rotate(90deg); }
}

@keyframes pear-shadow {
    0%, 100% { transform: scale(1, 1); }
    50% { transform: scale(1.2, 1); }
}

/* 内容区加载遮罩 */
.pear-admin .body-loading {
    position: absolute;
    inset: 0;
    z-index: 999;
    background: rgba(255, 255, 255, .9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.pear-admin .body-loading .load-title {
    margin-top: 12px;
    color: #666;
    font-size: 13px;
}

/* 小球加载 (pear ball-loader) */
.ball-loader {
    position: relative;
    height: 20px;
}

.ball-loader > span {
    background-color: var(--global-primary-color) !important;
    display: inline-block;
    width: 16px;
    height: 16px;
    margin: 0 3px;
    border-radius: 50%;
    transform: scale(0);
    animation: ball-load 1s ease-in-out infinite;
}

.ball-loader > span:nth-child(1) { animation-delay: 0s; }
.ball-loader > span:nth-child(2) { animation-delay: .1s; }
.ball-loader > span:nth-child(3) { animation-delay: .15s; }
.ball-loader > span:nth-child(4) { animation-delay: .2s; }

@keyframes ball-load {
    0% { transform: scale(0); }
    50% { transform: scale(1); }
    100% { transform: scale(0); }
}

/* ========== 弹窗加载态 ========== */
/* 弹窗内容区加载: 数据请求期间显示, 就绪后切换为 .dlg-body */
.dlg-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    min-height: 220px;
    color: #999;
    font-size: 13px;
}

.dlg-loading .ball-loader {
    margin-bottom: 10px;
}

.dlg-body {
    display: none;
}

/* ========== 内容卡片 (子页面容器) ==========
 * 回归 layui 默认观感: 白底、无投影圆角, 与 layui-card 一致
 */
.pear-card {
    background-color: #fff;
    padding: 16px;
    margin: 12px;
}

/* 子页面整体留白 */
.pear-page {
    padding: 0;
    background-color: #f2f2f2;
    min-height: 100%;
}

/* ========== 侧边收缩 (mini) ========== */
.pear-mini .layui-side { width: 60px; }
.pear-mini .layui-side .layui-logo { width: 60px; }
.pear-mini .layui-side .layui-logo .title { display: none; }
.pear-mini .layui-header { left: 60px; }
.pear-mini .layui-body { left: 60px; }
.pear-mini .pear-nav-tree { width: 60px !important; }
.pear-mini .pear-nav-tree .layui-nav-item span { display: none; }
.pear-mini .layui-side-scroll { width: 77px; }
/* 折叠时隐藏子菜单, 避免悬浮展开错位 */
.pear-mini .pear-nav-tree .layui-nav-child { display: none !important; }
.pear-mini .pear-nav-tree .layui-nav-more { display: none !important; }
