/* ==================== 任务统计页面样式 ==================== */

/* 任务统计页面容器 */
.task-stats-page {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    background: #f5f7fa;
    padding: 16px;
    overflow-y: auto;
}

/* 任务统计容器 */
.task-stats-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* 页面标题和操作区域 */
.task-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    background: white;
    border-radius: 6px;
    padding: 16px 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.task-stats-title h1 {
    font-size: 20px;
    font-weight: 600;
    color: #1d2129;
    margin: 0;
}

.task-stats-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.task-stats-date-range {
    display: flex;
    align-items: center;
}

.task-stats-select {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    background-color: white;
    color: #374151;
    outline: none;
    transition: border-color 0.2s;
}

.task-stats-select:focus {
    border-color: #0052d9;
    box-shadow: 0 0 0 2px rgba(0, 82, 217, 0.1);
}

.task-stats-btn {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background-color: white;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

/* 控制按钮内图标大小 */
.task-stats-btn i,
.task-stats-btn .fas {
    font-size: 12px;
}

.task-stats-btn:hover {
    background-color: #f5f7fa;
    border-color: #0052d9;
    color: #0052d9;
}

.task-stats-btn.primary {
    background-color: #0052d9;
    color: white;
    border-color: #0052d9;
}

.task-stats-btn.primary:hover {
    background-color: #2673dd;
    border-color: #2673dd;
}

/* 概览卡片区域 */
.task-stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.task-stats-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.task-stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0052d9, #2673dd);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.task-stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #e1e8ff;
}

.task-stats-card:hover::before {
    transform: scaleX(1);
}

.task-stats-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0052d9, #2673dd);
    color: white;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 82, 217, 0.2);
    transition: all 0.3s ease;
}

.task-stats-card:hover .task-stats-card-icon {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 82, 217, 0.3);
}

