@import '../../../shared/styles/variables';

.employee-records-container {
  padding: 24px;
  
  .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    
    .title-section {
      h1 {
        margin: 0;
        font-size: 24px;
        font-weight: 500;
        color: #1a3a6e;
      }
      
      .subtitle {
        margin: 4px 0 0;
        color: #666;
        font-size: 14px;
      }
    }
    
    .action-buttons {
      display: flex;
      gap: 12px;

      // 强化按钮对比度
      button[mat-raised-button][color='warn'] {
        background: #ff4d4f;
        color: #fff;
      }
      button[mat-raised-button][color='primary'] {
        background: linear-gradient(90deg, #165DFF 0%, #7c3aed 100%);
        color: #fff;
      }
    }
  }
  
  .filter-card {
    margin-bottom: 24px;
    backdrop-filter: saturate(180%) blur(8px);
    border-radius: 12px;
    box-shadow: 0 6px 14px rgba(22,93,255,0.08);

    .filter-form {
      display: flex;
      flex-wrap: wrap;
      gap: 16px;
      align-items: center;
      
      mat-form-field {
        flex: 1;
        min-width: 200px;
      }
    }
  }
  
  .employee-table-container {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    overflow: auto;
    
    .employee-table {
      width: 100%;
      
      th.mat-header-cell {
        background: linear-gradient(180deg, #f7f9fc 0%, #eef3ff 100%);
        color: #1a3a6e;
        font-weight: 600;
        padding: 12px 16px;
      }
      
      td.mat-cell {
        padding: 12px 16px;
      }
      
      .status-badge {
        display: inline-block;
        padding: 4px 8px;
        border-radius: 12px;
        font-size: 12px;
        font-weight: 500;
        text-align: center;
        min-width: 60px;
        
        &.status-active {
          background-color: #e6f7ee;
          color: #00a854;
        }
        
        &.status-probation {
          background-color: #fff7e6;
          color: #fa8c16;
        }
        
        &.status-resigned {
          background-color: #f5f5f5;
          color: #999;
        }
      }
    }
    
    .empty-state {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 48px 24px;
      text-align: center;
      
      mat-icon {
        font-size: 48px;
        height: 48px;
        width: 48px;
        color: #ccc;
        margin-bottom: 16px;
      }
      
      p {
        color: #666;
        margin-bottom: 16px;
      }
    }
  }
  
  mat-paginator {
    margin-bottom: 24px;
  }
  
  .quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
    
    .quick-action-card {
      border-radius: 12px;
      transition: transform 0.2s, box-shadow 0.2s;
      box-shadow: 0 6px 16px rgba(0,0,0,0.06);
      
      &:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
      }
      
      mat-card-header {
        margin-bottom: 16px;
        
        mat-icon {
          background: linear-gradient(135deg, #e6f7ff 0%, #f3e8ff 100%);
          color: #1a3a6e;
          display: flex;
          align-items: center;
          justify-content: center;
          border-radius: 50%;
        }
      }
      
      mat-card-content {
        .highlight-count {
          font-weight: 600;
          color: #1a3a6e;
          font-size: 18px;
        }
      }
      
      mat-card-actions {
        padding: 8px 16px 16px;
      }
    }
  }

  // Material 选择面板样式
  :host ::ng-deep .hr-select-panel {
    background: #fff;
    border-radius: 10px !important;
    box-shadow: 0 12px 30px rgba(22,93,255,0.15);

    .mat-mdc-option.mdc-list-item {
      padding: 10px 16px;
    }
    .mdc-list-item__primary-text {
      color: #1a3a6e;
    }
    .mat-mdc-option.mdc-list-item--selected .mdc-list-item__primary-text {
      color: #165DFF;
      font-weight: 600;
    }
  }

  // Material 菜单面板样式
  :host ::ng-deep .hr-menu-panel {
    background: #fff;
    border-radius: 10px !important;
    box-shadow: 0 12px 30px rgba(22,93,255,0.15);
  }
  
  // HR 对话框统一样式
  :host ::ng-deep .hr-dialog {
    .mat-mdc-dialog-container .mdc-dialog__surface {
      border-radius: 12px;
      background: #ffffff;
      box-shadow: 0 12px 30px rgba(22, 93, 255, 0.15);
    }

    .mat-mdc-dialog-title {
      color: #1a3a6e;
      font-weight: 600;
    }

    .mat-mdc-dialog-actions {
      padding: 8px 24px 20px;

      .mat-mdc-raised-button {
        background: linear-gradient(90deg, #165DFF 0%, #7c3aed 100%);
        color: #fff;
      }
    }
  }
}

// 响应式布局调整
@media (max-width: 768px) {
  .employee-records-container {
    .page-header {
      flex-direction: column;
      align-items: flex-start;
      gap: 16px;
      
      .action-buttons {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
      }
    }
    
    .quick-actions {
      grid-template-columns: 1fr;
    }
  }
}

.actions-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 56px; // 统一最小高度
}

.view-detail-chip {
  cursor: pointer;
  height: 32px; // 统一芯片高度
  line-height: 32px;
  border-radius: 16px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  
  mat-icon {
    font-size: 18px;
    height: 18px;
    width: 18px;
    margin-right: 4px;
  }
}

// 修复表格行高度对齐问题
.employee-records-container {
  // 当有敏感信息展开时，轻微扩大表格容器可视宽度（通过阴影与过渡体现）
  &.sensitive-expanded .employee-table-container {
    box-shadow: 0 12px 30px rgba(22,93,255,0.18);
    transition: box-shadow 0.25s ease;
  }
}

.employee-table-container {
  .employee-table {
    .idcard,
    .bankcard {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
      letter-spacing: 0.3px;
      white-space: nowrap;
      max-width: 160px;
      display: inline-block;
      overflow: hidden;
      text-overflow: ellipsis;
      transition: max-width 0.25s ease;

      &.expanded {
        max-width: 360px; // 展开后显示更长内容
      }
    }

    .muted {
      color: #bdbdbd;
    }

    td.mat-cell {
      .mat-icon {
        color: #5a6cf3;
      }
      button.mat-icon-button:hover .mat-icon {
        color: #3f51b5;
      }
    }
  }
}