/* Ant Design 风格的CDK管理样式 */
.cdk-section {
    margin-bottom: 0;
}

/* CDK生成方法切换标签 - 使用统一的切换按钮样式（定义在base.css中） */

/* CDK生成区域 */
.cdk-zone {
    margin-top: 0;
}

/* 单个CDK生成按钮区域 */
.single-cdk-buttons {
    display: flex;
    gap: 16px;
    padding: 0;
    margin-top: 24px;
    justify-content: flex-start;
    align-items: center;
}

/* Ant Design 风格按钮（可复用） */
.cdk-btn {
    display: inline-block;
    font-weight: 400;
    white-space: nowrap;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    touch-action: manipulation;
    height: 32px;
    padding: 4px 15px;
    font-size: 14px;
    border-radius: 6px;
    border: 1px solid #d9d9d9;
    font-family: 'Microsoft YaHei', '微软雅黑', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.015);
    outline: none;
}

/* 纯色背景按钮样式（蓝色） */
.cdk-btn-outline {
    background: #1890ff;
    border-color: #1890ff;
    color: #fff;
}

.cdk-btn-outline:hover {
    background: #40a9ff;
    border-color: #40a9ff;
    color: #fff;
}

.cdk-btn-outline:active,
.cdk-btn-outline:focus {
    background: #096dd9;
    border-color: #096dd9;
    color: #fff;
}

/* 绿色背景按钮 */
.cdk-btn-outline-success {
    background: #52c41a;
    border-color: #52c41a;
    color: #fff;
}

.cdk-btn-outline-success:hover {
    background: #73d13d;
    border-color: #73d13d;
    color: #fff;
}

.cdk-btn-outline-success:active,
.cdk-btn-outline-success:focus {
    background: #389e0d;
    border-color: #389e0d;
    color: #fff;
}

/* 橙色背景按钮 */
.cdk-btn-outline-warning {
    background: #fa8c16;
    border-color: #fa8c16;
    color: #fff;
}

.cdk-btn-outline-warning:hover {
    background: #ffa940;
    border-color: #ffa940;
    color: #fff;
}

.cdk-btn-outline-warning:active,
.cdk-btn-outline-warning:focus {
    background: #d46b08;
    border-color: #d46b08;
    color: #fff;
}

/* 紫色背景按钮（永久CDK） */
.cdk-btn-outline-primary {
    background: #722ed1;
    border-color: #722ed1;
    color: #fff;
}

.cdk-btn-outline-primary:hover {
    background: #9254de;
    border-color: #9254de;
    color: #fff;
}

.cdk-btn-outline-primary:active,
.cdk-btn-outline-primary:focus {
    background: #531dab;
    border-color: #531dab;
    color: #fff;
}

/* 主按钮（Primary）- 保留用于批量生成 */
.cdk-btn-primary {
    background: #1890ff;
    border-color: #1890ff;
    color: #fff;
}

.cdk-btn-primary:hover {
    background: #40a9ff;
    border-color: #40a9ff;
    color: #fff;
}

.cdk-btn-primary:active,
.cdk-btn-primary:focus {
    background: #096dd9;
    border-color: #096dd9;
    color: #fff;
}

.cdk-btn-primary:disabled {
    background: #f5f5f5;
    border-color: #d9d9d9;
    color: rgba(0, 0, 0, 0.25);
    cursor: not-allowed;
    box-shadow: none;
}

.cdk-form {
    background: #f0f2f5;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    padding: 24px;
    margin-bottom: 24px;
}

.cdk-form .form-group {
    margin-bottom: 20px;
}

.cdk-form .form-group:last-child {
    margin-bottom: 0;
}

.cdk-form label {
    display: block;
    color: rgba(0, 0, 0, 0.85);
    font-size: 14px;
    font-weight: 500;
    font-family: 'Microsoft YaHei', '微软雅黑', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin-bottom: 8px;
}

.cdk-form .radio-group {
    display: flex;
    gap: 40px;
}

