/**
 * 页面布局样式
 *
 * 职责：定义搜索栏、工具栏、弹窗、表单等布局结构
 * 原则：不覆盖 EasyUI，只定义业务布局
 */

/* ========== 0. 全局设置 ========== */

/* 页面淡入效果（防闪烁） */
body {
    margin: 0;
    opacity: 1;
}
body.adm-shell {
    opacity: 1;
}
body.page-ready {
    opacity: 1;
}

/* EasyUI modal 遮罩默认按文档尺寸绝对定位；在 iframe/fragment 填充布局里容易少铺底部。 */
.window-mask {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: auto !important;
    height: auto !important;
}

/* EasyUI tabs/panel 内容区设置 */
.tabs-panels > .panel > .panel-body,
.easyui-layout > .panel-body {
    overflow: hidden !important;
    position: relative;  /* 供子元素绝对定位使用 */
}

/* ========== 1. 页面容器 ========== */

.layout-container {
    display: flex;
    flex-direction: column;
}

/* Tab 面板容器（用于带 Tab 的页面，绝对定位填满 EasyUI panel） */
.tab-container {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
}

.tab-container > .search-panel {
    flex-shrink: 0;
}

.tab-container > .toolbar {
    flex-shrink: 0;
}

.tab-container > .table {
    flex: 1;
    min-height: 0;
}

.tab-container > .analysis-panel {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: hidden;
}

/* 页面级子 Tab 片段容器：父页保留单运行时，子页 DOM 填满当前 Tab 面板 */
.fragment-tab-content {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
}

.fragment-tab-loading,
.fragment-tab-error {
    padding: 12px 14px;
    color: #666;
}

.fragment-tab-error {
    color: #c0392b;
}

/* 防止 Tab 选中加粗时英文字符变宽导致位移，用 text-shadow 模拟加粗 */
.tabs li.tabs-selected .tabs-title {
    font-weight: normal !important;
    text-shadow: 0.3px 0 0 currentColor;
}

/* ========== 2. 搜索栏 ========== */

/* 搜索面板（合并原 .pannel + .sctrow，与 .analysis-panel 命名一致） */
.search-panel {
    display: flex;
    flex-wrap: wrap;
    padding: var(--spacing-xs) 0 var(--spacing-md) var(--spacing-md);
    background: var(--color-bg-panel);
    border-bottom: 1px solid var(--color-border);
}

/* Select2 初始化前隐藏原始 input（防闪烁，Select2 会创建自己的 DOM） */
input.multiselect {
    display: none;
}

/* 搜索项 */
.s_input {
    padding-right: var(--spacing-sm);
    display: flex;
    align-items: center;
    margin-top: var(--spacing-sm);
}

.s_title {
    padding-right: var(--spacing-xs);
    display: inline-block;
    white-space: nowrap;
}

.s_my_title {
    flex-shrink: 0;
}

/* ========== 3. 工具栏 ========== */

.toolbar {
    padding: 5px 10px;
    display: flex;
    align-items: center;
    background: #F4F4F4;
    border-bottom: 1px solid #ddd;
    min-height: 26px;
    box-sizing: border-box;
}

.toolbar .easyui-linkbutton {
    margin-right: var(--spacing-xs);
}

.toolbar .l-btn,
.datagrid-toolbar .l-btn {
    height: 24px;
    line-height: 24px;
    box-sizing: border-box;
}

.toolbar .l-btn-left,
.datagrid-toolbar .l-btn-left {
    height: 22px;
    line-height: 22px;
}

.toolbar .l-btn-text,
.datagrid-toolbar .l-btn-text {
    height: 22px;
    line-height: 22px;
}

.toolbar .l-btn-icon,
.datagrid-toolbar .l-btn-icon {
    top: 50%;
    margin-top: -8px;
}

.toolbar-tip-icon {
    margin-left: var(--spacing-xs);
    font-size: 15px;
    color: #888;
}