/* 任务总数卡片样式 */
.task-stats-card:nth-child(1) .task-stats-card-icon {
    background: linear-gradient(135deg, #0052d9, #2673dd);
}

.task-stats-card:nth-child(1)::before {
    background: linear-gradient(90deg, #0052d9, #2673dd);
}

/* 子任务总数卡片样式 */
.task-stats-card:nth-child(2) .task-stats-card-icon {
    background: linear-gradient(135deg, #fa8c16, #ffa940);
}

.task-stats-card:nth-child(2)::before {
    background: linear-gradient(90deg, #fa8c16, #ffa940);
}

/* 任务取消总数卡片样式 */
.task-stats-card:nth-child(3) .task-stats-card-icon {
    background: linear-gradient(135deg, #ff4d4f, #ff7875);
}

.task-stats-card:nth-child(3)::before {
    background: linear-gradient(90deg, #ff4d4f, #ff7875);
}

/* 平均完成时间卡片样式 */
.task-stats-card:nth-child(4) .task-stats-card-icon {
    background: linear-gradient(135deg, #52c41a, #73d13d);
}

.task-stats-card:nth-child(4)::before {
    background: linear-gradient(90deg, #52c41a, #73d13d);
}

.task-stats-card-content {
    flex: 1;
    min-width: 0;
}

.task-stats-card-title {
    font-size: 13px;
    color: #86909c;
    margin-bottom: 6px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.task-stats-card-value {
    font-size: 28px;
    font-weight: 700;
    color: #1d2129;
    line-height: 1.2;
    margin-bottom: 2px;
    background: linear-gradient(135deg, #1d2129, #4e5969);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.task-stats-card-subtitle {
    font-size: 11px;
    color: #c9cdd4;
    margin-top: 2px;
}



/* 图表区域 */
.task-stats-charts {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.task-stats-charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
}

.task-stats-charts-row > .full-width {
    grid-column: 1 / -1;
}

.task-stats-chart-container {
    background: white;
    border-radius: 6px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.task-stats-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.task-stats-chart-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1d2129;
    margin: 0;
}

.task-stats-chart-select {
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    background-color: white;
    color: #374151;
    outline: none;
}

.task-stats-chart-filters {
    display: flex;
    align-items: center;
    gap: 16px;
}

.task-stats-chart-legend {
    display: flex;
    gap: 16px;
}

.task-stats-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #4e5969;
}

.task-stats-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.task-stats-legend-item.created .task-stats-legend-color {
    background-color: rgba(24, 144, 255, 0.7);
}

.task-stats-legend-item.completed .task-stats-legend-color {
    background-color: rgba(82, 196, 26, 0.7);
}

.task-stats-legend-item.pending .task-stats-legend-color {
    background-color: rgba(250, 140, 22, 0.7);
}

.task-stats-chart-content {
    flex: 1;
    position: relative;
    min-height: 260px;
    height: 300px;
    width: 100%;
}

/* 任务状态分布和任务类型分布的特殊尺寸 */
.task-stats-chart-container:nth-child(1) .task-stats-chart-content,
.task-stats-chart-container:nth-child(2) .task-stats-chart-content {
    height: 280px;
    width: 100%;
}

/* 确保canvas不会超出容器 */
.task-stats-chart-content canvas {
    max-width: 100%;
    max-height: 100%;

}

/* 优化图表容器，确保图表在容器内正确显示 */
.task-stats-chart-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 数据表格区域 */
.task-stats-table-section {
    background: white;
    border-radius: 6px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-bottom: 16px;
}

.task-stats-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.task-stats-table-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1d2129;
    margin: 0;
}

.task-stats-table-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* 图表视图容器 */
.task-stats-chart-view {
    margin-top: 16px;
}

.task-stats-chart-view .task-stats-chart-content {
    height: 300px;
    width: 100%;
}

.task-stats-table-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.task-stats-search-input {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    width: 200px;
    outline: none;
}

.task-stats-search-input:focus {
    border-color: #0052d9;
    box-shadow: 0 0 0 2px rgba(0, 82, 217, 0.1);
}

.task-stats-table-container {
    overflow-x: auto;
}

.task-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.task-stats-table th,
.task-stats-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.task-stats-table th {
    font-weight: 600;
    color: #1d2129;
    background-color: #fafafa;
}

.task-stats-table tr:hover {
    background-color: #f5f7fa;
}

.task-stats-action-btn {
    padding: 4px 8px;
    border: 1px solid #0052d9;
    border-radius: 3px;
    background-color: transparent;
    color: #0052d9;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.task-stats-action-btn:hover {
    background-color: #0052d9;
    color: white;
}

/* 自定义日期范围对话框 */
.task-stats-date-range-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.task-stats-date-range-content {
    background-color: white;
    border-radius: 8px;
    padding: 24px;
    width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.task-stats-date-range-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1d2129;
    margin: 0 0 20px 0;
}

.task-stats-date-range-inputs {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.task-stats-date-input-group {
    flex: 1;
}

.task-stats-date-input-group label {
    display: block;
    font-size: 14px;
    color: #4e5969;
    margin-bottom: 8px;
}

.task-stats-date-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
}

.task-stats-date-input:focus {
    border-color: #0052d9;
    box-shadow: 0 0 0 2px rgba(0, 82, 217, 0.1);
}

.task-stats-date-range-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .task-stats-page {
        padding: 12px;
    }
    
    .task-stats-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .task-stats-actions {
        justify-content: space-between;
    }
    
    .task-stats-cards {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 12px;
    }
    
    .task-stats-card {
        padding: 16px;
        gap: 12px;
    }
    
    .task-stats-card-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .task-stats-card-value {
        font-size: 24px;
    }
    
    .task-stats-card-title {
        font-size: 12px;
    }
    
    .task-stats-card-subtitle {
        font-size: 10px;
    }
    
    .task-stats-charts-row {
        grid-template-columns: 1fr;
    }
    
    .task-stats-table-header {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .task-stats-search-input {
        width: 100%;
    }
    
    .task-stats-date-range-inputs {
        flex-direction: column;
    }
    
    .task-stats-date-range-content {
        width: 90%;
        max-width: 350px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 480px) {
    .task-stats-cards {
        grid-template-columns: 1fr;
    }
    
    .task-stats-card {
        flex-direction: column;
        text-align: center;
        padding: 20px 16px;
    }
    
    .task-stats-card-icon {
        margin-bottom: 8px;
    }
    
    .task-stats-card-content {
        text-align: center;
    }
}

/* ==================== 员工详情统计表格样式 ==================== */

/* 员工详情统计表格区域 */
.task-stats-employee-section {
    background: white;
    border-radius: 6px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-top: 16px;
}

.task-stats-employee-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.task-stats-employee-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1d2129;
    margin: 0;
}

.task-stats-employee-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.task-stats-employee-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 600px;
}

.task-stats-employee-table th,
.task-stats-employee-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.task-stats-employee-table th {
    font-weight: 600;
    color: #1d2129;
    background-color: #fafafa;
}

.task-stats-employee-table tr:hover {
    background-color: #f5f7fa;
}

/* ==================== 任务详细统计表格样式 ==================== */

/* 展开/收起按钮 */
.task-stats-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
    color: #0052d9;
    font-size: 12px;
}

.task-stats-expand-btn:hover {
    color: #2673dd;
}

.task-row {
    cursor: pointer;
}

.task-row:hover {
    background-color: #f5f7fa;
}

/* 子任务行样式 */
.sub-tasks-row {
    background-color: #f8f9fb;
}

.sub-tasks-container {
    padding: 12px 0;
    margin-left: 28px;
    width: calc(100% - 28px);
}

.sub-tasks-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.sub-tasks-table th {
    background-color: #f1f3f5;
    font-weight: 600;
    color: #495057;
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.sub-tasks-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e9ecef;
}

.sub-task-row:hover {
    background-color: #f0f2f5;
}

/* 任务名称样式 */
.task-name {
    font-weight: 500;
}

/* ==================== 员工详情统计表格样式 ==================== */

/* 员工行样式 */
.employee-row {
    cursor: pointer;
}

.employee-row:hover {
    background-color: #f5f7fa;
}

/* 员工任务类型行样式 */
.task-types-row {
    background-color: #f8f9fb;
}

.task-types-container {
    padding: 12px 0;
    margin-left: 28px;
    width: calc(100% - 28px);
}

.task-types-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    table-layout: fixed;
}

.task-types-table th {
    background-color: #f1f3f5;
    font-weight: 600;
    color: #495057;
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    white-space: nowrap;
}

.task-types-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e9ecef;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-type-row:hover {
    background-color: #f0f2f5;
}

/* 任务类型标签样式 */
.task-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.task-type[data-type="到货入库"] {
    background-color: #e6f7ff;
    color: #1890ff;
}

.task-type[data-type="耗材入库"] {
    background-color: #f0f5ff;
    color: #0052d9;
}

.task-type[data-type="销售出库"] {
    background-color: #f6ffed;
    color: #52c41a;
}

.task-type[data-type="库存移位"] {
    background-color: #fff7e6;
    color: #fa8c16;
}

.task-type[data-type="库存补货"] {
    background-color: #fff1f0;
    color: #ff4d4f;
}

.task-type[data-type="退货入库"] {
    background-color: #f9f0ff;
    color: #722ed1;
}

/* 子任务类型样式 */
.sub-task-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background-color: #f0f2f5;
    color: #495057;
    border: 1px solid #e7e8eb;
}

/* ==================== 员工详情统计样式 ==================== */

/* 员工详情统计区域 */
.task-stats-employee-section {
    margin-top: 16px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.task-stats-employee-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
}

.task-stats-employee-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1d2129;
    margin: 0;
}

.task-stats-employee-actions {
    display: flex;
    gap: 12px;
}

/* 员工表格容器 */
.task-stats-employee-container {
    padding: 0;
}

/* 员工表格样式 */
.task-stats-employee-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

.task-stats-employee-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    white-space: nowrap;
}

.task-stats-employee-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
}

.task-stats-employee-table tr:last-child td {
    border-bottom: none;
}

.task-stats-employee-table tr:hover {
    background-color: #f8f9fa;
}

/* 员工展开按钮样式 */
.employee-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    color: #495057;
    cursor: pointer;
    transition: color 0.2s;
}