.cdk-form .radio-group label {
    display: flex;
    align-items: center;
    font-weight: 400;
    cursor: pointer;
    margin-bottom: 0;
}

.cdk-form .radio-group input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.cdk-form input[type="number"],
.cdk-form input[type="text"],
.cdk-form input[type="datetime-local"] {
    width: 100%;
    padding: 4px 11px;
    height: 32px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Microsoft YaHei', '微软雅黑', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: rgba(0, 0, 0, 0.85);
    transition: all 0.2s;
    box-sizing: border-box;
}

.cdk-form input[type="number"]:hover,
.cdk-form input[type="text"]:hover,
.cdk-form input[type="datetime-local"]:hover {
    border-color: #40a9ff;
}

.cdk-form input[type="number"]:focus,
.cdk-form input[type="text"]:focus,
.cdk-form input[type="datetime-local"]:focus {
    border-color: #40a9ff;
    outline: 0;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* 输入框错误状态样式 */
.cdk-form input.input-error,
.cdk-form input.input-error:focus {
    border-color: #ff4d4f !important;
    box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2) !important;
}

.form-actions {
    margin-top: 24px;
}

.form-actions .btn {
    background: #1890ff;
    color: #fff;
    border: 1px solid #1890ff;
    padding: 4px 15px;
    height: 32px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 400;
    font-family: 'Microsoft YaHei', '微软雅黑', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.2s;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
    cursor: pointer;
}

.form-actions .btn:hover {
    background: #40a9ff;
    border-color: #40a9ff;
    color: #fff;
}

.form-actions .btn:active {
    background: #096dd9;
    border-color: #096dd9;
}

.cdk-result-section {
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    padding: 16px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.result-header h4 {
    color: rgba(0, 0, 0, 0.85);
    font-size: 16px;
    font-weight: 500;
    font-family: 'Microsoft YaHei', '微软雅黑', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    color: rgba(0, 0, 0, 0.45);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f5f5f5;
    color: rgba(0, 0, 0, 0.85);
}

.result-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.result-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.result-info span {
    font-weight: 500;
    color: #1890ff;
}

.cdk-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.85);
    background: #fff;
}

.cdk-summary-table th,
.cdk-summary-table td {
    padding: 10px 12px;
    border: 1px solid #f0f0f0;
    text-align: left;
}

.cdk-summary-table th {
    width: 120px;
    background: #fafafa;
    font-weight: 500;
}

.cdk-list-container {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
}

.cdk-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.cdk-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 500;
    font-size: 13px;
    font-family: 'Microsoft YaHei', '微软雅黑', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: rgba(0, 0, 0, 0.85);
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.cdk-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    font-family: 'Microsoft YaHei', '微软雅黑', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: rgba(0, 0, 0, 0.85);
}

.cdk-table tbody tr:hover {
    background: #fafafa;
}

.cdk-table tbody tr:last-child td {
    border-bottom: none;
}

.cdk-table .cdk-code {
    font-family: monospace;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.85);
}

.cdk-table .copy-btn {
    background: #1890ff;
    color: #fff;
    border: 1px solid #1890ff;
    padding: 2px 8px;
    height: 24px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.cdk-table .copy-btn:hover {
    background: #40a9ff;
    border-color: #40a9ff;
}

.cdk-table .copy-btn:active {
    background: #096dd9;
    border-color: #096dd9;
}

/* 单个CDK结果显示 */
.single-cdk-result {
    margin-top: 24px;
}

.single-cdk-result .result-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.single-cdk-result .result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.single-cdk-result .result-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #1890ff;
}

.single-cdk-result .close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    transition: color 0.2s;
}

.single-cdk-result .close-btn:hover {
    color: #333;
}

.single-cdk-result .result-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.single-cdk-result .cdk-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.single-cdk-result .cdk-display label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.single-cdk-result .cdk-value-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f5f5f5;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
}

.single-cdk-result .cdk-value {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: 600;
    color: #1890ff;
    letter-spacing: 1px;
    word-break: break-all;
}