/* 字段/列头帮助：标签下方一条虚线，鼠标悬停出 tooltip（替代 i 图标的轻量提示） */
.help-tip {
    border-bottom: 1px dashed #b0b3bb;
    cursor: help;
}

/* ========== 4. 表格容器 ========== */

.table-container {
    flex: 1;
    min-height: 0;
}

/* .table 容器（datagrid 外层包装） - 撑满剩余空间 */
.layout-container .table,
.table {
    flex-grow: 1;
    margin: 0;
}

/* ========== 5. 弹窗布局 ========== */

/* 弹窗内 layout-container 撑满高度 */
.easyui-dialog > .layout-container,
.window-body > .layout-container,
.panel-body > .layout-container {
    height: 100%;
}

/* 弹窗内容区 */
.dialog-body {
    padding: 20px 30px;
}

/* 动态长表单在短视口内滚动，避免窗口超出可操作区域。 */
.dialog-body-scrollable {
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    box-sizing: border-box;
}

/* 弹窗表单 */
.dialog-form {
    border-collapse: separate;
    border-spacing: 0 10px;  /* 行间距 10px */
}

.dialog-form.dialog-form-wide {
    width: 100%;
    table-layout: fixed;
}

.dialog-form.dialog-form-wide td:not([class*="form-label"]) {
    min-width: 0;
}

.dialog-form .dialog-json-field {
    overflow: hidden;
}

.dialog-form td {
    padding: 0;
    vertical-align: middle !important;
}

/* 表单标签 - 居中对齐 */
.dialog-form .form-label,
.dialog-form .form-label-sm,
.dialog-form .form-label-lg,
.dialog-form .form-label-xl {
    white-space: nowrap;
    text-align: center;
    padding-right: 8px;
    color: var(--color-text);
}


/* 标签宽度变体（根据字数） */
.dialog-form .form-label { width: var(--label-w-md); }      /* 2字标签（默认） */
.dialog-form .form-label-sm { width: var(--label-w-sm); }   /* 2字标签 */
.dialog-form .form-label-lg { width: var(--label-w-lg); }   /* 3-4字标签 */
.dialog-form .form-label-xl { width: var(--label-w-xl); }   /* 5字及以上 */

/* 必填标记 - 红色星号放在标签后面 */
.dialog-form .form-required::after {
    content: ' *';
    color: var(--icon-danger);
    font-weight: bold;
}

/* 弹窗按钮区 */
.dialog-buttons {
    text-align: center;
    padding-top: 15px;
    margin-top: 5px;
}

.dialog-buttons .easyui-linkbutton {
    margin: 0 8px;
}

/* 小屏弹窗保留 8px 安全边距，表单控件按可用宽度收缩。 */
@media (max-width: 520px) {
    .window {
        left: 8px !important;
        max-width: calc(100vw - 16px) !important;
        box-sizing: border-box;
    }

    .window .window-body {
        max-width: calc(100vw - 28px) !important;
        box-sizing: border-box;
    }

    .window .dialog-body {
        padding: 14px 10px;
    }

    .window .dialog-form {
        width: 100%;
        table-layout: fixed;
    }

    .window .dialog-form td:not([class*="form-label"]) {
        min-width: 0;
    }

    .window .dialog-form .textbox {
        width: 100% !important;
        box-sizing: border-box;
    }
}

/* 列表弹窗（包含搜索栏+工具栏+表格的弹窗，区别于编辑表单弹窗） */
.dialog-list > .layout-container {
    height: 100%;
}

/* ========== 6. 分析面板（日志统计页面） ========== */
/*
 * 布局结构（从上到下）：搜索栏 → 工具栏 → 数据图 → 数据表
 * 分割线规范：上下区块之间用蓝色分割线(#95B8E7)，左右图表之间用分割线
 * 数据图标题：与 datagrid 列表头样式一致
 */

.analysis-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: var(--color-bg-panel);
}

/* 图表行（多图表并排） */
.analysis-row {
    display: flex;
    border-bottom: 1px solid var(--color-border);
}