.employee-expand-btn:hover {
    color: #1890ff;
}

/* 员工姓名样式 */
.employee-name {
    font-weight: 500;
    color: #1d2129;
}

/* 员工图表视图 */
.task-stats-employee-chart-view {
    padding: 16px 20px;
    display: none;
}

.task-stats-employee-chart-view.show {
    display: block;
}

/* 主类型列样式 */
.task-types-table th:nth-child(1),
.task-types-table td:nth-child(1) {
    font-weight: 500;
    color: #495057;
}

/* 子类型列样式 */
.task-types-table th:nth-child(2),
.task-types-table td:nth-child(2) {
    font-weight: 400;
    color: #495057;
}

/* 员工名称样式 */
.employee-name {
    font-weight: 500;
}

/* 移动端响应式优化 */
@media (max-width: 768px) {
    .task-stats-employee-section {
        margin-top: 12px;
        padding: 12px;
    }
    
    .task-stats-employee-header {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .task-stats-employee-table th,
    .task-stats-employee-table td {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .sub-tasks-container {
        margin-left: 16px;
        width: calc(100% - 16px);
    }
    
    .sub-tasks-table th,
    .sub-tasks-table td {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .task-types-container {
        margin-left: 16px;
        width: calc(100% - 16px);
    }
    
    .task-types-table th,
    .task-types-table td {
        padding: 6px 8px;
        font-size: 12px;
    }
}