.single-cdk-result .copy-btn {
    background: #1890ff;
    color: #fff;
    border: 1px solid #1890ff;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.single-cdk-result .copy-btn:hover {
    background: #40a9ff;
    border-color: #40a9ff;
}

.single-cdk-result .copy-btn:active {
    background: #096dd9;
    border-color: #096dd9;
}

.single-cdk-result .cdk-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: #fafafa;
    border-radius: 6px;
}

.single-cdk-result .cdk-info p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

.single-cdk-result .cdk-info .info-label {
    font-weight: 500;
    color: #333;
    margin-right: 8px;
}

/* Ant Design 按钮风格（局部定义，仅供CDK导出按钮使用） */
.ant-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 4px 15px;
    font-size: 14px;
    font-family: 'Microsoft YaHei', '微软雅黑', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    border-radius: 6px;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: rgba(0, 0, 0, 0.85);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.015);
}

.ant-btn:hover {
    color: #4096ff;
    border-color: #4096ff;
}

.ant-btn:active {
    color: #0958d9;
    border-color: #0958d9;
    box-shadow: none;
}

.ant-btn-primary {
    background: #1677ff;
    border-color: #1677ff;
    color: #fff;
    box-shadow: 0 2px 0 rgba(5, 145, 255, 0.1);
}

.ant-btn-primary:hover {
    background: #4096ff;
    border-color: #4096ff;
    color: #fff;
}

.ant-btn-primary:active {
    background: #0958d9;
    border-color: #0958d9;
    color: #fff;
    box-shadow: none;
}

.ant-btn-sm {
    height: 28px;
    padding: 2px 12px;
    font-size: 13px;
    border-radius: 6px;
}

/* CDK查询页面样式 - 使用query.css的基础样式，这里只添加CDK特定的样式 */

#cdkQueryInput {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
    font-family: 'Microsoft YaHei', '微软雅黑', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    resize: vertical;
    margin-bottom: 16px;
    color: rgba(0, 0, 0, 0.85);
    transition: all 0.2s;
    box-sizing: border-box;
}

#cdkQueryInput:hover {
    border-color: #40a9ff;
}

#cdkQueryInput:focus {
    border-color: #40a9ff;
    outline: 0;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* CDK查询页面flex布局设置 */
.cdk-query-section,
.activity-query-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

#cdkQueryInput {
    flex-shrink: 0;
}

.query-actions {
    flex-shrink: 0;
}

.help-text {
    flex-shrink: 0;
}

.query-description {
    flex-shrink: 0;
}

.cdk-query-section h4,
.activity-query-section h4,
.activity-query-section h3 {
    flex-shrink: 0;
}

/* 活动查询的tab按钮区域 */
.activity-query-section .cdk-method-tabs {
    flex-shrink: 0;
}

/* CDK表格包装器 */
.cdk-table-wrapper {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
    margin-bottom: 20px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background: white;
    overflow: hidden;
}

/* 当有查询结果时，包装器根据内容自适应，但设置最大高度 */
.cdk-table-wrapper.has-content {
    flex: 0 1 auto;
    min-height: 0;
    max-height: 100%;
}