/* 单独的分析区块（简化结构，无需 row + item 嵌套） */
.analysis-section {
    flex-shrink: 0;
    border-bottom: 1px solid var(--color-border);
}

/* 表格区块（占满剩余空间，无下边框） */
.analysis-section-table {
    flex: 1 1 0;
    height: 0;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

/* 图表项 */
.analysis-item {
    flex: 1;
    min-width: 0;
}

/* 左右图表之间的分割线（与 datagrid 列分隔线一致） */
.analysis-item + .analysis-item {
    border-left: 1px dotted #ccc;
}

/* 数据图标题（与 datagrid 列表头样式一致） */
.analysis-title {
    height: 25px;
    line-height: 25px;
    font-size: var(--font-size-base);
    font-weight: normal;
    color: var(--color-text);
    text-align: center;
    background: linear-gradient(to bottom, #F9F9F9 0%, #efefef 100%);
    border-bottom: 1px solid var(--color-border-light);
    cursor: default;
}

.analysis-title:hover {
    background: linear-gradient(to bottom, #EAF2FA 0%, #D6E6F5 100%);
}

/* 图表容器（统一高度，切换 Tab 时视觉一致） */
.chart-container {
    height: 200px;
}

/* ========== 7. 左侧菜单 ========== */

.accordion-body {
    list-style-type: none;
    margin: 0;
}

.accordion-body li {
    padding: 0;
}

.accordion-body li div {
    margin: 2px 0;
    padding-left: var(--spacing-sm);
    padding-top: 2px;
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
}

.accordion-body li div a {
    line-height: 24px;
    display: block;
    height: 24px;
    color: inherit;
    text-decoration: none;
}

.accordion-body li div a:hover {
    text-decoration: none;
}

.accordion-body li div.hover {
    border-top: 1px dashed #99BBE8;
    border-bottom: 1px dashed #99BBE8;
    background: #E0ECFF;
    cursor: pointer;
}

.accordion-body li div.hover a {
    color: #416AA3;
}

.accordion-body li div.selected {
    border-top: 1px solid #99BBE8;
    border-bottom: 1px solid #99BBE8;
    background: #E0ECFF;
    cursor: default;
}

.accordion-body li div.selected a {
    color: #416AA3;
    font-weight: bold;
}

/* ========== 8. MsgHelper.show 提示框 ========== */

.show-msg-wrap {
    display: flex;
    align-items: center;
    padding: var(--spacing-xs) 0;
}

.show-msg-icon {
    display: inline-block;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    margin-right: var(--spacing-sm);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center center;
}

.show-msg-icon.show-msg-success {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><circle cx="256" cy="256" r="256" fill="%2367C23A"/><path fill="%23fff" d="M213.3 350.1L121.1 257.9c-8.3-8.3-8.3-21.8 0-30.1 8.3-8.3 21.8-8.3 30.1 0l62.1 62.1 148.5-148.5c8.3-8.3 21.8-8.3 30.1 0 8.3 8.3 8.3 21.8 0 30.1L243.4 350.1c-8.3 8.3-21.8 8.3-30.1 0z"/></svg>');
}

.show-msg-icon.show-msg-error {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><circle cx="256" cy="256" r="256" fill="%23F56C6C"/><path fill="%23fff" d="M355.3 348.3L263 256l92.3-92.3c4.7-4.7 4.7-12.3 0-17l-17-17c-4.7-4.7-12.3-4.7-17 0L229 221.7l-92.3-92.3c-4.7-4.7-12.3-4.7-17 0l-17 17c-4.7 4.7-4.7 12.3 0 17L195 256l-92.3 92.3c-4.7 4.7-4.7 12.3 0 17l17 17c4.7 4.7 12.3 4.7 17 0L229 290.3l92.3 92.3c4.7 4.7 12.3 4.7 17 0l17-17c4.7-4.7 4.7-12.3 0-17z"/></svg>');
}

.show-msg-icon.show-msg-warning {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><circle cx="256" cy="256" r="256" fill="%23E6A23C"/><path fill="%23fff" d="M256 128c13.3 0 24 10.7 24 24v152c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zm0 224c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32z"/></svg>');
}

.show-msg-icon.show-msg-info {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><circle cx="256" cy="256" r="256" fill="%23409EFF"/><path fill="%23fff" d="M256 128c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm48 256c0 8.8-7.2 16-16 16h-64c-8.8 0-16-7.2-16-16v-32c0-8.8 7.2-16 16-16h8v-64h-8c-8.8 0-16-7.2-16-16v-32c0-8.8 7.2-16 16-16h48c8.8 0 16 7.2 16 16v112h8c8.8 0 16 7.2 16 16v32z"/></svg>');
}

.show-msg-text {
    line-height: 1.5;
}

/* ========== 10. DataGrid 样式覆盖 ========== */

/* 工具栏底部边框改为灰色，与表格融为一体 */
.datagrid-toolbar {
    border-color: #ddd;
    min-height: 26px;
    box-sizing: border-box;
}

.datagrid-toolbar.toolbar {
    display: flex;
    align-items: center;
    padding: 5px 10px !important;
}

.datagrid-toolbar .easyui-linkbutton {
    margin-right: var(--spacing-xs);
    vertical-align: top;
}

.datagrid-cell a {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--color-link);
    text-decoration: none;
    line-height: 18px;
    transition: color .12s ease;
}

.datagrid-cell a:hover {
    color: var(--color-link-hover);
    text-decoration: none;   /* 显式压住全局 a:hover 下划线(同优先级,后加载的 utilities.css 否则会赢);带图标操作链接(更多▼)下划线会画到图标底下 */
}

.datagrid-cell a:active {
    background: #dcecff;
}

.datagrid-body td[field="operate"] .datagrid-cell,
.datagrid-body td[field="_op"] .datagrid-cell,
.datagrid-body td[field="_action"] .datagrid-cell {
    font-size: 0;
    white-space: nowrap;
}

.datagrid-body td[field="operate"] .datagrid-cell a,
.datagrid-body td[field="_op"] .datagrid-cell a,
.datagrid-body td[field="_action"] .datagrid-cell a {
    font-size: var(--font-size-base);
    padding-left: 4px;
    padding-right: 4px;
    vertical-align: middle;
}

.datagrid-body td[field="operate"] .datagrid-cell a:hover,
.datagrid-body td[field="_op"] .datagrid-cell a:hover,
.datagrid-body td[field="_action"] .datagrid-cell a:hover,
.datagrid-body td[field="operate"] .datagrid-cell a.adm-action-hover,
.datagrid-body td[field="_op"] .datagrid-cell a.adm-action-hover,
.datagrid-body td[field="_action"] .datagrid-cell a.adm-action-hover {
    background-color: #cfe6ff !important;
    background-image: linear-gradient(#cfe6ff, #cfe6ff) !important;
}

.datagrid-body td[field="operate"] .datagrid-cell a + a,
.datagrid-body td[field="_op"] .datagrid-cell a + a,
.datagrid-body td[field="_action"] .datagrid-cell a + a {
    margin-left: 0;
    padding-left: 0;
}

.datagrid-body td[field="operate"] .datagrid-cell a + a::before,
.datagrid-body td[field="_op"] .datagrid-cell a + a::before,
.datagrid-body td[field="_action"] .datagrid-cell a + a::before {
    content: "|";
    display: inline-block;
    margin: 0 3px 0 0;
    color: #c0c4cc;
    font-weight: normal;
    pointer-events: none;
}

.combo-select-btns .combo-panel-act {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--color-link);
    text-decoration: none;
    line-height: 18px;
    transition: background-color .12s ease, color .12s ease;
}

.combo-select-btns .combo-panel-act:hover {
    background: #eef5ff;
    color: var(--color-link-hover);
    text-decoration: none;
}

.combo-select-btns .combo-panel-act:active {
    background: #dcecff;
}

.combo-select-btns .combo-panel-act + .combo-panel-act {
    margin-left: 2px;
}
