/* 全局样式 */
body {
    font-family: "Microsoft YaHei", Arial, sans-serif;
    background-color: #f0f2f5;
    min-height: 100vh;
}

/* iframe内页面容器撑满高度 */
.page-container {
    min-height: calc(100vh - 40px);
    box-sizing: border-box;
}

/* ========== 主页布局 ========== */

/* 顶部导航栏 */
.layui-layout-admin .layui-header {
    background-color: #fafafa;
    border-bottom: 1px solid #e8e8e8;
}

/* Logo */
.layui-layout-admin .layui-logo {
    color: #333;
    font-size: 18px;
    font-weight: bold;
    background-color: #fafafa;
}

/* 头部右侧区域 */
.header-right {
    float: right;
    height: 60px;
    line-height: 60px;
    padding-right: 20px;
}

/* 退出按钮 */
.header-right .logout-btn {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.header-right .logout-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: transparent;
}

/* 侧边栏 */
.layui-layout-admin .layui-side {
    width: 200px;
    background-color: #304156;
}

/* 主体内容区 */
.layui-layout-admin .layui-body {
    left: 200px;
    overflow: hidden;
    background-color: #f0f2f5;
}

/* 底部版权信息 */
.layui-layout-admin .layui-footer {
    left: 200px;
    background-color: #f0f2f5;
    border-top: 1px solid #e8e8e8;
    color: #999;
    font-size: 12px;
    text-align: center;
}

/* ========== 侧边栏导航 ========== */
.layui-layout-admin .layui-side .layui-nav {
    background: transparent;
}

.layui-layout-admin .layui-side .layui-nav .layui-nav-item a {
    color: #bfcbd9;
    height: 46px;
    line-height: 46px;
}

.layui-layout-admin .layui-side .layui-nav .layui-nav-item a:hover {
    background-color: rgba(255,255,255,0.05);
    color: #fff;
}

/* 父菜单展开状态 */
.layui-layout-admin .layui-side .layui-nav .layui-nav-item.layui-nav-itemed > a {
    background-color: rgba(255,255,255,0.05);
    color: #fff;
}

/* 当前选中 - 浅色背景 */
.layui-layout-admin .layui-side .layui-nav .layui-nav-item.layui-this > a {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
}

/* 侧边栏子菜单 */
.layui-layout-admin .layui-side .layui-nav .layui-nav-child {
    background-color: #1f2d3d;
    padding: 0;
}

.layui-layout-admin .layui-side .layui-nav .layui-nav-child dd a {
    color: #bfcbd9;
    height: 42px;
    line-height: 42px;
    padding-left: 45px;
}

.layui-layout-admin .layui-side .layui-nav .layui-nav-child dd a:hover {
    background-color: rgba(255,255,255,0.05);
    color: #fff;
}

/* 子菜单选中 - 浅色背景 */
.layui-layout-admin .layui-side .layui-nav .layui-nav-child dd.layui-this a {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
}

/* 侧边栏菜单图标 */
.layui-nav-tree .layui-nav-item a .layui-icon {
    margin-right: 8px;
    color: #bfcbd9;
}

/* 侧边栏展开箭头 */
.layui-layout-admin .layui-side .layui-nav .layui-nav-more {
    border-color: #bfcbd9 transparent transparent;
}

/* ========== 登录页 ========== */
.login-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.login-title {
    text-align: center;
    font-size: 22px;
    margin-bottom: 30px;
    color: #333;
    font-weight: bold;
}

body.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ========== 通用按钮悬停效果 ========== */
.layui-btn:hover {
    opacity: 0.9;
}