/* 表头固定 */
.cdk-table-header {
    flex-shrink: 0;
    overflow: hidden;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

.cdk-table-header .device-table {
    margin: 0;
    table-layout: fixed;
}

.cdk-table-header .device-table th:nth-child(1) {
    width: 6%;
    text-align: center;
}

.cdk-table-header .device-table th:nth-child(2) {
    width: 18%;
    text-align: left;
}

.cdk-table-header .device-table th:nth-child(3) {
    width: 10%;
    text-align: center;
}

.cdk-table-header .device-table th:nth-child(4) {
    width: 10%;
    text-align: center;
}

.cdk-table-header .device-table th:nth-child(5) {
    width: 18%;
    text-align: center;
}

.cdk-table-header .device-table th:nth-child(6) {
    width: 18%;
    text-align: center;
}

.cdk-table-header .device-table th:nth-child(7) {
    width: 10%;
    text-align: center;
}

.cdk-table-header .device-table th:nth-child(8) {
    width: 10%;
    text-align: center;
}

/* 活动查询表头列宽设置 */
.activity-query-section .cdk-table-header .device-table th:nth-child(1) {
    width: 6%;
    text-align: center;
}

.activity-query-section .cdk-table-header .device-table th:nth-child(2) {
    width: 18%;
    text-align: left;
}

.activity-query-section .cdk-table-header .device-table th:nth-child(3) {
    width: 10%;
    text-align: center;
}

.activity-query-section .cdk-table-header .device-table th:nth-child(4) {
    width: 10%;
    text-align: center;
}

.activity-query-section .cdk-table-header .device-table th:nth-child(5) {
    width: 10%;
    text-align: center;
}

.activity-query-section .cdk-table-header .device-table th:nth-child(6) {
    width: 10%;
    text-align: center;
}

.activity-query-section .cdk-table-header .device-table th:nth-child(7) {
    width: 16%;
    text-align: center;
}

.activity-query-section .cdk-table-header .device-table th:nth-child(8) {
    width: 16%;
    text-align: center;
}

.activity-query-section .cdk-table-header .device-table th:nth-child(9) {
    width: 14%;
    text-align: center;
}


/* 内容区域可滚动 - 根据内容自适应 */
#cdkListContent,
#activityListContent,
#extractRecordsContent {
    flex: 0 1 auto;
    min-height: 50px;
    overflow-y: auto;
    overflow-x: auto;
}

/* 当有内容时，设置最大高度以便滚动 */
.cdk-table-wrapper.has-content #cdkListContent,
.cdk-table-wrapper.has-content #activityListContent {
    max-height: 1000px;
}

/* 提取记录表格内容区域需要flex: 1来占据可用空间才能滚动 */
.cdk-table-wrapper.has-content #extractRecordsContent {
    flex: 1 1 0; /* 使用0作为基础值，让flex正确计算剩余空间 */
    min-height: 0; /* 允许flex子元素收缩 */
    max-height: 500px; /* 设置明确的最大高度，确保能显示滚动条 */
    overflow-y: auto;
    overflow-x: auto;
}

/* 活动详情页面的提取记录表格 - 确保容器有明确高度，滚动基于父容器 */
.extract-records-section .cdk-table-wrapper.has-content {
    max-height: 600px; /* 设置明确的最大高度 */
    height: 600px; /* 固定高度，确保flex子元素能正确计算 */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* 活动详情页面的提取记录表格内容区域 - 基于父容器高度计算 */
.extract-records-section .cdk-table-wrapper.has-content #extractRecordsContent {
    flex: 1 1 0; /* 占据剩余空间 */
    min-height: 0;
    height: 0; /* 配合flex: 1使用，强制基于父容器(600px)计算 */
    overflow-y: auto;
    overflow-x: auto;
    /* 确保最后一行可见 */
    padding-bottom: 8px;
    box-sizing: border-box;
}

/* 提取记录表格内容对齐 - 确保与表头对齐 */
#extractRecordsContent .device-table {
    table-layout: fixed;
}

/* 提取记录表格列宽设置 - 与表头宽度一致（6列：序号、提取时间、提取数量、操作人、备注、操作） */
#extractRecordsTable .cdk-table-header .device-table th:nth-child(1),
.extract-records-section .cdk-table-header .device-table th:nth-child(1),
#extractRecordsContent .device-table td:nth-child(1) {
    width: 6%;
    text-align: center;
}

#extractRecordsTable .cdk-table-header .device-table th:nth-child(2),
.extract-records-section .cdk-table-header .device-table th:nth-child(2),
#extractRecordsContent .device-table td:nth-child(2) {
    width: 20%;
    text-align: center;
}

#extractRecordsTable .cdk-table-header .device-table th:nth-child(3),
.extract-records-section .cdk-table-header .device-table th:nth-child(3),
#extractRecordsContent .device-table td:nth-child(3) {
    width: 10%;
    text-align: center;
}

#extractRecordsTable .cdk-table-header .device-table th:nth-child(4),
.extract-records-section .cdk-table-header .device-table th:nth-child(4),
#extractRecordsContent .device-table td:nth-child(4) {
    width: 12%;
    text-align: center;
}

#extractRecordsTable .cdk-table-header .device-table th:nth-child(5),
.extract-records-section .cdk-table-header .device-table th:nth-child(5),
#extractRecordsContent .device-table td:nth-child(5) {
    width: 32%;
    text-align: center;
}

#extractRecordsTable .cdk-table-header .device-table th:nth-child(6),
.extract-records-section .cdk-table-header .device-table th:nth-child(6),
#extractRecordsContent .device-table td:nth-child(6) {
    width: 20%;
    text-align: center;
}


/* CDK查询表格列宽设置 */
#cdkListContent .device-table {
    table-layout: fixed;
}

#cdkListContent .device-table th:nth-child(1),
#cdkListContent .device-table td:nth-child(1) {
    width: 6%;
    text-align: center;
}

#cdkListContent .device-table th:nth-child(2),
#cdkListContent .device-table td:nth-child(2) {
    width: 18%;
    text-align: left;
}

#cdkListContent .device-table th:nth-child(3),
#cdkListContent .device-table td:nth-child(3) {
    width: 10%;
    text-align: center;
}

#cdkListContent .device-table th:nth-child(4),
#cdkListContent .device-table td:nth-child(4) {
    width: 10%;
    text-align: center;
}

#cdkListContent .device-table th:nth-child(5),
#cdkListContent .device-table td:nth-child(5) {
    width: 18%;
    text-align: center;
}

#cdkListContent .device-table th:nth-child(6),
#cdkListContent .device-table td:nth-child(6) {
    width: 18%;
    text-align: center;
}

#cdkListContent .device-table th:nth-child(7),
#cdkListContent .device-table td:nth-child(7) {
    width: 10%;
    text-align: center;
}

#cdkListContent .device-table th:nth-child(8),
#cdkListContent .device-table td:nth-child(8) {
    width: 10%;
    text-align: center;
}

/* CDK状态样式 */
.device-table .status-activated {
    color: #52c41a;
    font-weight: 500;
}

.device-table .status-new {
    color: #1890ff;
    font-weight: 500;
}

.device-table .status-not-found {
    color: #ff4d4f;
    font-weight: 500;
}

/* 活动查询表格列宽设置 */
#activityListContent .device-table {
    table-layout: fixed;
}

#activityListContent .device-table th:nth-child(1),
#activityListContent .device-table td:nth-child(1) {
    width: 6%;
    text-align: center;
}

#activityListContent .device-table th:nth-child(2),
#activityListContent .device-table td:nth-child(2) {
    width: 18%;
    text-align: left;
}

#activityListContent .device-table th:nth-child(3),
#activityListContent .device-table td:nth-child(3) {
    width: 10%;
    text-align: center;
}

#activityListContent .device-table th:nth-child(4),
#activityListContent .device-table td:nth-child(4) {
    width: 10%;
    text-align: center;
}

#activityListContent .device-table th:nth-child(5),
#activityListContent .device-table td:nth-child(5) {
    width: 10%;
    text-align: center;
}

#activityListContent .device-table th:nth-child(6),
#activityListContent .device-table td:nth-child(6) {
    width: 10%;
    text-align: center;
}

#activityListContent .device-table th:nth-child(7),
#activityListContent .device-table td:nth-child(7) {
    width: 16%;
    text-align: center;
}

#activityListContent .device-table th:nth-child(8),
#activityListContent .device-table td:nth-child(8) {
    width: 16%;
    text-align: center;
}

#activityListContent .device-table th:nth-child(9),
#activityListContent .device-table td:nth-child(9) {
    width: 14%;
    text-align: center;
}