/* ========== 卡片 ========== */
.layui-card {
    margin-bottom: 15px;
    border-radius: 4px;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.layui-card-header {
    border-bottom: 1px solid #f0f0f0;
}

.layui-card-header .layui-icon {
    margin-right: 8px;
    color: #666;
}

/* ========== 开发中占位符 ========== */
.dev-placeholder {
    text-align: center;
    padding: 50px 0;
    color: #999;
    font-size: 16px;
}

/* ========== 表格 ========== */
.layui-table {
    margin-top: 0;
}

/* 表格边框加深 */
.layui-table,
.layui-table th,
.layui-table td,
.layui-table[lay-skin="line"],
.layui-table[lay-skin="row"],
.layui-table[lay-skin="nob"] {
    border-color: #c2c2c2;
}

.layui-table thead tr,
.layui-table-header {
    border-bottom-color: #c2c2c2;
}

/* ========== 表单 ========== */
.layui-form-item {
    margin-bottom: 15px;
}

/* 输入框、下拉框、文本域边框加深 */
.layui-input,
.layui-textarea,
.layui-select,
select {
    border-color: #b8b8b8;
}

/* 聚焦时边框颜色 */
.layui-input:focus,
.layui-textarea:focus,
.layui-select:focus,
select:focus {
    border-color: #1e9fff;
}

/* 下拉框箭头区域边框 */
.layui-form-select .layui-input {
    border-color: #b8b8b8;
}

.layui-form-select dl {
    border-color: #b8b8b8;
}

/* 日期选择器边框 */
.layui-laydate .layui-laydate-main {
    border-color: #b8b8b8;
}

/* 复选框、单选框边框 */
.layui-form-checkbox,
.layui-form-radio {
    border-color: #b8b8b8;
}

/* 开关按钮边框 */
.layui-form-switch {
    border-color: #b8b8b8;
}

/* 分割线颜色加深 */
.layui-border,
.layui-border-box {
    border-color: #c2c2c2;
}

/* 卡片边框 */
.layui-card {
    border: 1px solid #d9d9d9;
}

/* ========== 彩票球号样式 ========== */

/* 球号容器 */
.lottery-balls {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

/* Kara球号容器 - 两行布局 */
.lottery-balls.kara-balls {
    max-width: 530px;
}

.lottery-balls.kara-balls .ball-row {
    display: flex;
    gap: 5px;
    width: 100%;
}

/* 单个球号 - 统一蓝色正圆形 */
.lottery-ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    font-family: 'Arial', sans-serif;
    color: #fff;
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    box-shadow: 0 2px 4px rgba(24, 144, 255, 0.3);
    flex-shrink: 0;
}

/* 大号球（详情页面用） */
.lottery-ball.ball-large {
    width: 44px;
    height: 44px;
    font-size: 17px;
}

/* 特别号/特殊球 - 金橙色（与layui-bg-orange一致） */
.lottery-ball.ball-special {
    background: linear-gradient(135deg, #ffb800 0%, #f5a623 100%);
    box-shadow: 0 2px 4px rgba(255, 184, 0, 0.4);
}

/* 小号球（表格紧凑显示） */
.lottery-ball.ball-small {
    width: 40px;
    height: 40px;
    font-size: 17px;
}

/* ========== 响应式 ========== */
@media screen and (max-width: 768px) {
    .login-container {
        width: 90%;
        padding: 30px 20px;
    }

    .login-title {
        font-size: 20px;
    }

    .lottery-ball {
        width: 40px;
        height: 40px;
        font-size: 17px;
    }

    .lottery-ball.ball-large {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .lottery-ball.ball-small {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    /* Kara球容器小屏适配 */
    .lottery-balls.kara-balls {
        max-width: 450px;
    }
}

/* ========== 弹窗响应式适配 ========== */

/* 加载弹窗不显示滚动条 */
.layui-layer-loading .layui-layer-content {
    overflow: hidden !important;
}

/* 小屏幕弹窗自适应 */
@media screen and (max-height: 800px) {
    .layui-layer {
        max-height: 95vh !important;
    }

    .layui-layer-content {
        max-height: calc(95vh - 50px) !important;
        overflow-y: auto !important;
    }

    /* 加载弹窗例外 */
    .layui-layer-loading .layui-layer-content {
        overflow: hidden !important;
        max-height: none !important;
    }
}

@media screen and (max-width: 992px) {
    /* 弹窗宽度自适应 */
    .layui-layer {
        max-width: 95vw !important;
        left: 2.5vw !important;
        right: 2.5vw !important;
    }

    .layui-layer-content {
        max-height: calc(90vh - 50px) !important;
        overflow-y: auto !important;
    }

    /* 加载弹窗例外 */
    .layui-layer-loading .layui-layer-content {
        overflow: hidden !important;
        max-height: none !important;
    }
}

@media screen and (max-width: 768px) {
    /* 移动端弹窗全屏化 */
    .layui-layer {
        max-width: 98vw !important;
        width: 98vw !important;
        left: 1vw !important;
        right: 1vw !important;
        max-height: 95vh !important;
    }

    .layui-layer-content {
        max-height: calc(95vh - 100px) !important;
        overflow-y: auto !important;
        padding: 10px !important;
    }

    /* 加载弹窗例外 */
    .layui-layer-loading .layui-layer-content {
        overflow: hidden !important;
        max-height: none !important;
        padding: 0 !important;
    }

    /* 弹窗按钮区域固定在底部 */
    .layui-layer-btn {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 10px 15px;
        border-top: 1px solid #e8e8e8;
        z-index: 10;
    }
}

/* 确保弹窗内容区域可滚动 */
.layui-layer-page .layui-layer-content {
    overflow: auto !important;
}

/* 弹窗内表单响应式 */
@media screen and (max-width: 768px) {
    /* 表单行垂直排列 */
    .layui-layer .form-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .layui-layer .form-row .form-label {
        width: auto;
        text-align: left;
        margin-bottom: 5px;
        margin-right: 0;
    }

    .layui-layer .form-row .form-value {
        width: 100%;
    }

    /* 弹窗内输入框全宽 */
    .layui-layer .layui-input,
    .layui-layer .layui-textarea,
    .layui-layer select {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* 步骤式弹窗响应式 */
    .layui-layer .step-wizard {
        padding: 10px;
    }

    .layui-layer .step-indicator {
        flex-wrap: wrap;
        gap: 5px;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .layui-layer .step-item {
        font-size: 12px;
    }

    .layui-layer .step-dot {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    .layui-layer .step-content {
        min-height: auto;
    }

    .layui-layer .step-actions {
        margin-top: 10px;
        padding-top: 10px;
    }

    .layui-layer .step-actions .layui-btn {
        margin: 5px;
        padding: 0 10px;
    }

    /* 预览表格响应式 */
    .layui-layer .preview-table-wrap {
        max-height: 200px;
    }

    /* 算法参数区域响应式 */
    .layui-layer .algorithm-params-section {
        padding: 10px;
    }

    .layui-layer .param-group {
        padding: 10px;
    }

    .layui-layer .param-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .layui-layer .param-label {
        width: auto;
        line-height: 1.5;
        margin-bottom: 5px;
    }

    .layui-layer .param-input {
        width: 100%;
    }

    /* 复选框组响应式 */
    .layui-layer .checkbox-group {
        flex-direction: column;
        gap: 10px;
    }

    .layui-layer .checkbox-group label {
        margin-right: 0 !important;
    }
}

/* 中等屏幕弹窗调整 */
@media screen and (min-width: 769px) and (max-width: 1200px) {
    .layui-layer {
        max-width: 90vw !important;
    }

    .layui-layer-content {
        max-height: calc(90vh - 60px) !important;
        overflow-y: auto !important;
    }
}

/* 弹窗底部按钮区域样式优化 */
.single-algorithm-dialog > div:last-child,
.step-wizard .step-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    margin: 0 -20px -20px -20px;
    padding: 15px 20px;
    border-top: 1px solid #e8e8e8;
    z-index: 10;
}

@media screen and (max-width: 768px) {
    .single-algorithm-dialog > div:last-child,
    .step-wizard .step-actions,
    .dialog-buttons {
        margin: 0 -10px -10px -10px;
        padding: 10px;
    }

    .single-algorithm-dialog > div:last-child .layui-btn,
    .step-wizard .step-actions .layui-btn,
    .dialog-buttons .layui-btn {
        padding: 0 12px;
        height: 34px;
        line-height: 34px;
        font-size: 13px;
    }
}

/* 弹窗按钮固定底部 */
.dialog-buttons {
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 10;
}

/* 弹窗内容滚动区域 */
.dialog-scroll-content {
    max-height: calc(80vh - 150px);
    overflow-y: auto;
    padding-right: 5px;
}

@media screen and (max-height: 700px) {
    .dialog-scroll-content {
        max-height: calc(90vh - 180px);
    }
}

/* ========== 自定义表单布局 cf-* ========== */

/* 单列行 */
.cf-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

/* 垂直顶部对齐（KV区域、多行输入、上传预览） */
.cf-row-top {
    align-items: flex-start;
}

.cf-row-top > .cf-label {
    line-height: 22px;
}

/* 标签 */
.cf-label {
    width: 100px;
    flex-shrink: 0;
    text-align: right;
    font-size: 13px;
    color: #333;
    padding-right: 12px;
    line-height: 32px;
    box-sizing: border-box;
}

/* 必填星号 */
.cf-required {
    color: #ff5722;
    margin-right: 2px;
}

/* 控件区域 — 水平排列，不换行 */
.cf-control {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 输入框撑满剩余空间，覆盖Layui的width:100% */
.cf-control > .layui-input,
.cf-control > .layui-form-select {
    flex: 1;
    min-width: 0;
    width: auto;
}

/* 控件区内输入框统一高度 */
.cf-control .layui-input,
.cf-control select {
    height: 32px;
    line-height: 32px;
}

/* 后缀文字（秒、次等）— 行内不换行 */
.cf-suffix {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 提示文字（灰色小字）— 行内不换行 */
.cf-hint {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 垂直布局的cf-control（KV区域、textarea、upload） */
.cf-row-top > .cf-control {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.cf-row-top > .cf-control > .layui-textarea {
    width: 100%;
}

.cf-row-top > .cf-control > div {
    width: 100%;
}

/* 垂直布局内的提示可换行 */
.cf-row-top > .cf-control > .cf-hint {
    white-space: normal;
    width: 100%;
    margin-top: 4px;
}

/* 双列行 — CSS Grid */
.cf-row-double {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
    margin-bottom: 12px;
}

/* 双列半格 */
.cf-half {
    display: flex;
    align-items: center;
}

.cf-half > .cf-label {
    width: 100px;
    flex-shrink: 0;
}

.cf-half > .cf-control {
    flex: 1;
    min-width: 0;
}

/* switch 在 cf-control 中居中对齐 */
.cf-control .layui-form-switch {
    margin-top: 0;
}
